R062 · Agent principles and patterns › Agent interaction protocols

MCP authorization: OAuth 2.1 for remote tool servers

Read the original

agent-protocolsagent-authagent-governanceagent-harness

Summary

Jean Lee's post (LinkedIn, 2026-11-12) is a correct primer on how an MCP client gets a token for a remote MCP server, but it describes registration the 2025-06-18 way. In the current spec (2025-11-25), Client ID Metadata Documents are the default for clients with no prior relationship, and Dynamic Client Registration is a fallback. The four principles it names (PKCE, audience binding, least-privilege scopes, no token passthrough) are all MUSTs or SHOULDs in the spec.

The framing matters for anyone building agent harnesses: MCP authorization is plain OAuth 2.1 with the MCP server as a resource server and a separate authorization server. Nothing in it is agent-specific except the problem it solves, which is a general-purpose client that can't know in advance which scopes a tool server needs.

Scope of the spec: authorization is optional, applies to HTTP transports, and does not apply to stdio servers, which take credentials from the environment. Most local MCP servers today are stdio, so this flow only covers remote, hosted servers.

The flow

The post's six steps, with what the 2025-11-25 spec actually requires at each.

StepPost saysSpec requires
1. ChallengeServer answers 401 with authorization details401 with WWW-Authenticate: Bearer resource_metadata="...", and SHOULD add scope= with the scopes needed. Clients MUST parse it.
2. DiscoverClient finds the authorization server and its metadataTwo hops. MCP servers MUST serve Protected Resource Metadata (RFC 9728), which names the authorization server; the client then reads that server's OAuth or OIDC metadata. Clients fall back to the well-known URI when the header has no URL.
3. RegisterClient obtains a client IDPriority order: pre-registered ID, then a Client ID Metadata Document (the client_id is an HTTPS URL the server fetches), then Dynamic Client Registration, then ask the user.
4. AuthorizeUser signs in; auth code flow with PKCEPKCE is MUST, with S256. The client MUST refuse to proceed if the metadata lacks code_challenge_methods_supported. Redirect URIs must be localhost or HTTPS and match exactly.
5. Get tokenCode exchanged for a token for that serverThe resource parameter (RFC 8707, the server's canonical URI) is MUST in both the authorization and token requests. Public clients MUST get rotated refresh tokens.
6. AccessToken sent with each request; server validatesAuthorization: Bearer on every HTTP request, never in the query string. Server MUST check the token's audience is itself. Missing scope at runtime returns 403 insufficient_scope with the needed scopes, which drives step-up authorization.

The step the post leaves out is step-up. Clients start with the scopes from the 401 (or all of scopes_supported, which is meant to be the minimum for basic use) and ask for more only when a 403 names them. That is how least privilege works in practice for a client that can't predict which tools it will call.

Where the post is thin or out of date

Failure modes and a review checklist

Failure modes the spec's security section names, mapped to the spec clause that prevents each:

FailureWhat goes wrongSpec defence
Token accepted by the wrong serverA token for server A works at server B that shares an authorization serverresource on every request; server checks audience
Token passthroughMCP server forwards the client's token to GitHub or JiraServer gets its own upstream token; MUST NOT transit others
Confused deputyProxy server with a static upstream client ID skips consent for a new clientPer-client user consent before forwarding
Over-broad first grantClient requests every scope up front and keeps themStart from the 401 scope hint; step up on 403
Code interceptionAuth code stolen on redirectPKCE S256; refuse servers without PKCE metadata
CIMD abuseMalicious client_id URL makes the authorization server fetch internal endpointsSSRF controls on metadata fetch; domain trust policies
Localhost impersonationAttacker reuses a real client's metadata URL with their own localhost portShow the redirect host; extra warnings for localhost-only clients
Token in logsToken in a URL query string ends up in proxy logsBearer header only; short-lived tokens; refresh rotation

Review checklist for an MCP server or client:

Sources

Connections

See R062 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.