Skip to content

MCP server authentication: OAuth, token passthrough and the identity behind each call

Updated 8 min readFor security reviewers and engineers responsible for a custom MCP server

A remote MCP server acts as an OAuth resource server: it publishes protected resource metadata, validates that each token was issued specifically for it, and must not forward that token upstream. The specification ends at your server, so reaching the data source as the right user is a separate design decision, usually per-user OAuth, token exchange or a tightly constrained application identity. A valid connection authorizes neither every tool nor every record. Prove the boundary with two identities, a cross-account request and a revocation test.

Two authorization problems, one of them in the spec

Most writing on MCP auth covers the handshake between assistant and server, and stops there. That part is well specified. The harder question for a data server is what happens on the next hop, where the specification deliberately says little: it states that your server may act as an OAuth client to an upstream API using a separate token, and leaves the rest to you. A server can pass every conformance check and still let everyone read everything through a shared warehouse login.

Draw four identities before writing code: the person, the assistant client, your server and the source credential. For each, note which system vouches for it and where permissions are checked. In the diagram, look for the break in the middle, where one token ends and another begins.

MCP clientMCP serverAuth serverData sourceCall with no token401, resource_metadataURLPKCE flow, resource = this serverToken A, audience is the servertools/call with token ACredential for thispersonQuery with separate token BOnly rows this person may seeMCPclientMCPserverAuthserverDatasourceCall with no token401, resource_metadata URLPKCE flow, resource = this serverToken A, audience is the servertools/call with token ACredential for this personQuery with separate token BOnly rows this person may see
Token A stops at the MCP server. The source only ever sees a separate credential, tied to the user.

What the current specification requires

This reflects the July 28, 2026 revision, and earlier tutorials will differ. Authorization is optional in MCP, and it applies to HTTP transports. A stdio server should not follow this flow and instead takes credentials from its environment, so an assumption from a local setup does not transfer to a remote one. The table lists the essentials for a protected remote server.

Registration has also moved. Client ID Metadata Documents are the preferred route when client and server have no prior relationship, where the client ID is an HTTPS URL pointing to a metadata document. Dynamic client registration is deprecated and retained for compatibility. An enterprise may prefer pre-registration or an allowlist of trusted domains, which the specification permits. Support varies by vendor: Snowflake’s managed MCP server documents that it does not support dynamic registration at all, so check your clients and servers as a pair.

RequirementWhoWhy it matters
Publish protected resource metadata (RFC 9728)ServerTells clients which authorization server to use
Send resource = the server’s canonical URI, in authorization and token requestsClientBinds the token to one server
Reject tokens not issued for this serverServerStops a token from another service being replayed here
Never forward the client’s token upstreamServerKeeps upstream controls and audit meaningful
Use PKCE with S256; refuse if the server’s metadata shows no supportClientProtects the authorization code
Validate iss against the recorded issuer when presentClientMitigates mix-up attacks, which PKCE alone does not stop
Return 403 insufficient_scope naming all needed scopes in one challengeServerAllows step-up without repeated prompts
Keep tokens out of query strings; send on every requestClientPrevents leakage through logs

Passthrough is tempting and forbidden

If your identity provider protects both the MCP server and the upstream API, it seems natural to accept the upstream token and hand it along. The server stays stateless and the source sees the real user. The specification explicitly forbids it. Its security guidance gives concrete reasons: controls that depend on audience get bypassed, the server cannot distinguish clients, downstream logs show a misleading source, and a stolen token turns your server into an exfiltration proxy. It also notes a practical point: a pure proxy today may need controls tomorrow, and separate audiences make that possible.

The legitimate way to get the same end result is an explicit exchange, where your server presents a token it validated and receives a new one for the upstream resource.

Reaching the source as the user

RFC 8693 token exchange is the standard mechanism. Note its distinction, which security reviewers will care about. Under delegation, the acting party keeps its own identity while acting for someone else, and the token can show both, with an act claim naming the actor. Under impersonation, the actor becomes indistinguishable from the subject within that context. Delegation gives a better audit trail: it records that a given server acted for a given person. Whether you can use it depends on your identity provider and whether the source honors the result.

Be careful about what the source does with a person’s token. Roles may not behave as you expect. Snowflake’s MCP documentation says the session uses the connecting user’s default role, and that some clients requesting all role scopes still get only that default, with secondary roles governed by a separate integration setting. It also separates permission to connect from permission to use each tool. Facts like these belong in your test plan, because per-user OAuth can still produce a different access set from the one the person sees in their usual worksheet.

