-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SEP-835: Update authorization spec with default scopes definition #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@localden thoughts on adding this to your Scope Minimization section of the spec? MCP clients that use refresh tokens SHOULD request only the scopes required for their current context. Authorization Servers are responsible for evaluating requested scopes against prior consent and MAY issue access tokens with narrower scopes, as permitted by RFC 6749 §1.5. This enables secure, progressive access aligned with the principle of least privilege. I think the current section does a great job laying out the principle of least privilege and the risks of over-privileged tokens. This addition though would help clarify how clients can explicitly "downscope" during refresh flows — something especially relevant for use cases where scope needs evolve over time. It also stays consistent with OAuth semantics without trying to redefine anything in the core spec. Lmk what you think. |
|
@localden lets fix conflicts and then merge. |
Co-authored-by: ChipGPT <chip@ignission.io>
|
@dsp-ant @pcarleton conflict merged. Can either of you please press the button, since I can't ovveride the merge policy? |
|
Sorry if this is dense, but do the major clients (OpenAI ChatGPT Apps for example) handle this yet? |
|
VS Code does. |
SEP-835: Update authorization spec with default scopes definition
Preamble
Abstract
This SEP proposes enhancements to the MCP OAuth 2.1-based authorization specification to improve scope management, client experience, and support for different client types. The changes include: (1) structured scope selection strategies following the principle of least privilege, (2) comprehensive scope error handling with upgrade flows, (3) differentiated behavior for client credentials vs. interactive clients, and (4) improved consistency in error responses.
Motivation
The current authorization specification lacks detailed guidance for:
These gaps lead to over-privileged token requests, poor user experience, and implementation inconsistencies across MCP clients and servers.
Specification
The specification changes include:
4.1 Scope Selection Strategy
WWW-Authenticatescope parameter first, fallback toscopes_supportedin PRM4.2 Enhanced Error Handling
insufficient_scoperesponses with resource_metadata4.3 Security Enhancements
Rationale
Scope Selection: The priority-based approach balances security (least privilege) with usability. The
WWW-Authenticatescope parameter provides immediate, contextual guidance while scopes_supported offers fallback coverage.Client Type Differentiation: Client credentials clients lack interactive authorization capabilities, making automatic scope upgrade less practical. The MAY vs SHOULD distinction reflects this reality while still allowing implementation flexibility.
Error Response Consistency: Including resource_metadata in 403 responses matches 401 behavior, simplifying client implementations by making error responses self-contained.
Removed Restrictive Logic: Original draft prevented reauthorization in scenarios where it might succeed (timed access, conditional policies). The retry limits provide sufficient protection against infinite loops without being overly restrictive.
Backward Compatibility
This SEP is backward compatible. All changes are additive or clarifications:
Reference Implementation
Security Implications
Positive impacts:
Considerations:
Community Impact
This SEP qualifies as a Standards Track SEP because it proposes significant enhancements to the MCP authorization protocol that will affect multiple implementations and improve ecosystem
Proposed flow
sequenceDiagram participant C as Client participant M as MCP Server (Resource Server) participant A as Authorization Server participant B as User-Agent (Browser) Note over C,M: Initial successful authorization with limited scopes C->>M: MCP request with access token (limited scopes) M-->>C: HTTP 200 OK (operation succeeds) Note over C,M: Later request requires additional scopes C->>M: MCP request requiring additional scope M-->>C: HTTP 403 Forbidden with WWW-Authenticate header Note over C: Parse insufficient_scope error<br/>Extract required scopes and resource_metadata alt Interactive Client (authorization_code) Note over C: Client acting on behalf of user<br/>SHOULD attempt scope upgrade C->>M: GET resource metadata (if needed) M-->>C: Protected Resource Metadata C->>A: GET Authorization server metadata A-->>C: Authorization server metadata Note over C: Calculate union of current + required scopes<br/>Apply scope selection strategy C->>B: Open browser with authorization URL (broader scopes) B->>A: Authorization request with expanded scopes Note over A: User authorizes expanded permissions A->>B: Redirect with authorization code B->>C: Authorization code callback C->>A: Token request + code_verifier + resource A->>C: New access token (expanded scopes) C->>M: Retry original request with new token M-->>C: HTTP 200 OK (operation succeeds) else Client Credentials Client Note over C: Client acting on own behalf<br/>MAY attempt upgrade or abort alt Attempt Upgrade C->>A: Token request (client_credentials + expanded scopes) A->>C: New access token (if authorized) C->>M: Retry original request with new token M-->>C: HTTP 200 OK or still 403 if unauthorized else Abort Request Note over C: Client chooses not to upgrade<br/>Reports error to application end end Note over C: Retry limits and caching prevent infinite loopsThis change formalizes some of the authorizaiton spec requirements based on items such as:
invalidateCredentials()toOAuthClientProvidertypescript-sdk#570