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
+57-6Lines changed: 57 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,19 +178,65 @@ sequenceDiagram
178
178
A->>C: Client Credentials
179
179
end
180
180
181
-
Note over C: Generate PKCE parameters
182
-
C->>B: Open browser with authorization URL + code_challenge
183
-
B->>A: Authorization request
181
+
Note over C: Generate PKCE parameters<br/>Include resource parameter
182
+
C->>B: Open browser with authorization URL + code_challenge + resource
183
+
B->>A: Authorization request with resource parameter
184
184
Note over A: User authorizes
185
185
A->>B: Redirect to callback with authorization code
186
186
B->>C: Authorization code callback
187
-
C->>A: Token request + code_verifier
187
+
C->>A: Token request + code_verifier + resource
188
188
A->>C: Access token (+ refresh token)
189
189
C->>M: MCP request with access token
190
190
M-->>C: MCP response
191
191
Note over C,M: MCP communication continues with valid token
192
192
```
193
193
194
+
#### Resource Parameter Implementation
195
+
196
+
MCP clients **MUST** implement Resource Indicators for OAuth 2.0 as defined in [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html)
197
+
to explicitly specify the target resource for which the token is being requested. The `resource` parameter:
198
+
199
+
1.**MUST** be included in both authorization requests and token requests.
200
+
2.**MUST** identify the MCP server that the client intends to use the token with.
201
+
3.**MUST** use the canonical URI of the MCP server as defined in [RFC 8707 Section 2](https://www.rfc-editor.org/rfc/rfc8707.html#name-access-token-request).
202
+
203
+
##### Canonical Server URI
204
+
205
+
For the purposes of this specification, the canonical URI of an MCP server is defined as the resource identifier as specified in
206
+
[RFC 8707 Section 2](https://www.rfc-editor.org/rfc/rfc8707.html#section-2) and aligns with the `resource` parameter in
207
+
[RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728). This URI:
208
+
209
+
1.**MUST** be an absolute URI, as specified by [Section 4.3 of RFC 3986](https://www.rfc-editor.org/rfc/rfc3986#section-4.3).
210
+
1.**MUST** include the fully qualified domain name (FQDN) of the server.
211
+
1.**MUST** include any non-default port if applicable (e.g., `https://mcp.example.com:8443`).
212
+
1.**MUST NOT** include a fragment component.
213
+
1.**SHOULD** use lowercase for the scheme and host components as per [RFC 3986 Section 6.2.2.1](https://www.rfc-editor.org/rfc/rfc3986#section-6.2.2.1), which defines this as the canonical form for comparison purposes.
214
+
1.**SHOULD NOT** include a query component unless necessary for MCP server identification.
215
+
1.**SHOULD NOT** include path components beyond what is necessary to uniquely identify the MCP server.
216
+
217
+
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](https://www.rfc-editor.org/rfc/rfc8707). While the canonical form uses lowercase scheme and host components, implementations **SHOULD** accept uppercase scheme and host components for robustness and interoperability.
218
+
219
+
Examples of valid canonical URIs:
220
+
221
+
-`https://mcp.example.com`
222
+
-`https://mcp.example.com:8443`
223
+
-`https://mcp.example.com/server` (when path component is necessary to identify individual MCP server)
> **Note:** While both `https://mcp.example.com/` (with trailing slash) and `https://mcp.example.com` (without trailing slash) are technically valid absolute URIs according to [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986), implementations **SHOULD** consistently use the form without the trailing slash for better interoperability unless the trailing slash is semantically significant for the specific resource.
231
+
232
+
For example, if accessing an MCP server at `https://mcp.example.com`, the authorization request would include:
233
+
234
+
```
235
+
&resource=https%3A%2F%2Fmcp.example.com
236
+
```
237
+
238
+
MCP clients **MUST** send this parameter regardless of whether authorization servers support it.
error handling requirements. Invalid or expired tokens **MUST** receive a HTTP 401
@@ -313,8 +361,11 @@ MCP servers **MUST** validate access tokens before processing the request, ensur
313
361
314
362
A MCP server **MUST** follow the guidelines in [OAuth 2.1 - Section 5.2](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#section-5.2) to validate inbound tokens.
315
363
316
-
MCP servers **MUST** only accept tokens specifically intended for themselves.
364
+
MCP servers **MUST** only accept tokens specifically intended for themselves and **MUST** reject tokens that do not include them in the audience claim or otherwise verify that they are the intended recipient of the token. See [Security Best Practices Section 2.2](/specification/draft/basic/security_best_practices#token-passthrough) for details.
317
365
318
366
If the MCP server makes requests to upstream APIs, it may act as an OAuth client to them. The access token used at the upstream API is a seperate token, issued by the upstream authorization server. The MCP server **MUST NOT** pass through the token it received from the MCP client.
319
367
320
-
If the authorization server supports the `resource` parameter, it is recommended that implementers follow [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html) to prevent token misuse.
368
+
MCP clients **MUST** implement and use the `resource` parameter as defined in [RFC 8707 - Resource Indicators for OAuth 2.0](https://www.rfc-editor.org/rfc/rfc8707.html)
369
+
to explicitly specify the target resource for which the token is being requested. This requirement aligns with the recommendation in
370
+
[RFC 9728 Section 7.4](https://datatracker.ietf.org/doc/html/rfc9728#section-7.4). This ensures that access tokens are bound to their intended resources and
0 commit comments