Duczer East
Healthcare

In-perimeter AI on governed clinical and operational data.

Financial Services

Private AI and data platforms built to clear model-risk and audit review.

Financial services

Private AI, KYC/AML, API gateways and data governance for banks.

Insurance

Change data capture, governed agents and integration for insurers.

Healthcare

PHI document intelligence, FHIR APIs and in-perimeter AI for health systems and plans.

GuideIntegration & Security5 min read

MCP Authentication with OAuth: Flow, Tokens, Scopes and Mistakes

The flow in the current MCP specification, step by step.

Authored byCo-Founder and Managing Partner, Duczer East
Part of the Insights topic: API Management & Integration
On this page
  1. How does MCP authorization work?
  2. Auth flow
  3. Which client registration should we use?
  4. Token handling
  5. Scopes and step-up
  6. What does a server have to check on every request?
  7. What about local servers?
  8. Questions we hear
  9. A first engagement

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

  1. The client calls the server without a token and gets a 401 with a WWW-Authenticate header that points to the protected resource metadata.
  2. The client reads the metadata (RFC 9728) and finds the authorization server.
  3. 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.
  4. The client runs an authorization code flow with PKCE and sends the resource parameter.
  5. The client checks the issuer in the response against the one it recorded, then exchanges the code for a token.
  6. 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.

OrderMethodUse it when
1Pre-registered client informationClient and server already have a relationship, such as an internal agent platform and your own authorization server
2Client ID metadata documentThe 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
3Dynamic client registrationFallback for authorization servers that lack the second method. Deprecated in this version
4Ask the user to enter client detailsNothing 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"
MistakeWhy it hurts
Listing every scope in scopes_supportedClients ask for all of them and one stolen token reaches every tool.
Accepting tokens with the wrong audienceA token meant for another service works here.
Forwarding the client token downstreamBreaks audit and bypasses the downstream controls.
Putting the token in the URLTokens leak into logs.
One client ID and open registration on a proxyAllows consent to be skipped.

What does a server have to check on every request?

  1. An Authorization header with a Bearer token is present on every HTTP request. The token is never in the query string.
  2. The token is valid and not expired. Otherwise answer 401.
  3. The audience is this server, set by the resource parameter at issue time.
  4. The scopes cover the tool being called. Otherwise answer 403 with a scope challenge.
  5. Scope hierarchies are honored, so a broader scope that implies a narrower one is enough.
  6. 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.

Related: MCP gateway design · MCP server security checklist · WSO2 Identity Server · open source MCP gateways compared

Frequently asked questions

Does MCP use OAuth?

HTTP-based MCP servers that offer authorization should follow the specification, which builds on OAuth 2.1. Authorization is optional, and servers that use stdio should take credentials from the environment.

What is the resource parameter?

Resource Indicators (RFC 8707) tell the authorization server which MCP server a token is for. Clients must send it in authorization and token requests.

Is dynamic client registration still allowed in MCP?

It remains available for backwards compatibility but is deprecated as of version 2026-07-28. New implementations should use client ID metadata documents.

What happens when a token lacks a scope?

The server answers 403 with error insufficient_scope and the scope needed. The client asks again for the union of its old and new scopes and retries a few times at most.

Where must the token go in a request?

In the Authorization header on every HTTP request. Tokens must not be in the URL query string.

Authored by

Co-Founder and Managing Partner, Duczer East

David deBoisblanc is co-founder of Duczer East and a digital transformation and innovation leader in data-centric AI, agentic systems, and enterprise integration. He shapes intent-driven AI solutions that modernize how organizations use data, drawing on deep experience with Cloudera and complex enterprise integration landscapes.

Newsletter

The Practitioner's Briefing

Senior-level insights on agentic AI, data engineering and enterprise integration, delivered to your inbox.

One email when there is something worth reading. Unsubscribe any time.

Let's Talk

Want to discuss the ideas raised here?

Tell us what you are working on. A senior practitioner replies, and only your email is required.

Get a quote