Authentication for MCP servers and MCP clients
Authorizer is an OAuth 2.1 authorization server for the Model Context Protocol. It can protect your own MCP server, and it ships one of its own that lets Claude, Cursor or any MCP host ask who the user is and what they may do.
Protect your own MCP server
Your MCP server publishes RFC 9728 protected resource metadata naming Authorizer as its authorization server, and answers unauthenticated calls with a 401 that points to it. Clients request a token with resource set to your server's URL (RFC 8707), so the token's audience is your server and it is useless anywhere else.
Authorizer issues those tokens through authorization code with PKCE for a signed-in user, client credentials for a service account, or RFC 8693 token exchange for an agent acting for a user. Your server verifies them against Authorizer's JWKS.
Authorizer's built-in MCP server
Start the server with --mcp-enabled and it serves MCP over streamable HTTP at <url>/mcp, with the tools meta, profile, check_permissions and list_permissions. Only tokens whose audience is exactly <url>/mcp are accepted.
MCP hosts discover everything from the 401: protected resource metadata, then authorization server metadata (RFC 8414 / OIDC discovery). Clients register themselves with Client ID Metadata Documents (--enable-client-id-metadata-document) or optional Dynamic Client Registration, behind a consent screen.
claude mcp add --transport http authorizer https://auth.example.com/mcpFrequently asked questions
- Which OAuth specs does MCP authorization use?
- OAuth 2.1 with PKCE, RFC 9728 protected resource metadata, RFC 8414 authorization server metadata and RFC 8707 resource indicators; clients register with Client ID Metadata Documents or RFC 7591 dynamic client registration. Authorizer supports all of them.
- Why is my MCP call rejected with 401?
- Most often the token's audience is wrong. Request the token with resource set to the MCP server's URL so its aud claim matches; a normal login token, whose audience is the client id, is rejected by design.