@@ -4,15 +4,15 @@ title: Authorization
44
55<Info >** Protocol Revision** : 2025-03-26</Info >
66
7- ## 1. Introduction
7+ ## Introduction
88
9- ### 1.1 Purpose and Scope
9+ ### Purpose and Scope
1010
1111The Model Context Protocol provides authorization capabilities at the transport level,
1212enabling MCP clients to make requests to restricted MCP servers on behalf of resource
1313owners. This specification defines the authorization flow for HTTP-based transports.
1414
15- ### 1.2 Protocol Requirements
15+ ### Protocol Requirements
1616
1717Authorization is ** OPTIONAL** for MCP implementations. When supported:
1818
@@ -22,7 +22,7 @@ Authorization is **OPTIONAL** for MCP implementations. When supported:
2222- Implementations using alternative transports ** MUST** follow established security best
2323 practices for their protocol.
2424
25- ### 1.3 Standards Compliance
25+ ### Standards Compliance
2626
2727This authorization mechanism is based on established specifications listed below, but
2828implements a selected subset of their features to ensure security and interoperability
@@ -34,9 +34,9 @@ while maintaining simplicity:
3434- OAuth 2.0 Dynamic Client Registration Protocol
3535 ([ RFC7591] ( https://datatracker.ietf.org/doc/html/rfc7591 ) )
3636
37- ## 2. Authorization Flow
37+ ## Authorization Flow
3838
39- ### 2.1 Overview
39+ ### Overview
4040
41411 . MCP auth implementations ** MUST** implement OAuth 2.1 with appropriate security
4242 measures for both confidential and public clients.
@@ -49,7 +49,7 @@ while maintaining simplicity:
4949 that do not support Authorization Server Metadata ** MUST** follow the default URI
5050 schema.
5151
52- ### 2.1.1 OAuth Grant Types
52+ ### OAuth Grant Types
5353
5454OAuth specifies different flows or grant types, which are different ways of obtaining an
5555access token. Each of these targets different use cases and scenarios.
@@ -63,7 +63,7 @@ audience. For instance:
6363 - For instance, an agent calls a secure MCP tool to check inventory at a specific
6464 store. No need to impersonate the end user.
6565
66- ### 2.2 Example: authorization code grant
66+ ### Example: authorization code grant
6767
6868This demonstrates the OAuth 2.1 flow for the authorization code grant type, used for user
6969auth.
@@ -104,7 +104,7 @@ sequenceDiagram
104104 Note over C,M: Begin standard MCP message exchange
105105```
106106
107- ### 2.3 Server Metadata Discovery
107+ ### Server Metadata Discovery
108108
109109For server capability discovery:
110110
@@ -132,15 +132,15 @@ sequenceDiagram
132132 Note over C: Continue with authorization flow
133133```
134134
135- #### 2.3.1 Server Metadata Discovery Headers
135+ #### Server Metadata Discovery Headers
136136
137137MCP clients _ SHOULD_ include the header ` MCP-Protocol-Version: <protocol-version> ` during
138138Server Metadata Discovery to allow the MCP server to respond based on the MCP protocol
139139version.
140140
141141For example: ` MCP-Protocol-Version: 2024-11-05 `
142142
143- #### 2.3.2 Authorization Base URL
143+ #### Authorization Base URL
144144
145145The authorization base URL ** MUST** be determined from the MCP server URL by discarding
146146any existing ` path ` component. For example:
@@ -154,11 +154,11 @@ If the MCP server URL is `https://api.example.com/v1/mcp`, then:
154154This ensures authorization endpoints are consistently located at the root level of the
155155domain hosting the MCP server, regardless of any path components in the MCP server URL.
156156
157- #### 2.3.3 Fallbacks for Servers without Metadata Discovery
157+ #### Fallbacks for Servers without Metadata Discovery
158158
159159For servers that do not implement OAuth 2.0 Authorization Server Metadata, clients
160- ** MUST** use the following default endpoint paths relative to the authorization base URL
161- (as defined in [ Section 2.3.2 ] ( #232- authorization-base-url ) ):
160+ ** MUST** use the following default endpoint paths relative to the [ authorization base
161+ URL ] ( #authorization-base-url ) :
162162
163163| Endpoint | Default Path | Description |
164164| ---------------------- | ------------ | ------------------------------------ |
@@ -177,7 +177,7 @@ Clients **MUST** first attempt to discover endpoints via the metadata document b
177177falling back to default paths. When using default paths, all other protocol requirements
178178remain unchanged.
179179
180- ### 2.4 Dynamic Client Registration
180+ ### Dynamic Client Registration
181181
182182MCP clients and servers ** SHOULD** support the
183183[ OAuth 2.0 Dynamic Client Registration Protocol] ( https://datatracker.ietf.org/doc/html/rfc7591 )
@@ -200,7 +200,7 @@ these servers, MCP clients will have to either:
200200 OAuth client themselves (e.g., through a configuration interface hosted by the
201201 server).
202202
203- ### 2.5 Authorization Flow Steps
203+ ### Authorization Flow Steps
204204
205205The complete Authorization flow proceeds as follows:
206206
@@ -233,7 +233,7 @@ sequenceDiagram
233233 C->>M: API Requests with Access Token
234234```
235235
236- #### 2.5.1 Decision Flow Overview
236+ #### Decision Flow Overview
237237
238238``` mermaid
239239flowchart TD
@@ -257,9 +257,9 @@ flowchart TD
257257 N --> O[Use Access Token]
258258```
259259
260- ### 2.6 Access Token Usage
260+ ### Access Token Usage
261261
262- #### 2.6.1 Token Requirements
262+ #### Token Requirements
263263
264264Access token handling ** MUST** conform to
265265[ OAuth 2.1 Section 5] ( https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-5 )
@@ -285,7 +285,7 @@ Host: mcp.example.com
285285Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
286286```
287287
288- #### 2.6.2 Token Handling
288+ #### Token Handling
289289
290290Resource servers ** MUST** validate access tokens as described in
291291[ Section 5.2] ( https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-5.2 ) .
@@ -294,7 +294,7 @@ If validation fails, servers **MUST** respond according to
294294error handling requirements. Invalid or expired tokens ** MUST** receive a HTTP 401
295295response.
296296
297- ### 2.7 Security Considerations
297+ ### Security Considerations
298298
299299The following security requirements ** MUST** be implemented:
300300
@@ -304,7 +304,7 @@ The following security requirements **MUST** be implemented:
3043044 . Servers ** MUST** validate redirect URIs to prevent open redirect vulnerabilities
3053055 . Redirect URIs ** MUST** be either localhost URLs or HTTPS URLs
306306
307- ### 2.8 Error Handling
307+ ### Error Handling
308308
309309Servers ** MUST** return appropriate HTTP status codes for authorization errors:
310310
@@ -314,22 +314,22 @@ Servers **MUST** return appropriate HTTP status codes for authorization errors:
314314| 403 | Forbidden | Invalid scopes or insufficient permissions |
315315| 400 | Bad Request | Malformed authorization request |
316316
317- ### 2.9 Implementation Requirements
317+ ### Implementation Requirements
318318
3193191 . Implementations ** MUST** follow OAuth 2.1 security best practices
3203202 . PKCE is ** REQUIRED** for all clients
3213213 . Token rotation ** SHOULD** be implemented for enhanced security
3223224 . Token lifetimes ** SHOULD** be limited based on security requirements
323323
324- ### 2.10 Third-Party Authorization Flow
324+ ### Third-Party Authorization Flow
325325
326- #### 2.10.1 Overview
326+ #### Overview
327327
328328MCP servers ** MAY** support delegated authorization through third-party authorization
329329servers. In this flow, the MCP server acts as both an OAuth client (to the third-party
330330auth server) and an OAuth authorization server (to the MCP client).
331331
332- #### 2.10.2 Flow Description
332+ #### Flow Description
333333
334334The third-party authorization flow comprises these steps:
335335
@@ -363,7 +363,7 @@ sequenceDiagram
363363 M->>C: MCP access token
364364```
365365
366- #### 2.10.3 Session Binding Requirements
366+ #### Session Binding Requirements
367367
368368MCP servers implementing third-party authorization ** MUST** :
369369
@@ -372,7 +372,7 @@ MCP servers implementing third-party authorization **MUST**:
3723723 . Implement appropriate token lifecycle management
3733734 . Handle third-party token expiration and renewal
374374
375- #### 2.10.4 Security Considerations
375+ #### Security Considerations
376376
377377When implementing third-party authorization, servers ** MUST** :
378378
@@ -382,9 +382,9 @@ When implementing third-party authorization, servers **MUST**:
3823824 . Consider security implications of token chaining
3833835 . Implement proper error handling for third-party auth failures
384384
385- ## 3. Best Practices
385+ ## Best Practices
386386
387- #### 3.1 Local clients as Public OAuth 2.1 Clients
387+ #### Local clients as Public OAuth 2.1 Clients
388388
389389We strongly recommend that local clients implement OAuth 2.1 as a public client:
390390
@@ -394,13 +394,13 @@ We strongly recommend that local clients implement OAuth 2.1 as a public client:
3943943 . Following token refresh best practices to maintain sessions
3953954 . Properly handling token expiration and renewal
396396
397- #### 3.2 Authorization Metadata Discovery
397+ #### Authorization Metadata Discovery
398398
399399We strongly recommend that all clients implement metadata discovery. This reduces the
400400need for users to provide endpoints manually or clients to fallback to the defined
401401defaults.
402402
403- #### 3.3 Dynamic Client Registration
403+ #### Dynamic Client Registration
404404
405405Since clients do not know the set of MCP servers in advance, we strongly recommend the
406406implementation of dynamic client registration. This allows applications to automatically
0 commit comments