GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing modelcontextprotocol.io — Authorization - Model Context Protocol IntroductionPurpose and ScopeThe Model Context Protocol provides authorization capabilities at the transport level, enabling MCP clients to make requests to restricted MCP servers on behalf of resource owners. This specification defines the authorization flow for HTTP-based transports.Protocol RequirementsAuthorization is OPTIONAL for MCP implementations. When supported:
Standards ComplianceThis authorization mechanism is based on established specifications listed below, but implements a selected subset of their features to ensure security and interoperability while maintaining simplicity:
RolesA protected MCP server acts as an OAuth 2.1 resource server, capable of accepting and responding to protected resource requests using access tokens. An MCP client acts as an OAuth 2.1 client, making protected resource requests on behalf of a resource owner. The authorization server is responsible for interacting with the user (if necessary) and issuing access tokens for use at the MCP server. The implementation details of the authorization server are beyond the scope of this specification. It may be hosted with the resource server or a separate entity. Authorization Server Discovery specifies how an MCP server indicates the location of its corresponding authorization server to a client.Overview
Authorization Server DiscoveryMCP servers advertise their associated authorization servers through OAuth 2.0 Protected Resource Metadata, and MCP clients determine authorization server endpoints and supported capabilities through authorization server metadata discovery. Implementations MUST follow the normative discovery requirements defined in Authorization Server Discovery.Client RegistrationBefore initiating the authorization flow, MCP clients MUST obtain a client ID through one of three registration mechanisms: Client ID Metadata Documents, pre-registration, or Dynamic Client Registration, following the requirements and selection priority defined in Client Registration.Scope Selection StrategyMCP servers SHOULD include ascope parameter in the WWW-Authenticate header as defined in
RFC 6750 Section 3
to indicate the scopes required for accessing the resource. This provides clients with immediate
guidance on the appropriate scopes to request during authorization,
following the principle of least privilege and preventing clients from requesting excessive permissions.
The scopes included in the WWW-Authenticate challenge MAY match scopes_supported, be a subset
or superset of it, or an alternative collection that is neither a strict subset nor
superset. Clients MUST NOT assume any particular set relationship between the challenged
scope set and scopes_supported. Clients MUST treat the scopes provided in the
challenge as authoritative for the current operation. These scopes are required to
satisfy the current request. When re-authorizing, clients SHOULD include these scopes
alongside any previously granted scopes to avoid losing permissions needed for other operations
(see Step-Up Authorization Flow). Servers SHOULD strive for
consistency in how they construct scope sets but they are not required to surface every dynamically
issued scope through scopes_supported.
Example 401 response with scope guidance:
scopes_supported field is intended to represent the minimal set of scopes necessary
for basic functionality (see Scope Minimization),
with additional scopes requested incrementally through the step-up authorization flow steps
described in the Scope Challenge Handling section.
Authorization Flow StepsThe registration step shown in the flow uses one of the mechanisms defined in Client Registration. The complete Authorization flow proceeds as follows:Authorization Response ValidationBefore redirecting the user-agent, the client MUST record theissuer value from the selected authorization server’s validated metadata document (see Authorization Server Metadata Discovery) and associate it with the same per-request record used to store the PKCE code verifier (and the state value, if used). The validation in this section depends on that recorded value being authentic; it provides no protection if the expected issuer was obtained from an unvalidated source.
MCP authorization servers SHOULD include the iss parameter in authorization responses, including error responses, as defined in RFC9207 Section 2. Authorization servers that include the iss parameter MUST advertise this by setting authorization_response_iss_parameter_supported to true in their metadata (RFC9207 Section 2.3).
On receiving the authorization response, MCP clients MUST apply the validation in RFC9207 Section 2.4 before transmitting the authorization code to any token endpoint:
iss against the recorded issuer regardless of metadata advertisement, to accommodate authorization servers that emit iss before updating their metadata.
A future revision of this specification is expected to upgrade authorization server inclusion of iss from SHOULD to MUST. Implementers are encouraged to emit and validate iss now to ease that transition; client rejection behavior on iss absence will continue to be keyed on authorization_response_iss_parameter_supported until that revision defines the upgrade path.
After decoding the iss value from the application/x-www-form-urlencoded response per RFC 9207 Section 2.4, clients MUST NOT apply scheme or host case folding, default-port elision, trailing-slash, or percent-encoding normalization (RFC 3986 Sections 6.2.2-6.2.3) before comparison.
This validation applies equally to error responses - on mismatch the client MUST NOT act on or display error, error_description, or error_uri.
Resource Parameter ImplementationMCP clients MUST implement Resource Indicators for OAuth 2.0 as defined in RFC 8707 to explicitly specify the target resource for which the token is being requested. Theresource parameter:
Canonical Server URIFor the purposes of this specification, the canonical URI of an MCP server is defined as the resource identifier as specified in RFC 8707 Section 2 and aligns with theresource parameter in
RFC 9728.
MCP clients SHOULD provide the most specific URI that they can for the MCP server they intend to access, following the guidance in RFC 8707. While the canonical form uses lowercase scheme and host components, implementations SHOULD accept uppercase scheme and host components for robustness and interoperability.
Examples of valid canonical URIs:
Note: While bothFor example, if accessing an MCP server at https://mcp.example.com, the authorization request would include:
Access Token UsageToken RequirementsAccess token handling when making requests to MCP servers MUST conform to the requirements defined in OAuth 2.1 Section 5 “Resource Requests”. Specifically:
Token HandlingMCP servers, acting in their role as an OAuth 2.1 resource server, MUST validate access tokens as described in OAuth 2.1 Section 5.2. MCP servers MUST validate that access tokens were issued specifically for them as the intended audience, according to RFC 8707 Section 2. If validation fails, servers MUST respond according to OAuth 2.1 Section 5.3 error handling requirements. Invalid or expired tokens MUST receive an HTTP 401 response. MCP clients MUST NOT send tokens to the MCP server other than ones issued by the MCP server’s authorization server. MCP servers MUST only accept tokens that are valid for use with their own resources. MCP servers MUST NOT accept or transit any other tokens.Refresh TokensThis section provides guidance for MCP Clients and MCP Servers when handling or issuing refresh tokens for both OAuth and OpenID Connect. MCP Clients that desire refresh tokens:
offline_access in
WWW-Authenticate scope or Protected Resource Metadata scopes_supported, as refresh
tokens are not a resource requirement.
Error HandlingServers MUST return appropriate HTTP status codes for authorization errors:
Scope Challenge HandlingThis section covers handling insufficient scope errors during runtime operations when a client already has a token but needs additional permissions. This follows the error handling patterns defined in OAuth 2.1 Section 5 and leverages the metadata fields from RFC 9728 (OAuth 2.0 Protected Resource Metadata).Runtime Insufficient Scope ErrorsWhen a client makes a request with an access token with insufficient scope during runtime operations, the server SHOULD respond with:
scope
parameter, consistent with
RFC 6750 Section 3.1.
The scope attribute describes the scopes necessary to access
the requested resource — servers are not required to include
the client’s previously granted scopes.
Whatever scope-inclusion strategy a server adopts, servers SHOULD include all
scopes required for the current operation in a single challenge.
Challenging incrementally (returning one missing scope, then another
on the subsequent retry) forces multiple authorization round-trips
for a single operation and degrades user experience. The required
scopes may be determined dynamically based on the specific request
arguments and context, but once determined, they should be emitted
together.
Servers SHOULD be consistent in their scope inclusion strategy to provide predictable behavior for clients.
Servers SHOULD consider the user experience impact when determining which scopes to include in the
response, as misconfigured scopes may require frequent user interaction.
Scope accumulation across operations is a client-side responsibility. See the
Step-Up Authorization Flow for the scope-union requirement.
Example insufficient scope response:
Step-Up Authorization FlowClients will receive scope-related errors during initial authorization or at runtime (insufficient_scope).
Clients SHOULD respond to these errors by requesting a new access token with an increased set of scopes via a step-up authorization flow or handle the errors in other, appropriate ways.
Clients acting on behalf of a user SHOULD attempt the step-up authorization flow. Clients acting on their own behalf (client_credentials clients)
MAY attempt the step-up authorization flow or abort the request immediately.
The flow is as follows:
Security ConsiderationsImplementations of this specification MUST follow the normative security requirements in Security Considerations, covering token audience binding and validation, token theft, communication security, authorization code protection, mix-up and confused deputy attacks, open redirection, and Client ID Metadata Document security.MCP Authorization ExtensionsThere are several authorization extensions to the core protocol that define additional authorization mechanisms. These extensions are:
Was this page helpful? | |||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |