MCP Authentication: How OAuth Works for MCP Servers
MCP authentication uses OAuth 2.1 for remote MCP servers. The flow step by step, CIMD vs DCR, and which of 37 auth providers can run it for you.
Leonard Hußke••10 min read

On this page
MCP authentication for a remote MCP server is OAuth 2.1. Your MCP server is an OAuth resource server that only checks access tokens. An authorization server, usually a separate service, signs the user in, asks for consent, and issues a token for your server alone. The MCP client (Claude, ChatGPT, Cursor) finds that authorization server on its own, registers, preferably with a Client ID Metadata Document, and uses PKCE. A local MCP server that runs over stdio skips all of this and reads its credentials from the environment.
You don't have to build the authorization server yourself. Of the 37 auth providers in our directory, 24 support MCP authorization, though some only in beta, on higher plans, or through a separate product. This post explains the flow as the MCP specification defines it in version 2026-07-28, what your server has to check, and which providers support it.
- Remote MCP servers use OAuth 2.1. The MCP server is the resource server, and an authorization server issues the tokens. Local stdio servers take credentials from the environment.
- Clients find the authorization server themselves. A 401 response points to the server's Protected Resource Metadata (RFC 9728), which names the authorization server.
- CIMD replaces Dynamic Client Registration. The 2025-11-25 spec added Client ID Metadata Documents. The 2026-07-28 spec deprecated DCR.
- Your server must check the audience. It accepts only tokens issued for its own URL and never passes a client's token on to another API.
- 24 of the 37 providers in our directory support MCP authorization. 17 of them also let MCP clients register without manual setup.
MCP authentication depends on the transport
The MCP specification makes authorization optional, and it splits the rules by transport. Servers on an HTTP-based transport "SHOULD conform" to the authorization spec. Servers on stdio "SHOULD NOT follow this specification, and instead retrieve credentials from the environment."
| Transport | Where the server runs | How it authenticates | Who signs in |
|---|---|---|---|
| stdio | On the user's machine, started by the MCP client | API keys or tokens in environment variables | Nobody. The user pastes a key into the client's config. |
| Streamable HTTP | On your servers, reached over the internet | OAuth 2.1 with an access token on every request | The user, in a browser, once per client |
The rest of this post is about remote servers over HTTP. That is the case where you ship an MCP server for your product and every user connects their own account.
How MCP authentication works, step by step
The spec gives each party one job. "A protected MCP server acts as an OAuth 2.1 resource server", and "an MCP client acts as an OAuth 2.1 client." The authorization server can be a separate service or run inside your app. Either way, it is the part an auth provider can run for you.

