Package Exports
- @antogyn/mcp-auth
- @antogyn/mcp-auth/auth/authorization-server-handler.d.ts
- @antogyn/mcp-auth/auth/authorization-server-handler.js
- @antogyn/mcp-auth/auth/mcp-auth-handler.d.ts
- @antogyn/mcp-auth/auth/mcp-auth-handler.js
- @antogyn/mcp-auth/auth/resource-server-handler.d.ts
- @antogyn/mcp-auth/auth/resource-server-handler.js
- @antogyn/mcp-auth/auth/token-verifier.d.ts
- @antogyn/mcp-auth/auth/token-verifier.js
- @antogyn/mcp-auth/errors.d.ts
- @antogyn/mcp-auth/errors.js
- @antogyn/mcp-auth/handlers/handle-bearer-auth.d.ts
- @antogyn/mcp-auth/handlers/handle-bearer-auth.js
- @antogyn/mcp-auth/index.d.ts
- @antogyn/mcp-auth/index.js
- @antogyn/mcp-auth/routers/create-delegated-router.d.ts
- @antogyn/mcp-auth/routers/create-delegated-router.js
- @antogyn/mcp-auth/routers/create-resource-metadata-router.d.ts
- @antogyn/mcp-auth/routers/create-resource-metadata-router.js
- @antogyn/mcp-auth/types/auth-server.d.ts
- @antogyn/mcp-auth/types/auth-server.js
- @antogyn/mcp-auth/types/oauth.d.ts
- @antogyn/mcp-auth/types/oauth.js
- @antogyn/mcp-auth/types/promise.d.ts
- @antogyn/mcp-auth/types/promise.js
- @antogyn/mcp-auth/types/resource-server.d.ts
- @antogyn/mcp-auth/types/resource-server.js
- @antogyn/mcp-auth/utils/bearer-www-authenticate-header.d.ts
- @antogyn/mcp-auth/utils/bearer-www-authenticate-header.js
- @antogyn/mcp-auth/utils/create-resource-metadata-endpoint.d.ts
- @antogyn/mcp-auth/utils/create-resource-metadata-endpoint.js
- @antogyn/mcp-auth/utils/create-verify-jwt.d.ts
- @antogyn/mcp-auth/utils/create-verify-jwt.js
- @antogyn/mcp-auth/utils/fetch-server-config.d.ts
- @antogyn/mcp-auth/utils/fetch-server-config.js
- @antogyn/mcp-auth/utils/transpile-resource-metadata.d.ts
- @antogyn/mcp-auth/utils/transpile-resource-metadata.js
- @antogyn/mcp-auth/utils/validate-auth-server.d.ts
- @antogyn/mcp-auth/utils/validate-auth-server.js
- @antogyn/mcp-auth/utils/validate-server-config.d.ts
- @antogyn/mcp-auth/utils/validate-server-config.js
Readme
MCP Auth Node.js SDK
The MCP specification requires OAuth 2.1 and other RFCs for authorization. Instead of implementing all the OAuth 2.1 and OpenID Connect standards yourself, a production-ready provider and a set of libraries and tutorials can save you a lot of time and effort.
That's where MCP Auth comes in. It includes:
- An updated OAuth 2.1 and OpenID Connect provider list that meets the MCP requirements.
- A set of provider-agnostic libraries and tools to help you integrate your MCP server with any compliant provider.
- Practical tutorials and examples to get you started quickly.
And yes, it can be as simple as a few lines of code:
const server = new McpServer(/* ... */);
const mcpAuth = new MCPAuth({
server: await fetchServerConfig('<auth-server-url>', { type: 'oidc' }),
});
const app = express();
app.use(mcpAuth.bearerAuth('jwt', { requiredScopes: ['read', 'write'] }));
server.tool('whoami', ({ authInfo }) => {
// Use `authInfo` to access the auth information carried from `req.auth`
});See the documentation for the full guide.