Skip to main content

Introduction

Purpose and Scope

This document provides security considerations for the Model Context Protocol (MCP), complementing the MCP Authorization specification. This document identifies security risks, attack vectors, and best practices specific to MCP implementations. The primary audience for this document includes developers implementing MCP authorization flows, MCP server operators, and security professionals evaluating MCP-based systems. This document should be read alongside the MCP Authorization specification and OAuth 2.0 security best practices.

Attacks and Mitigations

This section gives a detailed description of attacks on MCP implementations, along with potential countermeasures.

Confused Deputy Problem

Attackers can exploit MCP proxy servers that connect to third-party APIs, creating “confused deputy” vulnerabilities. This attack allows malicious clients to obtain authorization codes without proper user consent by exploiting the combination of static client IDs, dynamic client registration, and consent cookies.

Terminology

MCP Proxy Server : An MCP server that connects MCP clients to third-party APIs, offering MCP features while delegating operations and acting as a single OAuth client to the third-party API server. Third-Party Authorization Server : Authorization server that protects the third-party API. It may lack dynamic client registration support, requiring the MCP proxy to use a static client ID for all requests. Third-Party API : The protected resource server that provides the actual API functionality. Access to this API requires tokens issued by the third-party authorization server. Static Client ID : A fixed OAuth 2.0 client identifier used by the MCP proxy server when communicating with the third-party authorization server. This Client ID refers to the MCP server acting as a client to the Third-Party API. It is the same value for all MCP server to Third-Party API interactions regardless of which MCP client initiated the request.

Vulnerable Conditions

This attack becomes possible when all of the following conditions are present:
  • MCP proxy server uses a static client ID with a third-party authorization server
  • MCP proxy server allows MCP clients to dynamically register (each getting their own client_id)
  • The third-party authorization server sets a consent cookie after the first authorization
  • MCP proxy server does not implement proper per-client consent before forwarding to third-party authorization

Architecture and Attack Flows

Normal OAuth proxy usage (preserves user consent)
Malicious OAuth proxy usage (skips user consent)

Attack Description

When an MCP proxy server uses a static client ID to authenticate with a third-party authorization server, the following attack becomes possible:
  1. A user authenticates normally through the MCP proxy server to access the third-party API
  2. During this flow, the third-party authorization server sets a cookie on the user agent indicating consent for the static client ID
  3. An attacker later sends the user a malicious link containing a crafted authorization request which contains a malicious redirect URI along with a new dynamically registered client ID
  4. When the user clicks the link, their browser still has the consent cookie from the previous legitimate request
  5. The third-party authorization server detects the cookie and skips the consent screen
  6. The MCP authorization code is redirected to the attacker’s server (specified in the malicious redirect_uri parameter during dynamic client registration)
  7. The attacker exchanges the stolen authorization code for access tokens for the MCP server without the user’s explicit approval
  8. The attacker now has access to the third-party API as the compromised user

Mitigation

To prevent confused deputy attacks, MCP proxy servers MUST implement per-client consent and proper security controls as detailed below.
Consent Flow Implementation
The following diagram shows how to properly implement per-client consent that runs before the third-party authorization flow:
Required Protections
Per-Client Consent Storage MCP proxy servers MUST:
  • Maintain a registry of approved client_id values per user
  • Check this registry before initiating the third-party authorization flow
  • Store consent decisions securely (server-side database, or server specific cookies)
Consent UI Requirements The MCP-level consent page MUST:
  • Clearly identify the requesting MCP client by name
  • Display the specific third-party API scopes being requested
  • Show the registered redirect_uri where tokens will be sent
  • Implement CSRF protection (e.g., state parameter, CSRF tokens)
  • Prevent iframing via frame-ancestors CSP directive or X-Frame-Options: DENY to prevent clickjacking
Consent Cookie Security If using cookies to track consent decisions, they MUST:
  • Use __Host- prefix for cookie names
  • Set Secure, HttpOnly, and SameSite=Lax attributes
  • Be cryptographically signed or use server-side sessions
  • Bind to the specific client_id (not just “user has consented”)
