Short answer: an MCP client finds the server's authorization server through protected resource metadata, registers or identifies itself, runs an authorization code flow with PKCE, asks for a token for that specific server and sends it in the Authorization header. The server must accept only tokens issued for it. This follows the specification version 2026-07-28, checked November 24, 2026.
How does MCP authorization work?
Authorization is optional in MCP. When a server supports it over an HTTP-based transport, the specification says implementations should conform to it. The roles map onto standard OAuth 2.1 roles: the MCP server is the resource server, the MCP client is the OAuth client, and a separate authorization server issues the tokens. The specification leaves the authorization server's internals open, so it can be your identity provider or part of the same product.
Auth flow
- The client calls the server without a token and gets a 401 with a WWW-Authenticate header that points to the protected resource metadata.
- The client reads the metadata (RFC 9728) and finds the authorization server.
- The client reads the authorization server metadata and identifies itself with a client ID metadata document, pre-registration or, for older servers, dynamic registration. Dynamic registration is deprecated in this version.
- The client runs an authorization code flow with PKCE and sends the resource parameter.
- The client checks the issuer in the response against the one it recorded, then exchanges the code for a token.
- The client calls the server with the token in the Authorization header on every request.
Which client registration should we use?
The specification names three ways for a client to obtain a client ID and gives a priority order for clients that support all of them.
| Order | Method | Use it when |
|---|---|---|
| 1 | Pre-registered client information | Client and server already have a relationship, such as an internal agent platform and your own authorization server |
| 2 | Client ID metadata document | The authorization server says it supports them. The client ID is an HTTPS URL that points to a JSON document with client_id, client_name and redirect_uris |
| 3 | Dynamic client registration | Fallback for authorization servers that lack the second method. Deprecated in this version |
| 4 | Ask the user to enter client details | Nothing else is available |
An authorization server that accepts client ID metadata documents must check that the document's client_id matches its URL exactly and that the redirect URI in the request appears in the document. Clients that keep credentials from pre-registration must tie them to the issuer that gave them out, and register again if the protected resource metadata later names a different authorization server.
Token handling
The server validates the token and checks that it was issued for it. It must not accept or pass on any other token. If the server needs a downstream API, it gets its own token for that API. The client sends the resource parameter, set to the server's canonical URI, in both the authorization request and the token request, even if the authorization server does not support it.
Scopes and step-up
The server should say which scopes a request needs in the WWW-Authenticate header. When a client lacks a scope, the server answers 403 with error insufficient_scope and the scope needed. The client then asks for a larger scope, keeping what it already holds, and retries a few times at most. The specification's own example looks like this:
HTTP/1.1 403 Forbidden
WWW-Authenticate: Bearer error="insufficient_scope", scope="files:write", resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource"| Mistake | Why it hurts |
|---|---|
| Listing every scope in scopes_supported | Clients ask for all of them and one stolen token reaches every tool. |
| Accepting tokens with the wrong audience | A token meant for another service works here. |
| Forwarding the client token downstream | Breaks audit and bypasses the downstream controls. |
| Putting the token in the URL | Tokens leak into logs. |
| One client ID and open registration on a proxy | Allows consent to be skipped. |
What does a server have to check on every request?
- An Authorization header with a Bearer token is present on every HTTP request. The token is never in the query string.
- The token is valid and not expired. Otherwise answer 401.
- The audience is this server, set by the resource parameter at issue time.
- The scopes cover the tool being called. Otherwise answer 403 with a scope challenge.
- Scope hierarchies are honored, so a broader scope that implies a narrower one is enough.
- The decision is logged with the tool and the identity.
What about local servers?
The specification says servers that use the stdio transport should not follow the authorization flow and should take credentials from the environment. That makes the process and its launch configuration the control point, so review how it is started and what it can reach. A local server that listens on HTTP is different: it should require a token or use a restricted channel such as a Unix domain socket.
Questions we hear
Do we have to run our own authorization server? No. The specification leaves the authorization server's implementation open, and many teams point the MCP server at the identity provider they already run. What matters is that it supports the discovery and token rules above.
Is PKCE optional? No. The client generates PKCE parameters in the flow the specification describes, and the client checks the issuer in the response before it sends the code anywhere.
Where does a gateway fit? A gateway can validate audience and scope, and challenge for more scope, in one place for many MCP servers. See MCP gateway design and the security checklist.
A first engagement
Duczer East offers an MCP authorization review: we trace one request from client to token to tool in your design, compare it with the steps above and return a list of gaps with owners.



