Covers MCP 2026-07-28 authorisation · last verified 2026-11-17
Why it matters
An MCP connection is an unusual authorisation shape. A user is not calling the server directly: a host application, sometimes a third-party proxy, is calling on the user's behalf, with tools chosen by a model. Three parties need to agree on identity, and the party making the request is not the party that consented.
The specification's answer is to reuse OAuth rather than invent a scheme. On HTTP transports, the MCP server acts as an OAuth 2.1 resource server, the client acts as an OAuth client, and a separate authorisation server issues tokens. stdio servers are out of scope: they run as local processes and should read credentials from the environment instead.
That choice imports OAuth's known failure modes — audience confusion, token theft, redirect manipulation — into a setting where the client is often a desktop app and the resource is often a proxy for a fourth system.
Mental model
A building pass. The pass names the building it opens, the floors it reaches, and the person it was issued to. A guard at each door checks the pass against that door, not against the visitor's story.
The analogy breaks on bearer semantics and on delegation. A physical pass is checked by someone who can also look at you; an OAuth access token is a bearer credential — whoever holds it is treated as the subject. And the MCP server is frequently a deputy: it holds one credential to a downstream system while serving many users, which is exactly where confused-deputy attacks live.
How it works
- untrusted · user + clientdelegationuntrustedUser consents · files:readBearer aud = server
- neutral · MCP serverresource serverneutralValidates signature, aud, scopescope covers it
- tool callneutralTool call · files.readreturns
- untrusted contentneutralTool output · textread as text
- untrusted · user + clientcontextuntrustedModel reads the result
- trusted · downstream APITool call · files.read· forwards the client tokenno token passthrough · openValidates signature, aud, scope· own credentialno token passthrough · opendownstreamtrustedFiles API · own audience
delegation. The user consents to a scope, and the client obtains a token whose resource is this MCP server. The party calling is not the party that consented.
Figure. The boundary is a refusal to pass the client's token through. Audience validation in the server node is always on and is not a control state; the drawn gate is the downstream passthrough. Blocked, the server uses its own downstream credential. It does not make tool output trustworthy, drawn as a separate path back to the model, and it does not replace per-call approval. Shown with passthrough open.
What to notice. Residual risk: an access token is a bearer credential, so a stolen one is replayable until expiry. Discovery SSRF, a confused deputy at a proxy, state-handle hijacking and scope step-up are not drawn.
Text version
Three zones: UNTRUSTED · USER + CLIENT holds the consent to files:read and the model that reads the result; NEUTRAL · MCP SERVER holds the resource server that validates signature, audience and scope, the files.read tool call, and the returned tool output text; TRUSTED · DOWNSTREAM API holds the Files API with its own audience. A solid path carries the bearer token from consent to the server, and a solid path runs from the check to the tool call as the scope covers it. Two paths reach the API: a solid one labelled own credential from the validation node, and a dashed red one labelled forwards the client token from the tool call. Both are under the no-token-passthrough control, while audience validation stays always on in the server node: open, the client token is replayed downstream; blocked, the passthrough is cut at a teal bar and the own-credential path passes with a teal tick. Separately, the tool result returns to the tool output and then to the model as a dashed red path, and is not affected by the passthrough gate.
- Unauthenticated request. The client calls the server without a token. The server replies
401with aWWW-Authenticate: Bearerchallenge containingresource_metadataand, ideally, thescoperequired for the operation. - Resource metadata. The client fetches the protected resource metadata document (RFC 9728). It lists the authorization servers for this resource and the scopes the resource understands.
- Authorisation server discovery. The client reads the authorisation server's metadata via OAuth 2.0 metadata (RFC 8414) or OpenID Connect discovery, and records the issuer.
- Client registration. The client obtains a client ID by one of three routes: a Client ID Metadata Document (an HTTPS URL that identifies the client), pre-registration, or dynamic client registration. Dynamic registration is deprecated in the current revision and retained for older authorisation servers.
- Authorisation request. The client generates PKCE parameters, includes the
resourceparameter (RFC 8707) naming the MCP server, requests the narrowest scope set it can justify, and records the expected issuer alongside the PKCE verifier. - Callback validation. The user approves. The client checks the
issparameter in the response against the issuer it recorded, then exchanges the code with the sameresourcevalue. - Every request carries the token.
Authorization: Bearer <token>on each HTTP request; never in a query string. The server validates signature, expiry, audience and scope before doing any work. - Step-up on insufficient scope. A
403witherror="insufficient_scope"and ascopeparameter tells the client which additional scopes the operation needs. The client re-authorises with the union of previously granted and newly challenged scopes, retries a bounded number of times, then treats it as a permanent failure.
POST /mcp HTTP/1.1
Host: mcp.example.com
Authorization: Bearer <access-token>
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/listDesigning scopes
Scopes should map to operations, not to the server as a whole. files:read and files:write give a host something to request narrowly and a user something to understand; files:* gives neither. Advertise a minimal scopes_supported set, challenge for more when an operation needs it, and log every elevation with a correlation ID.
Two design rules follow. First, emit the complete scope set required by an operation in a single challenge rather than one scope at a time — incremental challenges multiply round trips and consent prompts. Second, treat scope hierarchies explicitly: if admin implies read, the server must decide sufficiency with that in mind, while clients can keep accumulating the union.
Trade-offs
| Approach | Good for | Cost | Fails when |
|---|---|---|---|
| No auth, stdio only | Local developer tools | Runs with the user's own privileges | The server listens on a socket or is proxied |
| Static API key | Internal single-tenant services | No user identity, no scopes, hard to revoke | Multiple users share the key |
| OAuth per user | SaaS integrations on a user's behalf | Token storage, refresh, consent UX | Client registration is skipped or redirect URIs are loose |
| OAuth proxy with one static upstream client | Bridging to APIs without dynamic registration | Per-client consent becomes mandatory | The proxy relies on a third-party consent cookie |
Good for
Local developer tools
Cost
Runs with the user's own privileges
Fails when
The server listens on a socket or is proxied
- The server listens on a socket or is proxied
- Multiple users share the key
- Client registration is skipped or redirect URIs are loose
- The proxy relies on a third-party consent cookie
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: No auth, stdio only is good for Local developer tools, costs Runs with the user's own privileges, and fails when The server listens on a socket or is proxied. Static API key is good for Internal single-tenant services, costs No user identity, no scopes, hard to revoke, and fails when Multiple users share the key. OAuth per user is good for SaaS integrations on a user's behalf, costs Token storage, refresh, consent UX, and fails when Client registration is skipped or redirect URIs are loose. OAuth proxy with one static upstream client is good for Bridging to APIs without dynamic registration, costs Per-client consent becomes mandatory, and fails when The proxy relies on a third-party consent cookie
Failure modes
- Token passthrough. The server forwards the client's token downstream. Debug: inspecting outbound requests for an
Authorizationheader that matches an inbound one; they should never be the same credential. - Missing audience check. Any valid token is accepted, so a token for another service works here. Debug: minting a token for a different resource and asserting a
401; if it succeeds, validation is incomplete. - Confused deputy at a proxy. A proxy uses one static client ID upstream and skips per-client consent, so an attacker's dynamically registered client inherits a consent cookie. Debug: registering a second client and confirming a fresh consent screen appears for it.
- SSRF through discovery. A malicious server returns a
resource_metadataURL pointing at an internal address or a cloud metadata endpoint, and the client fetches it. Debug: routing all discovery fetches through an egress policy that blocks private ranges, and by logging every outbound discovery URL. - State handle hijacking. A server mints a cart or task ID and treats possession as identity. Debug: presenting a valid handle under a different authenticated principal and asserting a rejection.
In production
Store tokens per user and per server, encrypted, and never in a shared cache keyed only by server URL. Refresh proactively, and treat refresh failure as a re-authorisation event rather than a retry storm. Revocation has to reach the server: a token that stays valid after a user disconnects is a support incident waiting to happen.
Put every HTTP MCP client behind an egress policy. Discovery fetches, redirects and token endpoints are all attacker-influenced URLs in the threat model; block private ranges, require HTTPS outside loopback, and do not follow redirects blindly.
Local servers need their own controls. A one-click install that runs npx something executes arbitrary code with the user's privileges; the host must show the exact command, require explicit consent, and sandbox where the platform allows. Prefer stdio over a local HTTP port, which any process on the machine can reach.
Finally, log authorization decisions, not tokens. Record subject, server, tool, scope used, and whether a human approved — enough to reconstruct an incident without creating a credential leak in the log store.
Common misconceptions
People think: MCP defines its own authentication scheme.
Actually: It profiles OAuth 2.1 for HTTP transports and adds discovery requirements. There is no MCP-specific token format; the tokens are ordinary OAuth access tokens with a resource audience.
People think: A valid token means the action is allowed.
Actually: A token proves the user delegated a scope to a client. Whether this particular tool call is acceptable is still a host policy decision, and high-impact actions deserve per-call approval.
People think: Tool results are safe because they come from an authorised server.
Actually: Authorisation covers the caller, not the content. A compromised or merely untrusted server can return text that tries to redirect the model; treat it as untrusted input.
Interview angle
"Design authorisation for an MCP deployment that serves many users through one host." Strong answers separate the three roles, walk the discovery and token flow, insist on audience binding and no passthrough, and design scopes that can be stepped up. Then they name the attacks they would test for: confused deputy at a proxy, SSRF during discovery, handle hijacking, and prompt injection through tool output. See untrusted input and the security interview category.
Sources
- MCP authorization specification, 2026-07-28 — roles, discovery, resource parameter, scope handling and errors.
- MCP security best practices — confused deputy, token passthrough, SSRF, handle hijacking, local server risk.
- RFC 9728: OAuth 2.0 Protected Resource Metadata — how a resource advertises its authorisation servers.
- RFC 8707: Resource Indicators for OAuth 2.0 — binding a token to one resource.
Related
- MCP — protocol scope and the trust boundary.
- Host/client/server — where tokens live in the topology.
- Tools, resources and prompts — which primitives need which scopes.
- Untrusted input — treating tool output as data, not instructions.