Redirect URI Validation The MCP proxy server MUST:
  • Validate that the redirect_uri in authorization requests exactly matches the registered URI
  • Reject requests if the redirect_uri has changed without re-registration
  • Use exact string matching (not pattern matching or wildcards)
OAuth State Parameter Validation The OAuth state parameter is critical to prevent authorization code interception and CSRF attacks. Proper state validation ensures that consent approval at the authorization endpoint is enforced at the callback endpoint. MCP proxy servers implementing OAuth flows MUST:
  • Generate a cryptographically secure random state value for each authorization request
  • Store the state value server-side (in a secure session store or encrypted cookie) only after consent has been explicitly approved
  • Set the state tracking cookie/session immediately before redirecting to the third-party identity provider (not before consent approval)
  • Validate at the callback endpoint that the state query parameter exactly matches the stored value in the callback request’s cookies or in the request’s cookie-based session
  • Reject any callback requests where the state parameter is missing or does not match
  • Ensure state values are single-use (delete after validation) and have a short expiration time (e.g., 10 minutes)
The consent cookie or session containing the state value MUST NOT be set until after the user has approved the consent screen at the MCP server’s authorization endpoint. Setting this cookie before consent approval renders the consent screen ineffective, as an attacker could bypass it by crafting a malicious authorization request.

Token Passthrough

“Token passthrough” is an anti-pattern where an MCP server accepts tokens from an MCP client without validating that the tokens were properly issued to the MCP server and passes them through to the downstream API. An attacker can gain unauthorized access or otherwise compromise an MCP server if the server accepts tokens issued for other resources. This vulnerability has two critical dimensions:
  1. Audience validation failures. When an MCP server doesn’t verify that tokens were specifically intended for it (for example, via the audience claim, as mentioned in RFC9068), it may accept tokens originally issued for other services. This breaks a fundamental OAuth security boundary, allowing attackers to reuse legitimate tokens across different services than intended.
  2. Token passthrough. If the MCP server not only accepts tokens with incorrect audiences but also forwards these unmodified tokens to downstream services, it can potentially cause the “confused deputy” problem, where the downstream API may incorrectly trust the token as if it came from the MCP server or assume the token was validated by the upstream API.

Risks

Token passthrough is explicitly forbidden in the authorization specification as it introduces a number of security risks, that include:
  • Security Control Circumvention
    • The MCP Server or downstream APIs might implement important security controls like rate limiting, request validation, or traffic monitoring, that depend on the token audience or other credential constraints. If clients can obtain and use tokens directly with the downstream APIs without the MCP server validating them properly or ensuring that the tokens are issued for the right service, they bypass these controls.
  • Accountability and Audit Trail Issues
    • The MCP Server will be unable to identify or distinguish between MCP Clients when clients are calling with an upstream-issued access token which may be opaque to the MCP Server.
    • The downstream Resource Server’s logs may show requests that appear to come from a different source with a different identity, rather than the MCP server that is actually forwarding the tokens.
    • Both factors make incident investigation, controls, and auditing more difficult.
    • If the MCP Server passes tokens without validating their claims (e.g., roles, privileges, or audience) or other metadata, a malicious actor in possession of a stolen token can use the server as a proxy for data exfiltration.
  • Trust Boundary Issues
    • The downstream Resource Server grants trust to specific entities. This trust might include assumptions about origin or client behavior patterns. Breaking this trust boundary could lead to unexpected issues.
    • If the token is accepted by multiple services without proper validation, an attacker compromising one service can use the token to access other connected services.
  • Future Compatibility Risk
    • Even if an MCP Server starts as a “pure proxy” today, it might need to add security controls later. Starting with proper token audience separation makes it easier to evolve the security model.

Mitigation

MCP servers MUST NOT accept any tokens that were not explicitly issued for the MCP server.

Server-Side Request Forgery (SSRF)

Server-Side Request Forgery (SSRF) is an attack where an attacker can induce an MCP client to make HTTP requests to unintended destinations, potentially accessing internal network resources, cloud metadata endpoints, or other protected services.

