Join our Newsletter — 33% off our NHI Course
Home› Guides› MCP Authorisation Specification Guide: OAuth Roles, Discovery and…
Guide MCP, Protocols & Agent Platforms

MCP Authorisation Specification Guide: OAuth Roles, Discovery and Token Handling in MCP

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 17 min read
On this page

Most MCP authorisation bugs come from implementers treating the specification as "add OAuth" rather than following the exact discovery, registration and token rules it sets out. The MCP authorisation specification is a profile of OAuth 2.1 that pins down which RFCs a client and server must implement, in what order discovery happens, how a client with no prior relationship gets a client ID, and what an MCP server must refuse. This guide walks through that flow as defined in MCP specification revision 2026-07-28 (the latest dated revision when checked on 27 October 2026), flags what changed from revision 2025-11-25, and turns each requirement into implementation, test and monitoring steps. It is written for engineers building MCP clients, servers or authorisation servers, and for identity teams reviewing them. For the broader MCP threat picture, see the MCP Security Guide.

Key takeaways

  • The MCP server is an OAuth resource server, nothing more. It must publish Protected Resource Metadata (RFC 9728), validate that every token was issued for it, and never forward a client's token to an upstream API.
  • Discovery is ordered and mandatory. Clients start from a 401 with a resource_metadata pointer, fall back to two well-known URIs, then try OAuth and OpenID Connect metadata endpoints in a fixed priority order.
  • Client ID Metadata Documents are now the default for strangers. In revision 2026-07-28, Dynamic Client Registration is deprecated in favour of an HTTPS URL as the client_id; pre-registration still comes first where it exists.
  • PKCE, resource indicators and issuer checks close different holes. PKCE with S256 stops code interception, the RFC 8707 resource parameter binds tokens to one server, and RFC 9207 iss validation stops mix-up attacks.
  • Scopes start small and grow by challenge. Servers answer runtime shortfalls with 403 insufficient_scope and the required scopes; clients step up by requesting the union of old and new scopes, with retry limits.

Which revision applies, and what changed

MCP publishes dated specification revisions. Authorisation is optional for MCP implementations, but when it is supported, HTTP-based transports should conform to the authorisation specification, and stdio implementations should not follow it and should instead retrieve credentials from the environment. Revision 2026-07-28 split the authorisation material into separate pages (discovery, client registration and security considerations) and made several changes that matter for implementers.

AreaRevision 2025-11-25Revision 2026-07-28
Issuer identification (RFC 9207)Not referencedAuthorisation servers SHOULD send iss; clients MUST validate a present iss against the recorded issuer before redeeming the code (SEP-2468)
Dynamic Client RegistrationMAY, kept for backwards compatibilityDeprecated in favour of Client ID Metadata Documents; still available
DCR application_typeNot specifiedClients MUST specify it (native for desktop, CLI and localhost apps, web for remote browser apps) (SEP-837)
Credential bindingNot specifiedPersisted or pre-registered client credentials MUST be keyed by the authorisation server's issuer and MUST NOT be reused with a different one (SEP-2352)
Step-up scope setsServer may include previously granted scopesServers SHOULD emit all scopes needed for the current operation in one challenge; clients SHOULD request the union of previous and challenged scopes
Refresh tokensRotation for public clientsAdds guidance: clients MUST NOT assume refresh tokens will be issued; servers SHOULD NOT list offline_access in challenges or scopes_supported
SessionsMcp-Session-Id on Streamable HTTPProtocol-level sessions removed; authorisation MUST be included in every HTTP request

Clients that talk to servers on older revisions must support both behaviours. The draft specification continues to evolve, and the 2026-07-28 text says a future revision is expected to upgrade authorisation server inclusion of iss from SHOULD to MUST, so build for the stricter rule now.

Roles and the standards stack

