You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specification/draft/basic/authorization.mdx
+108-2Lines changed: 108 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,33 @@ MCP servers **MUST** implement one of the following discovery mechanisms to prov
98
98
- At the path of the server's MCP endpoint: `https://example.com/public/mcp` could host metadata at `https://example.com/.well-known/oauth-protected-resource/public/mcp`
99
99
- At the root: `https://example.com/.well-known/oauth-protected-resource`
100
100
101
-
MCP clients **MUST** support both discovery mechanisms and use the resource metadata URL from the parsed WWW-Authenticate headers when present; otherwise, they **MUST** fall back to constructing and requesting the well-known URIs in the order listed above.
101
+
MCP clients **MUST** support both discovery mechanisms and use the resource metadata URL from the parsed `WWW-Authenticate` headers when present; otherwise, they **MUST** fall back to constructing and requesting the well-known URIs in the order listed above.
102
+
103
+
MCP servers **SHOULD** include a `scope` parameter in the `WWW-Authenticate` header as defined in
MCP clients **MUST** be able to parse `WWW-Authenticate` headers and respond appropriately to `HTTP 401 Unauthorized` responses from the MCP server.
126
+
127
+
If the `scope` parameter is absent, clients **SHOULD** apply the fallback behavior defined in the [Scope Selection Strategy](#scope-selection-strategy) section.
102
128
103
129
#### Authorization Server Metadata Discovery
104
130
@@ -190,6 +216,23 @@ these authorization servers, MCP clients will have to either:
190
216
OAuth client themselves (e.g., through a configuration interface hosted by the
191
217
server).
192
218
219
+
#### Scope Selection Strategy
220
+
221
+
When implementing authorization flows, MCP clients **SHOULD** follow the principle of least privilege by requesting
222
+
only the scopes necessary for their intended operations. During the initial authorization handshake, MCP clients
223
+
**SHOULD** follow this priority order for scope selection:
224
+
225
+
1.**Use `scope` parameter** from the initial `WWW-Authenticate` header in the 401 response, if provided
226
+
2.**If `scope` is not available**, use all scopes defined in `scopes_supported` from the Protected Resource Metadata document, omitting the `scope` parameter if `scopes_supported` is undefined.
227
+
228
+
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.
229
+
230
+
This approach minimizes user friction while following the principle of least privilege.
231
+
The `scopes_supported` field is intended to represent the minimal set of scopes necessary
232
+
for basic functionality (see [Scope Minimization](/specification/draft/basic/security_best_practices#scope-minimization)),
233
+
with additional scopes requested incrementally through the step-up authorization flow steps
234
+
described in the [Scope Challenge Handling](#scope-challenge-handling) section.
235
+
193
236
### Authorization Flow Steps
194
237
195
238
The complete Authorization flow proceeds as follows:
@@ -219,7 +262,7 @@ sequenceDiagram
219
262
A->>C: Client Credentials
220
263
end
221
264
222
-
Note over C: Generate PKCE parameters<br/>Include resource parameter
| 400 | Bad Request | Malformed authorization request |
329
372
373
+
#### Scope Challenge Handling
374
+
375
+
This section covers handling insufficient scope errors during runtime operations when
376
+
a client already has a token but needs additional permissions. This follows the error
377
+
handling patterns defined in [OAuth 2.1 Section 5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13#section-5)
378
+
and leverages the metadata fields from [RFC 9728 (OAuth 2.0 Protected Resource Metadata)](https://datatracker.ietf.org/doc/html/rfc9728).
379
+
380
+
##### Runtime Insufficient Scope Errors
381
+
382
+
When a client makes a request with an access token with insufficient
383
+
scope during runtime operations, the server **SHOULD** respond with:
384
+
385
+
-`HTTP 403 Forbidden` status code (per [RFC 6750 Section 3.1](https://datatracker.ietf.org/doc/html/rfc6750#section-3.1))
386
+
-`WWW-Authenticate` header with the `Bearer` scheme and additional parameters:
387
+
-`error="insufficient_scope"` - indicating the specific type of authorization failure
388
+
-`scope="required_scope1 required_scope2"` - specifying the minimum scopes needed for the operation
389
+
-`resource_metadata` - the URI of the Protected Resource Metadata document (for consistency with 401 responses)
390
+
-`error_description` (optional) - human-readable description of the error
391
+
392
+
**Server Scope Management**: When responding with insufficient scope errors, servers
393
+
**SHOULD** include the scopes needed to satisfy the current request in the `scope`
394
+
parameter.
395
+
396
+
Servers have flexibility in determining which scopes to include:
397
+
398
+
-**Minimum approach**: Include the newly-required scopes for the specific operation. Include any existing granted scopes as well, if they are required, to prevent clients from losing previously granted permissions.
399
+
-**Recommended approach**: Include both existing relevant scopes and newly required scopes to prevent clients from losing previously granted permissions
400
+
-**Extended approach**: Include existing scopes, newly required scopes, and related scopes that commonly work together
401
+
402
+
The choice depends on the server's assessment of user experience impact and authorization friction.
403
+
404
+
Servers **SHOULD** be consistent in their scope inclusion strategy to provide predictable behavior for clients.
405
+
406
+
Servers **SHOULD** consider the user experience impact when determining which scopes to include in the
407
+
response, as misconfigured scopes may require frequent user interaction.
Clients will receive scope-related errors during initial authorization or at runtime (`insufficient_scope`).
422
+
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.
423
+
Clients acting on behalf of a user **SHOULD** attempt the step-up authorization flow. Clients acting on their own behalf (`client_credentials` clients)
424
+
**MAY** attempt the step-up authorization flow or abort the request immediately.
425
+
426
+
The flow is as follows:
427
+
428
+
1.**Parse error information** from the authorization server response or `WWW-Authenticate` header
429
+
2.**Determine required scopes** as outlined in [Scope Selection Strategy](#scope-selection-strategy).
430
+
3.**Initiate (re-)authorization** with the determined scope set
431
+
4.**Retry the original request** with the new authorization no more than a few times and treat this as a permanent authorization failure
432
+
433
+
Clients **SHOULD** implement retry limits and **SHOULD** track scope upgrade attempts to avoid
434
+
repeated failures for the same resource and operation combination.
435
+
330
436
## Security Considerations
331
437
332
438
Implementations **MUST** follow OAuth 2.1 security best practices as laid out in [OAuth 2.1 Section 7. "Security Considerations"](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13#name-security-considerations).
Copy file name to clipboardExpand all lines: docs/specification/draft/basic/security_best_practices.mdx
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -289,3 +289,49 @@ MCP servers intending for their servers to be run locally **SHOULD** implement m
289
289
- Restrict access if using an HTTP transport, such as:
290
290
- Require an authorization token
291
291
- Use unix domain sockets or other Interprocess Communication (IPC) mechanisms with restricted access
292
+
293
+
### Scope Minimization
294
+
295
+
Poor scope design increases token compromise impact, elevates user friction, and obscures audit trails.
296
+
297
+
#### Attack Description
298
+
299
+
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.
Copy file name to clipboardExpand all lines: docs/specification/draft/changelog.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,12 @@ the previous revision, [2025-06-18](/specification/2025-06-18).
11
11
12
12
1. Enhance authorization server discovery with support for [OpenID Connect Discovery 1.0](https://openid.net/specs/openid-connect-discovery-1_0.html). (PR [#797](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/797))
13
13
2. Allow servers to expose icons as additional metadata for tools, resources, resource templates, and prompts ([SEP-973](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/973)).
14
+
3. Enhance authorization flows with incremental scope consent via `WWW-Authenticate` ([SEP-835](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/835))
14
15
15
16
## Minor changes
16
17
17
18
1. Clarify that servers must respond with HTTP 403 Forbidden for invalid Origin headers in Streamable HTTP transport. (PR [#1439](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1439))
19
+
2. Updated the [Security Best Practices guidance](https://modelcontextprotocol.io/specification/draft/basic/security_best_practices).
0 commit comments