Attack Description

During OAuth metadata discovery, MCP clients fetch URLs from several sources that could be controlled by a malicious MCP server:
  1. The resource_metadata URL from the WWW-Authenticate header
  2. The authorization_servers URLs from the Protected Resource Metadata document
  3. The token_endpoint, authorization_endpoint, and other URLs from Authorization Server Metadata
A malicious MCP server can populate these fields with URLs pointing to internal resources, enabling the following attack patterns:
  • Direct internal IP access: URLs like http://192.168.1.1/admin or http://10.0.0.1/api target internal network services
  • Cloud metadata endpoints: URLs targeting http://169.254.169.254/ (AWS/GCP/Azure metadata service) can exfiltrate cloud credentials and instance information
  • Localhost services: URLs like http://localhost:6379/ can interact with local services (Redis, databases, admin panels)
  • DNS rebinding: Domains that change DNS resolution between validation and use (e.g., https://attacker.com resolving to a safe IP initially, then to 192.168.1.1)
  • Redirect chains: Normal-looking URLs that redirect to internal resources

Risks

  • Credential exfiltration: Cloud metadata endpoints often expose IAM credentials, API keys, and other secrets
  • Internal network reconnaissance: Error messages reveal information about internal network topology and services
  • Service interaction: POST requests (e.g., to token endpoints) can trigger mutations on internal services
  • Firewall bypass: The MCP client acts as a proxy, bypassing network perimeter controls
  • Data exfiltration: Internal service responses may be reflected back to attackers through error messages or OAuth flows

Mitigation

MCP clients deployed to a server MUST consider SSRF risks and implement appropriate mitigations when fetching OAuth-related URLs. Which protections are appropriate depend on your network environment. Enforce HTTPS MCP clients SHOULD require HTTPS for all OAuth-related URLs in production environments:
  • Reject http:// URLs except for loopback addresses (localhost, 127.0.0.1, ::1) during development
  • This aligns with OAuth 2.1 Section 1.5 which requires HTTPS for all OAuth protocol URLs except loopback redirect URIs
  • Provide an explicit opt-out mechanism for development/testing scenarios
Block Private IP Ranges MCP clients SHOULD block requests to private and reserved IP address ranges as recommended by RFC 9728 Section 7.7:
  • Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
  • Loopback: 127.0.0.0/8, ::1 (except when explicitly allowed for development)
  • Link-local: 169.254.0.0/16 (including cloud metadata endpoints)
  • Private IPv6 ranges: fc00::/7, fe80::/10
Avoid implementing IP validation manually. Attackers exploit encoding tricks (octal, hex, IPv4-mapped IPv6) that custom parsers often miss.
Validate Redirect Targets MCP clients SHOULD apply the same URL validation to redirect targets:
  • Do not blindly follow redirects to internal resources
  • Apply HTTPS and IP range restrictions to redirect destinations
  • Consider disabling automatic redirect following and validating each hop
Use Egress Proxies For server-side MCP client deployments, operators SHOULD consider using an egress proxy that enforces network policies:
  • Route OAuth discovery requests through a proxy that blocks internal destinations
  • Use tools like Smokescreen or similar egress proxies that prevent SSRF by design
  • Configure network policies to restrict the MCP client’s outbound access
DNS Resolution Considerations Be aware of Time-of-Check to Time-of-Use (TOCTOU) issues with DNS-based validation:
  • An attacker’s domain may resolve to a safe IP during validation but to an internal IP during the actual request
  • Consider pinning DNS resolution results between check and use
  • Defense in depth: combine DNS checks with other mitigations

SSRF Against Authorization Servers

SSRF risks are not limited to MCP clients. When an authorization server supports Client ID Metadata Documents, the authorization server takes a URL as input from an unknown client and fetches that URL. A malicious client could use this to trigger the authorization server to make requests to arbitrary URLs, such as requests to private administration endpoints the authorization server has access to. The mitigations described above, such as blocking private IP ranges and using egress proxies, apply equally to authorization servers fetching client metadata documents. See Server Side Request Forgery (SSRF) Attacks in the Client ID Metadata Document specification for further guidance.

Resources and Tools

The following resources can help developers implement SSRF protections in MCP clients. Reference Documentation

State Handle Hijacking

MCP is stateless and has no protocol-level sessions. Servers that need state spanning multiple requests mint an explicit handle, such as a shopping cart ID or a workflow ID, and receive it back as an ordinary tool argument on each request. State handle hijacking is an attack vector where an unauthorized party obtains or guesses such a handle and uses it to access or modify another user’s state.

Attack Description

  1. The MCP server mints a state handle for an authenticated user and returns it in a tool result.
  2. The attacker obtains or guesses the handle.
  3. The attacker calls the MCP server’s tools with the handle as an argument.
  4. The MCP server does not check whether the handle belongs to the caller and operates on the original user’s state, allowing unauthorized access or actions.

Mitigation

MCP servers that implement authorization MUST verify all inbound requests. MCP servers MUST NOT treat possession of a state handle as authentication. MCP servers SHOULD use secure, non-deterministic handles generated with secure random number generators. Avoid predictable or sequential identifiers that could be guessed by an attacker. Expiring handles can also reduce the risk. MCP servers SHOULD bind handles server-side to the authenticated user, for example by keying stored state as <user_id>:<handle> where the user ID is derived from the verified token rather than supplied by the client, and reject a handle presented by any other principal. This ensures that even if an attacker guesses a handle, they cannot impersonate another user. For guidance on securing the server-assigned session IDs used by protocol version 2025-11-25 and earlier, see Session Hijacking in the 2025-11-25 version of this page.

Local MCP Server Compromise

Local MCP servers are MCP Servers running on a user’s local machine, either by the user downloading and executing a server, authoring a server themselves, or installing through a client’s configuration flows. These servers may have direct access to the user’s system and may be accessible to other processes running on the user’s machine, making them attractive targets for attacks.

Attack Description

Local MCP servers are binaries that are downloaded and executed on the same machine as the MCP client. Without proper sandboxing and consent requirements in place, the following attacks become possible:
  1. An attacker includes a malicious “startup” command in a client configuration
  2. An attacker distributes a malicious payload inside the server itself
  3. An attacker accesses an insecure local server that’s left running on localhost via DNS rebinding
Example malicious startup commands that could be embedded:

Risks

Local MCP servers with inadequate restrictions or from untrusted sources introduce several critical security risks:
  • Arbitrary code execution. Attackers can execute any command with MCP client privileges.
  • No visibility. Users have no insight into what commands are being executed.
  • Command obfuscation. Malicious actors can use complex or convoluted commands to appear legitimate.
  • Data exfiltration. Attackers can access legitimate local MCP servers via compromised JavaScript.
  • Data loss. Attackers or bugs in legitimate servers could lead to irrecoverable data loss on the host machine.

Mitigation

If an MCP client supports one-click local MCP server configuration, it MUST implement proper consent mechanisms prior to executing commands. Pre-Configuration Consent Display a clear consent dialog before connecting a new local MCP server via one-click configuration. The MCP client MUST:
  • Show the exact command that will be executed, without truncation (include arguments and parameters)
  • Clearly identify it as a potentially dangerous operation that executes code on the user’s system
  • Require explicit user approval before proceeding
  • Allow users to cancel the configuration
The MCP client SHOULD implement additional checks and guardrails to mitigate potential code execution attack vectors:
  • Highlight potentially dangerous command patterns (e.g., commands containing sudo, rm -rf, network operations, file system access outside expected directories)
  • Display warnings for commands that access sensitive locations (home directory, SSH keys, system directories)
  • Warn that MCP servers run with the same privileges as the client
  • Execute MCP server commands in a sandboxed environment with minimal default privileges
  • Launch MCP servers with restricted access to the file system, network, and other system resources
  • Provide mechanisms for users to explicitly grant additional privileges (e.g., specific directory access, network access) when needed
  • Use platform-appropriate sandboxing technologies (containers, chroot, application sandboxes, etc.)
  • Keep sandboxing solutions up-to-date to account for emerging vulnerabilities
MCP servers intending for their servers to be run locally SHOULD implement measures to prevent unauthorized usage from malicious processes:
  • Use the stdio transport to limit access to just the MCP client
  • Restrict access if using an HTTP transport, such as:
    • Require an authorization token
    • Use unix domain sockets or other Interprocess Communication (IPC) mechanisms with restricted access

OAuth Authorization URL Validation

OAuth authorization URLs provided by malicious MCP servers can exploit client-side URL handling vulnerabilities, leading to Cross-Site Scripting (XSS) attacks and Remote Code Execution (RCE).

Attack Description

During the OAuth authorization flow, MCP servers provide authorization URLs that clients open in browsers or handle programmatically. Malicious servers can exploit insufficient URL validation in MCP clients through the following attack vectors: JavaScript URL Injection (XSS)
  1. A malicious MCP server provides a javascript: URL as the authorization endpoint
  2. The MCP client passes this URL directly to window.open() or similar browser APIs
  3. The browser executes the JavaScript code embedded in the URL
  4. The attacker gains JavaScript execution context within the client application, potentially leading to session hijacking, credential theft, or further exploitation
Command Injection via Shell Execution
  1. A malicious MCP server provides a URL containing shell command injection payloads
  2. The MCP client uses shell commands (e.g., cmd.exe, PowerShell, or shell scripts) to open the URL
  3. The shell interprets parts of the URL as additional commands to execute
  4. The attacker achieves arbitrary code execution on the user’s system
stdio Transport Privilege Escalation When XSS vulnerabilities are combined with stdio transport capabilities, attackers can escalate web-based attacks to full system compromise. See stdio Transport Security in Proxy Scenarios for detailed attack vectors and mitigations.

Risks

OAuth authorization URL vulnerabilities introduce several critical security risks:
  • Cross-Site Scripting (XSS). Malicious JavaScript execution can lead to session hijacking, credential theft, and unauthorized actions within the client application.
  • Remote Code Execution (RCE). Command injection through shell execution allows attackers to run arbitrary code with user privileges.
  • Privilege Escalation. XSS combined with stdio transport can escalate web-based attacks to full system compromise.
  • Data Exfiltration. Attackers can access sensitive data, configuration files, and credentials stored on the user’s system.
  • Persistence. Attackers can install malware, create backdoors, or modify system configurations for persistent access.

Mitigation

URL Scheme Validation MCP clients MUST validate authorization URLs and reject dangerous schemes:
  • MUST only allow http:// and https:// schemes for authorization URLs. The http:// scheme is acceptable only for loopback addresses (such as localhost, 127.0.0.1, or ::1) during local development; authorization servers in production MUST use https://.
  • MUST reject javascript:, data:, file:, vbscript:, and other potentially dangerous schemes
  • SHOULD use allowlist-based validation rather than blocklist-based approaches
Secure URL Opening MCP clients MUST avoid shell execution when opening URLs:
  • MUST NOT use shell commands (e.g., cmd.exe, sh, PowerShell) to open URLs
  • SHOULD use platform-specific, non-shell URL opening mechanisms
Content Security Policy (CSP) Web-based MCP clients SHOULD implement Content Security Policy headers to prevent JavaScript execution:
  • Set script-src 'self' to prevent execution of inline JavaScript
  • Use default-src 'self' to restrict resource loading
  • Consider script-src 'nonce-<random>' for dynamic content that requires inline scripts
Input Sanitization MCP clients MUST sanitize and validate all URLs received from MCP servers:
  • Implement strict URL parsing and validation
  • Reject URLs with special characters that could be interpreted by shells
  • Consider using dedicated URL sanitization libraries
  • Log suspicious authorization URLs for security monitoring

stdio Transport Security in Proxy Scenarios

The stdio transport itself is not inherently vulnerable. However, in proxy architectures where a separate proxy service manages stdio connections and can spawn MCP servers as child processes, it can provide a critical escalation path from web-based attacks to full system compromise.

Attack Description

Important: This attack vector only applies to MCP implementations that use a proxy architecture, not to direct stdio transport usage. In proxy-based MCP implementations, a local proxy service sits between the client and MCP servers, spawning servers as child processes via the stdio transport. This architecture creates a privileged escalation path when combined with client-side vulnerabilities:
  1. Attacker achieves XSS or other client-side code execution (e.g., through OAuth URL vulnerabilities)
  2. Using the attack vector above, the malicious actor accesses the MCP proxy authentication token established between the client and the proxy from the client’s environment
  3. Malicious actor makes authenticated requests to the local MCP proxy service
  4. Proxy spawns arbitrary commands via the stdio transport (believing they are legitimate MCP server commands)
  5. Attacker achieves Remote Code Execution with user privileges

Risks

  • Privilege Escalation. Web-based vulnerabilities (XSS) can escalate to arbitrary code execution on the host system through proxy command execution
  • Authentication Bypass. Stolen proxy authentication tokens allow unauthorized access to stdio process spawning capabilities
  • System Compromise. Attackers can execute any command that the MCP proxy process has privileges to run

Mitigation

The primary defense is to prevent classes of vulnerabilities that enable this attack vector:
  • Implement the mitigations described in OAuth Authorization URL Validation
  • Use Content Security Policy (CSP) to prevent JavaScript execution from untrusted sources
  • Validate and sanitize all input from MCP servers before processing
Since XSS fundamentally compromises the client’s security context, focus on limiting the damage: stdio Transport Restrictions MCP proxy services SHOULD implement additional security controls for stdio transport:
  • Implement sandboxing or containerization for spawned processes
  • Restrict file system access for spawned MCP servers
  • Log all stdio transport usage for security monitoring
  • Require additional authorization for potentially dangerous commands
Client-Side Protections MCP clients SHOULD implement defense-in-depth measures:
  • Isolate proxy communication in a separate security context when possible
  • Use principle of least privilege for proxy process permissions
  • Implement process-level sandboxing for the proxy service itself
  • Consider running the proxy in a container or restricted environment

Mix-Up Attacks

Attack Description

An MCP client typically interacts with many authorization servers over its lifetime. An attacker that controls one of those authorization servers may attempt to have the client send it an authorization code or token issued by a different, honest authorization server (a mix-up attack, described in RFC9207 Section 1).

Mitigation

Authorization Response Validation mitigates this by binding the response to the authorization server the client recorded before redirecting, so the authorization code cannot be redeemed at an unintended token endpoint. PKCE alone does not prevent this attack because the client transmits the code_verifier to the attacker’s token endpoint. Resource indicators do not help when the attacker’s authorization server is intercepting requests before they hit the honest authorization server. This mitigation depends on honest authorization servers emitting iss; it provides no protection against an honest server that does not.

Localhost Redirect URI Impersonation

Native and locally-running MCP clients commonly use localhost redirect URIs. When clients identify themselves with Client ID Metadata Documents, the metadata document proves control of a domain, but it cannot prove which local process is listening on a localhost redirect URI.

Attack Description

An attacker can claim to be any client by:
  1. Providing the legitimate client’s metadata URL as their client_id
  2. Binding to any localhost port, and providing that address as the redirect_uri
  3. Receiving the authorization code via the redirect when the user approves
The server will see the legitimate client’s metadata document and the user will see the legitimate client’s name, making attack detection difficult.

Mitigation

See Localhost Redirect URI Risks in the authorization specification for the countermeasures expected of authorization servers, including displaying additional warnings for localhost-only redirect URIs and clearly displaying the redirect URI hostname during authorization.

CIMD Trust Policies

Authorization servers that accept Client ID Metadata Documents can apply domain-based trust policies to decide which URL-based client IDs to accept:
  • Allowlists for trusted domains (for protected servers)
  • Accept any HTTPS client_id (for open servers)
  • Reputation checks for unknown domains
  • Restrictions based on domain age or certificate validation
  • Display the CIMD and other associated client hostnames prominently to prevent phishing
Servers maintain full control over their access policies. See Trust Policies in the authorization specification, along with Section 6.4 and Section 6.8 of the Client ID Metadata Document specification, for more details.

Scope Minimization

Poor scope design increases token compromise impact, elevates user friction, and obscures audit trails.

Attack Description

An attacker obtains (via log leakage, memory scraping, or local interception) an access token carrying broad scopes (files:*, db:*, admin:*) that were granted up front because the MCP server exposed every scope in scopes_supported and the client requested them all. The token enables lateral data access, privilege chaining, and difficult revocation without re-consenting the entire surface.

Risks

  • Expanded blast radius: stolen broad token enables unrelated tool/resource access
  • Higher friction on revocation: revoking a max-privilege token disrupts all workflows
  • Audit noise: single omnibus scope masks user intent per operation
  • Privilege chaining: attacker can immediately invoke high-risk tools without further elevation prompts
  • Consent abandonment: users decline dialogs listing excessive scopes
  • Scope inflation blindness: lack of metrics makes over-broad requests normalised

Mitigation

Implement a progressive, least-privilege scope model:
  • Minimal initial scope set (e.g., mcp:tools-basic) containing only low-risk discovery/read operations
  • Incremental elevation via targeted WWW-Authenticate scope="..." challenges when privileged operations are first attempted
  • Down-scoping tolerance: server should accept reduced scope tokens; auth server MAY issue a subset of requested scopes
Server guidance:
  • Emit precise scope challenges; avoid returning the full catalog
  • Log elevation events (scope requested, granted subset) with correlation IDs
Servers have flexibility in determining which scopes to include:
  • Minimum approach: Include only the scopes required for the specific operation that triggered the error.
  • Recommended approach: Include the scopes required for the current operation along with related scopes that commonly work together, to reduce the number of step-up authorization rounds.
  • Extended approach: Include the scopes required for the current operation, related scopes, and any other scopes the server anticipates the client may need in the near future.
The choice depends on the server’s assessment of user experience impact and authorization friction. Client guidance:
  • Begin with only baseline scopes (or those specified by initial WWW-Authenticate)
  • Cache recent failures to avoid repeated elevation loops for denied scopes
When the initial WWW-Authenticate challenge carries no scope parameter, the Scope Selection Strategy directs clients to fall back to requesting all scopes listed in scopes_supported. This approach accommodates the general-purpose nature of MCP clients, which typically lack domain-specific knowledge to make informed decisions about individual scope selection. Requesting all available scopes allows the authorization server and end-user to determine appropriate permissions during the consent process, minimizing user friction while following the principle of least privilege.
Scope accumulation across operations is a client-side responsibility. Clients SHOULD compute the union of previously requested scopes and newly challenged scopes when initiating re-authorization, as described in Step-Up Authorization Flow. This allows servers to remain stateless with respect to client scope sets while ensuring clients do not lose previously granted permissions.
Hierarchical scopes: Some authorization servers define scope hierarchies where a broader scope implies narrower ones (for example, an admin scope that subsumes read). When accumulating scopes, the client’s union may contain semantically redundant entries. For example, a token previously granted a broad scope may be challenged with a narrower one it already implies. Clients need not deduplicate hierarchically; authorization servers typically normalize such redundancy during token issuance. Servers, for their part, must account for hierarchy when deciding whether a token is sufficient for an operation, but this does not affect the scopes they emit in a challenge.

Common Mistakes

  • Publishing all possible scopes in scopes_supported
  • Using wildcard or omnibus scopes (*, all, full-access)
  • Bundling unrelated privileges to preempt future prompts
  • Returning entire scope catalog in every challenge
  • Silent scope semantic changes without versioning
  • Treating claimed scopes in token as sufficient without server-side authorization logic
Proper minimization constrains compromise impact, improves audit clarity, and reduces consent churn.