The specification defines three roles. A protected MCP server acts as an OAuth 2.1 resource server. An MCP client acts as an OAuth 2.1 client making requests on behalf of a resource owner. The authorisation server interacts with the user and issues tokens; it may be co-hosted with the MCP server or be a separate identity provider.

StandardWhat MCP uses it forWho implements it
OAuth 2.1 (draft-ietf-oauth-v2-1-13)Authorisation code flow, PKCE, bearer token rules, security considerationsClient, authorisation server, MCP server
RFC 9728 Protected Resource MetadataMCP server tells clients which authorisation servers protect itMCP server MUST; client MUST use it
RFC 8414 AS Metadata / OpenID Connect Discovery 1.0Client learns endpoints, PKCE support, registration optionsAS MUST provide at least one; client MUST support both
RFC 8707 Resource Indicatorsresource parameter binds the token to the MCP server's canonical URIClient MUST send; server MUST validate audience
RFC 9207 Issuer Identificationiss in the authorisation response defeats mix-upAS SHOULD send; client MUST validate when present
Client ID Metadata Document (draft-ietf-oauth-client-id-metadata-document-00)HTTPS URL as client_idClient and AS SHOULD support
RFC 7591 Dynamic Client RegistrationLegacy registration pathMAY, deprecated in 2026-07-28
RFC 6750 Bearer Token UsageWWW-Authenticate challenges, insufficient_scopeMCP server

OAuth 2.1 and the Client ID Metadata Document specification were still Internet-Drafts when checked, and MCP pins specific draft versions. Avoid relying on draft details beyond what the MCP text itself requires. See the OAuth 2.1, GNAP and FAPI Guide for the wider OAuth 2.1 picture.

Discovery: from a 401 to the authorisation server