- The client calls your MCP server without a token. Your server answers
401 Unauthorizedwith aWWW-Authenticateheader that containsresource_metadata, the URL of its Protected Resource Metadata. - The client reads that metadata document. It "MUST include the
authorization_serversfield." If your server sends no header, the client tries the well-known Protected Resource Metadata URLs itself. - The client reads the authorization server's own metadata through OAuth discovery (RFC 8414) or OpenID Connect discovery. Authorization servers must offer at least one of the two, and clients must support both.
- The client identifies itself with a client ID. The next section covers the three ways to get one.
- The client opens a browser. The user signs in and approves the scopes. PKCE is mandatory, and clients "MUST use the
S256code challenge method when technically capable." - The client exchanges the code and the PKCE verifier for an access token. Both requests carry the
resourceparameter (RFC 8707) with your MCP server's URL. If the authorization server supports it, the token is then valid for your server only. - The client calls your tools with
Authorization: Bearer <token>on every request.
SAML vs OIDC vs OAuth explains the authorization code flow and PKCE in more detail.
Client registration: CIMD first, DCR deprecated
An authorization server only issues tokens to clients it knows. With a normal OAuth app, you register the client by hand in a dashboard. That doesn't work for MCP, because any user can connect any MCP client to any server. The client and the server have never met.
The spec lists three ways for a client to get a client ID, in this order of priority:
| Method | How it works | Status in the 2026-07-28 spec |
|---|---|---|
| Pre-registration | You create a client ID for a known client, for example your own app | Clients SHOULD support it |
| Client ID Metadata Document (CIMD) | The client ID is an HTTPS URL. The authorization server fetches the JSON document at that URL to learn the client's name and redirect URIs. | Clients and servers SHOULD support it |
| Dynamic Client Registration (DCR, RFC 7591) | The client calls a registration endpoint and receives a new client ID | MAY support. Deprecated. |
The 2025-11-25 version added CIMD "as a recommended client registration mechanism." The 2026-07-28 version deprecated DCR. It stays in the spec for at least twelve months after that release, and the spec says "new implementations should use Client ID Metadata Documents instead."
The difference matters when you pick a provider. With DCR, every user who connects a client can create a new client record in your tenant. With CIMD, one client such as Claude has one URL as its client ID, and your authorization server can decide which URLs it trusts. If your provider supports only DCR, it still works with today's clients, but check its plans for CIMD.
What your MCP server has to check
Your MCP server never sees a password. It receives a bearer token and decides whether to run the tool. The spec sets these rules for that decision:
- Check the audience. Servers "MUST validate that access tokens were issued specifically for them as the intended audience." Your server rejects a token for another API, even one from the same authorization server.
- Don't pass the token through. "The MCP server MUST NOT pass through the token it received from the MCP client." If your tool calls another API, get a separate token for that API, for example through OAuth token exchange. A token passed on would make the other API trust a token that was never issued for it.
- Ask for missing scopes. If the token lacks a scope a tool needs, answer
403witherror="insufficient_scope"and the scopes required. The client can then ask the user to approve more access. - Check the issuer. Authorization servers should return the
issparameter with the code (RFC 9207), and clients must check it. This version also requires clients to store credentials per issuer and not reuse them across authorization servers.
Scopes decide which tools a client can call. If you need more than scopes, for example "this agent may read only the documents this user owns", you need fine-grained authorization. RBAC vs ABAC vs ReBAC compares the models. Authentication vs authorization explains why the token check and the permission check are two separate steps.
API keys vs OAuth for MCP servers
Some MCP servers accept an API key in a header. That is simpler to build, and some providers use it. In our listings, Kinde's MCP support uses API keys instead of OAuth.
| API key | OAuth 2.1 | |
|---|---|---|
| Setup for the user | Create a key, paste it into the client's config | Click "Connect", sign in, approve |
| Works with clients that only support the spec's flow | No | Yes |
| Scoped per client | Only if you build it | Yes, through scopes and consent |
| Revoke one client | Delete its key | Revoke its grant or token |
| Expires | When you delete it | Short-lived access tokens, refresh tokens |
| Fits | Internal tools, stdio servers, scripts | Public MCP servers that your customers connect to |
Use API keys for stdio servers and internal tools. Use OAuth for a public MCP server that your customers connect to from Claude or ChatGPT. A user doesn't have to copy a secret, and you can see and revoke each client's access.
Which auth providers support MCP authentication
Our directory tracks eight AI and agent features for each of its 37 providers. MCP authorization means the provider can act as the authorization server for your MCP server, in some cases only in beta, on a higher plan, or through a separate product. Agent client registration means MCP clients can register on their own through CIMD or DCR.
AI and agent features across 37 auth providers
Number of providers in the Auth0Alternatives directory that support each feature, December 2026
- Developer MCP server28
- Third-party app and agent access28
- MCP authorization24
- Agent client registration19
- Agent identities17
- Token vault17
- Delegated token exchange12
- Human-in-the-loop approval11
Source: Auth0Alternatives listings
Show data
| Providers (of 37) | |
|---|---|
| Developer MCP server | 28 |
| Third-party app and agent access | 28 |
| MCP authorization | 24 |
| Agent client registration | 19 |
| Agent identities | 17 |
| Token vault | 17 |
| Delegated token exchange | 12 |
| Human-in-the-loop approval | 11 |
24 providers support MCP authorization, and 17 of them also support agent client registration. Open source is close behind. 9 of the 15 open-source providers support MCP authorization, and 15 of the 22 proprietary ones do.
Managed providers
| Provider | MCP authorization | Client registration | Free tier | Compare |
|---|---|---|---|---|
| Auth0 | Yes | CIMD and DCR | 25,000 MAU, 2 Token Vault connections | WorkOS vs Auth0 |
| WorkOS | Yes | CIMD and DCR, turned on in the dashboard | 1 million MAU of AuthKit | WorkOS vs Auth0 |
| Descope | Yes | CIMD and DCR | 7,500 MAU and 2,000 monthly active consents | Descope vs Auth0 |
| Stytch | Yes | DCR | 10,000 monthly active users and AI agents | Stytch vs Auth0 |
| Scalekit | Yes | CIMD, DCR and pre-registered | Free plan, MCP Auth included from SaaSKit Growth at $99 a month | Scalekit vs Auth0 |
| Clerk | Yes | CIMD | 50,000 monthly retained users per app | Clerk vs Auth0 |
| Amazon Cognito | Only with AWS AgentCore Gateway | No | 10,000 MAU |
Auth0 sells its AI features as the Auth0 for AI Agents add-on. Auth0's pricing page says it "adds 50% to the base price (rounded up to the dollar)." The free plan has 25,000 MAU and includes 2 Token Vault connections. Auth0's MCP docs document both CIMD and DCR and recommend CIMD for production.
WorkOS describes AuthKit as "a spec-compatible OAuth authorization server". In its MCP guide, you turn on CIMD in the dashboard, and DCR for older clients. AuthKit is free for the first million MAU, and WorkOS lists no separate charge for MCP.
Descope meters MCP use. Its free plan includes 2,000 monthly active consents, which Descope counts for MCP authentication. Paid plans start at $249 a month.
Stytch supports DCR through its Connected Apps product, and its free tier counts users and AI agents together up to 10,000. Clerk turns on CIMD when you allow public clients in its dashboard. Scalekit includes MCP Auth in SaaSKit Growth at $99 a month.
Amazon Cognito has no consent screen or client registration of its own. It works for MCP only together with AWS AgentCore Gateway. AgentCore Identity costs $0.010 per 1,000 tokens or API keys requested, and nothing extra through AgentCore Runtime or Gateway. Okta supports MCP through Cross App Access, where an admin connects each AI client. The Okta Dynamic Client Registration API needs an admin token, so clients can't register on their own. Okta competitors covers the wider choice.
Open-source and self-hosted providers
| Provider | MCP authorization | Client registration | Note from our listings | Compare |
|---|---|---|---|---|
| Keycloak | Yes | DCR, CIMD experimental | Newer versions of the MCP spec are experimental | Keycloak vs Auth0 |
| Logto | Yes | CIMD | Supports CIMD only, not DCR | Logto vs Keycloak |
| Better Auth | Yes | Yes | Better Auth vs Auth0 | |
| Casdoor | Yes | Yes | ||
| Authgear | Yes | Yes | ||
| Ory | Yes | DCR | Supports DCR only, not CIMD | |
| Zitadel | Yes | DCR | Ignores the resource parameter that MCP requires | |
| Supabase Auth | Beta | DCR | You build the consent screen yourself | |
| SuperTokens | Beta | DCR | Node.js only, a paid feature on the managed service |
Zitadel's gap matters for the audience check. Without the resource parameter, the token's audience isn't your MCP server, so your server has to validate tokens another way. If you want an open-source server that follows the current spec, look at Logto, Better Auth, or Keycloak with its experimental CIMD support. Keycloak alternatives compares the self-hosted servers.
If you run on Cloudflare Workers, Cloudflare's workers-oauth-provider library adds an OAuth 2.1 authorization server to a remote MCP server. It supports pre-registered clients, CIMD, and DCR. You then build the sign-in and the user store yourself.
Pick an MCP authorization provider
If you already use an auth provider for your app, check its row in the tables first. Your MCP server should use the same user accounts as your app, so the provider you have is usually the right one.
If you are choosing now, pick WorkOS for B2B apps that also need enterprise SSO, because AuthKit is free up to a million MAU. Pick Auth0 for a broad set of agent features, including Token Vault and human-in-the-loop approval, and budget for the 50% add-on. Pick Descope or Scalekit if MCP and agents are the center of your product. Pick Logto or Better Auth if you want to host it yourself and follow the current spec.
The MCP authorization page lists every provider with its notes, and the Token vault page shows who can store your users' tokens for other APIs.
FAQ
No. The MCP specification makes authorization optional. Servers on an HTTP transport should follow the spec's OAuth 2.1 flow if they protect anything. Local servers on stdio should take their credentials from environment variables.
OAuth 2.1. The spec says the MCP server "acts as an OAuth 2.1 resource server." Clients use the authorization code flow with mandatory PKCE (S256). The spec also uses OAuth 2.0 extensions such as Protected Resource Metadata (RFC 9728) and Resource Indicators (RFC 8707).
CIMD stands for Client ID Metadata Document. The client's ID is an HTTPS URL, and the JSON document at that URL lists the client's name and redirect URIs. The authorization server fetches it when the client first connects. MCP made CIMD the recommended way to register clients in version 2025-11-25.
Yes, but it is deprecated since spec version 2026-07-28. DCR stays in the spec for at least twelve months after that release. New implementations should use Client ID Metadata Documents. In our listings, Ory, Zitadel, Supabase Auth, and SuperTokens support only DCR today.
Yes. Auth0 can be the authorization server for an MCP server and supports both CIMD and DCR. Its AI features are part of the Auth0 for AI Agents add-on, which adds 50% to the base price of a paid plan.
Yes, for local stdio servers and internal tools. For a public MCP server, use OAuth. Clients such as Claude and ChatGPT follow the spec's OAuth flow, users don't have to copy secrets, and you can scope and revoke each client's access.