Upstream modeWho enforces row accessCostUse when
Token exchangeThe sourceNeeds a shared or federated identity providerProvider and source both support it
Per-user OAuth to the sourceThe sourceSecond consent; you store refresh tokens securelyThe source has its own authorization server
Application identity, one narrow populationThe source, for that one scopeEveryone sees the same setAll users may legitimately see that data
Application identity with your own filtersYour applicationYou rebuild policy, and it will driftLast resort, with a security review

The confused deputy, and a proxy-specific version

If your server sits in front of a third-party authorization server using one static client ID, you may have the vulnerable setup the specification describes in detail. All four conditions must hold: a static client ID upstream, dynamic registration for MCP clients, a consent cookie set by the third party, and no per-client consent at your server. The attacker registers a client with their own redirect URI and sends the user a link. The third party sees the cookie and skips consent, and the code ends up with the attacker.

The required fix is your own consent page that runs before the redirect upstream. It must name the client, show the requested scopes and the redirect URI, and resist framing and CSRF. Keep an approved client list per user, match redirect URIs exactly, and treat state as single-use, set only after consent is given.

A plainer deputy failure happens at the tool layer: a caller-supplied account ID treated as proof of access. The token establishes who is calling. Everything in the arguments, including tenant, account and handle, is only a request that has yet to be authorized.

Scopes only narrow

A scope bounds what this client may do for this person. It does not replace the check on what this person may do, and the guidance lists treating scopes in a token as sufficient, without server-side authorization logic, as a common mistake. Start with a minimal scope for low-risk reads, and require elevation through a challenge on the first privileged call. Avoid wildcard scopes, and avoid putting every scope in scopes_supported, since the specification’s fallback has clients request all of those when a challenge names none. Action tools should have their own scopes, and being allowed to read a record says nothing about updating it. Check the operation when it executes, so a conversational shift from analysis to action cannot expand authority.

Three smaller points cause real defects. tools/list may vary by the presented authorization, so a per-scope list needs a private cacheScope, or a shared gateway may serve it across users. The specification also says offline_access should not appear in a server’s challenge or scopes_supported, because refresh tokens are not a resource requirement. Finally, servers must account for scope hierarchies when deciding whether a token is sufficient.

Lifecycle is where integrations rot

A successful first sign-in proves little about month six. The specification advises short-lived access tokens and requires authorization servers to rotate refresh tokens for public clients. Stored upstream credentials need encryption, and they must stay out of model-visible arguments, results, logs and demo recordings. Give operators a way to tell expired authorization from missing permission and from an unavailable source, since these lead to different actions. All three look like failure to a user, and an adapter that collapses them produces support tickets nobody can resolve.

The tests that prove the boundary

Run these in a test environment against each credential mode you support. A passing per-user configuration tells you nothing about a setup with one application identity. Inspect summaries, counts, error text and metadata as well as the main result, because a count can reveal what a hidden row would not.

  • Wrong audiencePresent a valid token issued for a different service. The server must return 401.
  • Two people, one questionCompare complete responses for people with different access. They should differ exactly as the source’s policies say.
  • Confused accountAn authorized person submits a well-formed identifier belonging to another test account. It must be refused, and the error must not confirm that the account exists.
  • Stolen handlePerson A’s handle is presented with person B’s token. It must be refused, even though the handle is valid.
  • Revocation timingRemove a role at the source and time how long until answers change, and do the same for a disabled user. Report the real window to your security team.
  • Shared cacheRequest a list as two people through your gateway and confirm neither receives the other’s response.
  • Tampered stateAlter a requestState value. The specification treats it as attacker-controlled, and if it affects access it must fail verification.
  • Scope floorCall a write tool with a read-only token, and check for a 403 naming the required scope.

Our answers, to compare against

Nexatron’s hosted MCP server documents one set of answers: OAuth 2.1 authorization code with PKCE, a workspace administrator approving an assistant before people connect, and every tool call running as the signed-in user. In Snowflake, that user’s roles, row access policies and masking policies decide what comes back. In Salesforce, sharing rules, field-level security and the role hierarchy do. Nobody, administrators included, can ask as someone else, and answers show Answered as. The scopes and error behavior are at docs.nexatron.io/integrations/mcp-reference, so run the same tests against us.

Bring three business questions

Explore your sources, definitions, and review criteria with our team. Please keep credentials and sensitive records out of the inquiry.