The flow begins when a client calls the MCP endpoint without a token. Discovery is where most interoperability failures and several security failures (notably SSRF) occur, so implement it exactly.

  1. Challenge: the server returns 401 Unauthorized. It MUST provide Protected Resource Metadata location through either the WWW-Authenticate header's resource_metadata parameter or a well-known URI, and SHOULD include a scope parameter naming the scopes needed, for example WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource", scope="files:read".
  2. Metadata fetch: clients MUST use the header URL when present. Otherwise they MUST try, in order, the path-specific URI (https://example.com/.well-known/oauth-protected-resource/public/mcp for an endpoint at /public/mcp) and then the root URI (/.well-known/oauth-protected-resource).
  3. Choose an authorisation server: the metadata document MUST contain authorization_servers with at least one entry. If there are several, the client selects one following RFC 9728 Section 7.6.
  4. Authorisation server metadata: for an issuer with a path such as https://auth.example.com/tenant1, clients MUST try /.well-known/oauth-authorization-server/tenant1, then /.well-known/openid-configuration/tenant1, then /tenant1/.well-known/openid-configuration. Without a path, they try the OAuth endpoint and then the OpenID Connect endpoint.
  5. Record the issuer: in 2026-07-28 the client MUST record the issuer from the validated metadata and store it with the PKCE verifier and state for this request. This value is what later iss checks compare against.

Every URL in this chain can come from a hostile server. The specification's security best practices list the resource_metadata URL, the authorization_servers entries and the endpoints inside authorisation server metadata as SSRF sources, and say clients SHOULD require HTTPS (loopback excepted during development), block private, loopback and link-local ranges including 169.254.0.0/16, and validate redirect targets. Server-side clients should route discovery through an egress proxy. See the SSRF Prevention Guide.

Client registration: pre-registration, CIMD or DCR

Before the authorisation request, the client needs a client_id. Clients that support all options SHOULD use this order: pre-registered credentials if available; Client ID Metadata Documents if the authorisation server advertises client_id_metadata_document_supported; Dynamic Client Registration if a registration_endpoint exists; and finally prompting the user to enter client details.

ApproachWhen it fitsSecurity propertiesWatch for
Pre-registrationKnown client and server, enterprise deployments, confidential clientsAdministrator controls redirect URIs and client authentication; credentials bound to one issuerCredentials MUST be keyed by issuer; surface an error if the advertised AS changes
Client ID Metadata DocumentOpen ecosystems where client and server have no prior relationshipClient identity tied to an HTTPS domain it controls; no registration database; portable across authorisation serversAS fetches attacker-supplied URLs (SSRF); localhost redirect impersonation
Dynamic Client RegistrationLegacy authorisation servers without CIMD supportWeakest: anyone can register a client and redirect URIEnables the confused deputy pattern in proxies; deprecated in 2026-07-28

CIMD client requirements: the metadata document MUST be hosted at an HTTPS URL with a path component (for example https://app.example.com/oauth/client-metadata.json), MUST include client_id, client_name and redirect_uris, and the client_id value MUST match the document URL exactly. Clients MAY use private_key_jwt at the token endpoint.

CIMD authorisation server requirements: it MUST check that the fetched client_id matches the URL, MUST validate presented redirect URIs against the document, MUST validate the JSON structure, SHOULD cache respecting HTTP headers, and SHOULD treat the fetch as an SSRF risk. Because a metadata document cannot prove which local process is listening on a localhost redirect, the authorisation server SHOULD warn on localhost-only redirect URIs, MAY require attestation, and MUST clearly show the redirect URI hostname at consent. Trust policies are the server's choice: an allowlist of domains for protected servers, any HTTPS client_id for open servers, or reputation and domain-age checks in between.

Decision guidance: a small team exposing one MCP server to its own staff should pre-register the few clients it supports and refuse anonymous registration. A SaaS provider offering a public MCP server should support CIMD with a domain trust policy and keep DCR only while major clients still need it, with rate limits and redirect URI review on the registration endpoint.

The authorisation request and response

With a client ID, the client builds an authorisation code request. Each parameter maps to a specific threat.

  • PKCE: clients MUST implement PKCE and MUST use S256 when technically capable. Because OAuth does not define PKCE discovery, clients MUST check that code_challenge_methods_supported is present in authorisation server metadata (OAuth or OpenID Connect) and MUST refuse to proceed if it is absent. OpenID providers serving MCP MUST include that field.
  • Resource indicator: clients MUST send resource in both the authorisation and token requests, set to the MCP server's canonical URI (for example https://mcp.example.com/mcp, lowercase scheme and host, no fragment, no trailing slash unless significant). They MUST send it even if the authorisation server does not support it.
  • State: clients SHOULD use and verify state and discard responses that lack it or do not match.
  • Redirect URIs: MUST be registered, MUST be localhost or HTTPS, and authorisation servers MUST validate them by exact match.
  • Issuer check (2026-07-28): on receiving the response, and before sending the code to any token endpoint, the client MUST apply RFC 9207 Section 2.4 validation.
authorization_response_iss_parameter_supportediss in responseClient action
truepresentCompare with recorded issuer by simple string comparison
trueabsentReject the response
false or absentpresentCompare with recorded issuer by simple string comparison
false or absentabsentProceed

The comparison is deliberately strict: clients MUST NOT apply case folding, default-port elision, trailing-slash or percent-encoding normalisation, and on a mismatch MUST NOT act on or display error, error_description or error_uri. The best practices page explains why this is needed even with PKCE: in a mix-up, the client sends the code_verifier to the attacker's token endpoint, so PKCE alone does not help.

Token handling at the MCP server

This is the section auditors should test hardest, because a single permissive code path undoes everything above.

  • Transport of the token: clients MUST send Authorization: Bearer <token> on every HTTP request and MUST NOT put tokens in the query string. With sessions removed in 2026-07-28 there is no session to fall back on.
  • Validation: servers MUST validate tokens per OAuth 2.1 Section 5.2 and MUST confirm they are the intended audience per RFC 8707. For JWT access tokens that means signature, iss, aud, exp and scope checks on every call; for opaque tokens, introspection with the same checks.
  • Failure codes: invalid or expired tokens MUST get 401; insufficient scope or permission gets 403; a malformed authorisation request gets 400.
  • No passthrough: servers MUST NOT accept or transit tokens issued for other resources, and when they call upstream APIs they act as an OAuth client with a separate token from the upstream authorisation server. See the OAuth Token Exchange and Delegation Guide for delegation patterns that keep user context without forwarding tokens.
  • Token theft: clients and servers MUST store tokens securely; authorisation servers SHOULD issue short-lived access tokens and MUST rotate refresh tokens for public clients.
  • Refresh tokens (2026-07-28): clients MUST keep them confidential, SHOULD list refresh_token in grant_types, MAY add offline_access when the authorisation server lists it, and MUST NOT assume one will be issued.

The MCP server is also a non-human identity in its own right when it calls upstream services. Give it its own credential, scoped to what its tools need. See the Agent Identity and Access Guide.

Scopes, challenges and step-up

The specification expects a progressive model: a minimal starting scope set and targeted elevation when a privileged tool is first used.

  1. Initial selection: clients SHOULD use the scope from the initial 401 challenge; if there is none, request all scopes in scopes_supported, omitting scope if that field is undefined. Because clients may request everything listed, scopes_supported should represent the minimal set for basic functionality, not the full catalogue.
  2. Runtime shortfall: the server SHOULD reply 403 Forbidden with WWW-Authenticate: Bearer error="insufficient_scope", scope="files:write", resource_metadata="..." and an optional error_description.
  3. One challenge per operation: in 2026-07-28 servers SHOULD include all scopes required for the current operation in a single challenge rather than one at a time, and MUST account for scope hierarchies when deciding whether a token is sufficient.
  4. Step-up: user-facing clients SHOULD re-authorise with the union of previously requested and newly challenged scopes, retry only a few times, and track upgrade attempts per resource and operation. client_credentials clients MAY step up or abort.

The security best practices list the common mistakes: publishing every scope in scopes_supported, wildcard scopes such as * or full-access, returning the whole catalogue in every challenge, and treating token scopes as sufficient without server-side authorisation logic. Per-object authorisation still has to happen in the server.

Implementation roadmap

  1. Inventory: list every remote MCP server, its authorisation server, registration method and the revision each client and server implements. stdio servers sit outside this flow and need the local controls in the Local MCP Server Security Guide.
  2. Server first: publish Protected Resource Metadata, emit correct 401 and 403 challenges, and enforce audience validation with a fail-closed middleware that rejects any request whose token validation throws.
  3. Authorisation server: confirm code_challenge_methods_supported, enable iss in authorisation responses and set authorization_response_iss_parameter_supported, configure short access token lifetimes, refresh token rotation and exact redirect matching, then decide CIMD trust policy and whether DCR stays on.
  4. Client: implement ordered discovery with SSRF guards, the registration priority, PKCE S256, resource, state, issuer recording and RFC 9207 validation, and issuer-keyed credential storage in the OS secret store.
  5. Test in a pilot ring: use the MCP Inspector and negative tests: a token with the wrong aud, an expired token, a token in the query string, a response with a wrong iss, metadata pointing at 169.254.169.254, and an unregistered redirect URI. Each must fail.
  6. Roll out and roll back: enable enforcement per server behind a flag, keep the previous accepted-issuer configuration for one release, and roll back by disabling the new check for a named client while you fix it, never by switching audience validation off globally.

Detection and measurement

Log at the MCP server: token validation result and reason (audience, issuer, expiry, signature), the client ID, the subject, granted and required scopes, and the tool called. Log at the authorisation server: registrations, CIMD fetches and their destinations, consent grants, refresh token reuse, and iss-related failures reported by clients. The best practices also ask servers to log elevation events with correlation IDs.

  • Audience rejection rate: requests rejected for wrong aud, by client. A sudden rise signals token replay or a misconfigured client.
  • Scope breadth: median number of scopes per issued token for MCP resources, trending down over time.
  • Step-up loop rate: operations needing more than one challenge; the target is close to zero.
  • Legacy registration share: proportion of clients still using DCR, with a target date to reach zero where the ecosystem allows.
  • Refresh token reuse detections: any value above zero needs investigation.
  • Access token lifetime: percentage of MCP tokens with lifetimes at or below your standard (for example one hour or less).

Framework mapping

MCP requirementNIST SP 800-53 Rev. 5NIST CSF 2.0ATT&CK technique addressed
Audience validation, no passthroughAC-3 Access Enforcement, IA-9 Service Identification and AuthenticationPR.AA-03T1550.001 Application Access Token
Short-lived tokens, rotation, secure storageIA-5 Authenticator ManagementPR.AA-01T1528 Steal Application Access Token
Scope minimisation and step-upAC-6 Least PrivilegePR.AA-05T1078.004 Cloud Accounts (misuse of valid credentials)
HTTPS endpoints and redirect URIsSC-8 Transmission Confidentiality and IntegrityPR.DS-02T1566.002 Spearphishing Link (consent phishing via redirects)
SSRF guards on discoverySC-7 Boundary Protection, SI-10 Information Input ValidationPR.IR-01T1552.005 Cloud Instance Metadata API
Logging of validation and elevationAU-2 Event Logging, AU-12 Audit Record GenerationPR.PS-04Supports detection of all of the above

In ISO/IEC 27001:2022 Annex A the closest controls are 5.17 Authentication information, 8.5 Secure authentication and 8.15 Logging. In the OWASP MCP Top 10 (2025 beta), this guide addresses MCP01 Token Mismanagement and Secret Exposure, MCP02 Privilege Escalation via Scope Creep and MCP07 Insufficient Authentication and Authorization.

Common failure patterns

  • Fail-open token validation: a validation error falls through to an empty or default identity. The LiteLLM MCP auth bypass is the pattern in practice: a failed token check produced an empty authentication object, so any bearer token got an MCP session. Test with garbage tokens.
  • Signature checked, audience ignored: the server accepts any token from the corporate identity provider, so a token minted for another API works against it. The specification requires rejection of tokens that do not name the server as audience.
  • Forwarding the client token upstream: forbidden by the specification, and it destroys the audit trail because upstream logs show the user, not the MCP server.
  • Omnibus scopes: scopes_supported lists every scope, generic clients request all of them, and every user ends up with admin-level tokens.
  • Skipping PKCE capability checks: the client proceeds against an authorisation server whose metadata lacks code_challenge_methods_supported, instead of refusing as required.
  • Unguarded discovery fetches: a server-side MCP client follows resource_metadata to a cloud metadata endpoint and leaks credentials in error messages.

Practitioner checklist

  • Record which MCP revision each client and server implements, and target 2026-07-28 behaviour for new builds.
  • Publish Protected Resource Metadata with at least one authorization_servers entry and a minimal scopes_supported.
  • Return 401 with resource_metadata and scope, and 403 insufficient_scope with all scopes the operation needs.
  • Validate signature, issuer, audience, expiry and scope on every request; fail closed on any validation error.
  • Never forward client tokens; use a separate upstream credential or token exchange.
  • Require PKCE S256, refuse authorisation servers without code_challenge_methods_supported, and send resource on both requests.
  • Record the issuer per request and enforce RFC 9207 validation; enable iss on your authorisation servers.
  • Prefer pre-registration or CIMD with a domain trust policy; plan DCR retirement and key stored credentials by issuer.
  • Apply HTTPS-only and private-range blocking to every discovery URL.
  • Log validation failures and scope elevations with correlation IDs, and review the metrics monthly.

Standards and references

Related NHI Mgmt Group resources: MCP Security Guide · MCP Security Best Practices Explained · Remote MCP Server Hardening Guide · OAuth 2.0 and OpenID Connect Guide · Machine-to-Machine OAuth (Client Credentials) Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.