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
Server Metadata ([RFC8414](https://datatracker.ietf.org/doc/html/rfc8414)).
53
+
MCP clients **MUST** use the OAuth 2.0 Authorization Server Metadata.
53
54
54
55
### 2.1.1 OAuth Grant Types
55
56
@@ -72,7 +73,8 @@ capable of accepting and responding to protected resource requests using access
72
73
An MCP client acts as an [OAuth 2.1 client](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#name-roles),
73
74
making protected resource requests on behalf of a resource owner.
74
75
75
-
The authorization server is responsible for interacting with the user and issuing access tokens for use at the MCP server. The implementation details of the authorization server are beyond the scope of this specification. It may be the same server as the
76
+
The authorization server is responsible for interacting with the user (if necessary) and issuing access tokens for use at the MCP server.
77
+
The implementation details of the authorization server are beyond the scope of this specification. It may be hosted with the
76
78
resource server or a separate entity. Section [2.3 Authorization Server Discovery](#2-3-authorizaton-server-discovery)
77
79
specifies how an MCP server indicates the location of its corresponding authorization server to a client.
78
80
@@ -83,7 +85,7 @@ clients can determine authorization server endpoints and supported capabilities.
MCP servers **MUST** use the HTTP header `WWW-Authenticate` when returning a _401 Unauthorized_ to indicate the location of the resource server metadata URL
98
-
as described in OAuth 2.0 Protected Resource Metadata ([RFC9728](https://datatracker.ietf.org/doc/html/rfc9728)).
100
+
as described in [RFC9728 Section 5.1 "WWW-Authenticate Response"](https://datatracker.ietf.org/doc/html/rfc9728#name-www-authenticate-response).
99
101
100
102
MCP clients **MUST** be able to parse `WWW-Authenticate` headers and respond appropriately to `HTTP 401 Unauthorized` responses from the MCP server.
101
103
102
104
#### 2.3.2 Server Metadata Discovery
103
105
104
-
MCP clients **MUST** follow the OAuth 2.0 Authorization Server Metadata protocol defined
105
-
in [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414) to obtain the information
106
-
required to interact with the authorization server.
106
+
MCP clients **MUST** follow the OAuth 2.0 Authorization Server Metadata [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414)
107
+
specification to obtain the information required to interact with the authorization server.
107
108
108
109
#### 2.3.4 Sequence Diagram
109
110
The following diagram outlines an example flow:
@@ -147,7 +148,7 @@ For example: `MCP-Protocol-Version: 2024-11-05`
147
148
### 2.5 Dynamic Client Registration
148
149
149
150
MCP clients and authorization servers **SHOULD** support the
error handling requirements. Invalid or expired tokens **MUST** receive a HTTP 401
240
242
response.
241
243
@@ -246,7 +248,6 @@ own resources.
246
248
247
249
MCP servers **MUST NOT** accept or transit any other tokens.
248
250
249
-
250
251
### 2.8 Error Handling
251
252
252
253
Servers **MUST** return appropriate HTTP status codes for authorization errors:
@@ -259,32 +260,38 @@ Servers **MUST** return appropriate HTTP status codes for authorization errors:
259
260
260
261
## 3. Security Considerations
261
262
262
-
Implementations **MUST** follow OAuth 2.1 security best practices as laid out in [Section 7. Security Considerations](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-security-considerations).
263
+
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-12#name-security-considerations).
263
264
264
265
### 3.1 Token Theft
266
+
265
267
Attackers who obtain tokens stored by the client, or tokens cached or logged on the server can access protected resources with
266
268
requests that appear legitimate to resource servers.
267
269
268
-
Clients **MUST** implement secure token storage and follow OAuth best practices,
269
-
as outlined in [OAuth 2.1, section 7.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.1).
270
+
Clients and servers **MUST** implement secure token storage and follow OAuth best practices,
271
+
as outlined in [OAuth 2.1, Section 7.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.1).
270
272
271
-
MCP authorization servers SHOULD issue short-lived access tokens token to reduce the impact of leaked tokens. For public clients, MCP authorization servers MUST rotate refresh tokens as described in [Section 4.3.1 of OAuth 2.1](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-4.3.1).
273
+
MCP authorization servers SHOULD issue short-lived access tokens token to reduce the impact of leaked tokens.
274
+
For public clients, MCP authorization servers **MUST** rotate refresh tokens as described in [OAuth 2.1 Section 4.3.1 "Refresh Token Grant"](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-4.3.1).
272
275
273
276
### 3.2 Communication Security
274
-
Implementations MUST follow [OAuth 2.1 section 1.5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-1.5).
1. All authorization server endpoints **MUST** be served over HTTPS.
278
283
1. All redirect URIs **MUST** be either `localhost` or use HTTPS.
279
284
280
285
### 3.3 Authorization Code Protection
281
286
282
-
An attacker who has gained access to an authorization code contained in an authorization response can try to redeem the authorization code for an access token or otherwise make use of the authorization code. (Further described in [OAuth 2.1, section 7.5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.5))
283
-
284
-
MCP clients **MUST** implement PKCE according to [OAuth 2.1 section 7.5.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.5.2). PKCE helps prevent authorization code interception and injection attacks by requiring clients to create a secret verifier-challenge pair, ensuring that only the original requestor can exchange an authorization code for tokens.
287
+
An attacker who has gained access to an authorization code contained in an authorization response can try to redeem the authorization code for an access token or otherwise make use of the authorization code.
288
+
(Further described in [OAuth 2.1 Section 7.5](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.5))
285
289
290
+
To mitigate this, MCP clients **MUST** implement PKCE according to [OAuth 2.1 Section 7.5.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.5.2).
291
+
PKCE helps prevent authorization code interception and injection attacks by requiring clients to create a secret verifier-challenge pair, ensuring that only the original requestor can exchange an authorization code for tokens.
286
292
287
293
### 3.3 Open Redirection
294
+
288
295
An attacker may craft malicious redirect URIs to direct users to phishing sites.
289
296
290
297
MCP clients **MUST** have redirect URIs registered with the authorization server.
MCP clients **SHOULD** use and verify state parameters in the authorization code flow
295
302
and discard any results that do not include or have a mis-match with the original state.
296
303
297
-
Authorization servers **MUST** take precautions to prevent redirecting user agents to untrusted URI's, following suggestions laid out in [OAuth 2.1, Section 7.12.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.12.2)
304
+
Authorization servers **MUST** take precautions to prevent redirecting user agents to untrusted URI's, following suggestions laid out in [OAuth 2.1 Section 7.12.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.12.2)
298
305
299
306
Authorization servers **SHOULD** only automatically redirect the user agent if it trusts the redirection URI. If the URI is not trusted, the authorization server MAY inform the user and rely on the user to make the correct decision.
300
307
301
308
### 3.4 Confused Deputy Problem
302
309
303
-
Attackers can exploit MCP servers acting as intermediaries to third-party APIs, leading to confused deputy vulnerabilities. By using stolen authorization codes, they can obtain access tokens without user consent. See [Security Best Practices 2.1](/specification/draft/basic/security_best_practices) for details.
310
+
Attackers can exploit MCP servers acting as intermediaries to third-party APIs, leading to confused deputy vulnerabilities.
311
+
By using stolen authorization codes, they can obtain access tokens without user consent.
312
+
See [Security Best Practices 2.1](/specification/draft/basic/security_best_practices) for details.
304
313
305
314
MCP proxy servers using static client IDs **MUST** obtain user consent for each dynamically
306
315
registered client before forwarding to third-party authorization servers (which may require additional consent).
0 commit comments