Adding OAuth 2.1 to your MCP server in TypeScript
typescript
dev.to
If you're building an MCP server, sooner or later someone is going to ask: how does authentication work? The MCP spec leaves this open. Most early servers shipped with no auth at all, or a hardcoded API key in an environment variable. That's fine for local Claude Desktop use. It falls apart the moment you publish a remote MCP server that real users connect to. The right answer is OAuth 2.1 with PKCE, plus four RFCs that nobody enjoys reading: 9728 (Protected Resource Metadata), 8707 (Resource