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
-
54
-
### 2.1.1 OAuth Grant Types
55
-
56
-
OAuth specifies different flows or grant types, which are different ways of obtaining an
57
-
access token. Each of these targets different use cases and scenarios.
58
-
59
-
MCP servers **SHOULD** support the OAuth grant types that best align with the intended
60
-
audience. For instance:
61
-
62
-
1. Authorization Code: useful when the client is acting on behalf of a (human) end user.
63
-
- For instance, an agent calls an MCP tool implemented by a SaaS system.
64
-
2. Client Credentials: the client is another application (not a human)
65
-
- For instance, an agent calls a secure MCP tool to check inventory at a specific
66
-
store. No need to impersonate the end user.
53
+
MCP clients **MUST** use the OAuth 2.0 Authorization Server Metadata.
67
54
68
55
### 2.2 Roles
69
56
A protected MCP server acts as a [OAuth 2.1 resource server](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#name-roles),
@@ -72,7 +59,8 @@ capable of accepting and responding to protected resource requests using access
72
59
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
60
making protected resource requests on behalf of a resource owner.
74
61
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
62
+
The authorization server is responsible for interacting with the user (if necessary) and issuing access tokens for use at the MCP server.
63
+
The implementation details of the authorization server are beyond the scope of this specification. It may be hosted with the
76
64
resource server or a separate entity. Section [2.3 Authorization Server Discovery](#2-3-authorizaton-server-discovery)
77
65
specifies how an MCP server indicates the location of its corresponding authorization server to a client.
78
66
@@ -83,7 +71,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)).
86
+
as described in [RFC9728 Section 5.1 "WWW-Authenticate Response"](https://datatracker.ietf.org/doc/html/rfc9728#name-www-authenticate-response).
99
87
100
88
MCP clients **MUST** be able to parse `WWW-Authenticate` headers and respond appropriately to `HTTP 401 Unauthorized` responses from the MCP server.
101
89
102
90
#### 2.3.2 Server Metadata Discovery
103
91
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.
92
+
MCP clients **MUST** follow the OAuth 2.0 Authorization Server Metadata [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414)
93
+
specification to obtain the information required to interact with the authorization server.
107
94
108
95
#### 2.3.4 Sequence Diagram
109
96
The following diagram outlines an example flow:
@@ -147,7 +134,7 @@ For example: `MCP-Protocol-Version: 2024-11-05`
147
134
### 2.5 Dynamic Client Registration
148
135
149
136
MCP clients and authorization servers **SHOULD** support the
error handling requirements. Invalid or expired tokens **MUST** receive a HTTP 401
240
228
response.
241
229
@@ -246,7 +234,6 @@ own resources.
246
234
247
235
MCP servers **MUST NOT** accept or transit any other tokens.
248
236
249
-
250
237
### 2.8 Error Handling
251
238
252
239
Servers **MUST** return appropriate HTTP status codes for authorization errors:
@@ -259,32 +246,38 @@ Servers **MUST** return appropriate HTTP status codes for authorization errors:
259
246
260
247
## 3. Security Considerations
261
248
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).
249
+
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
250
264
251
### 3.1 Token Theft
252
+
265
253
Attackers who obtain tokens stored by the client, or tokens cached or logged on the server can access protected resources with
266
254
requests that appear legitimate to resource servers.
267
255
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).
256
+
Clients and servers **MUST** implement secure token storage and follow OAuth best practices,
257
+
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
258
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).
259
+
MCP authorization servers SHOULD issue short-lived access tokens token to reduce the impact of leaked tokens.
260
+
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
261
273
262
### 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
269
1. All redirect URIs **MUST** be either `localhost` or use HTTPS.
279
270
280
271
### 3.3 Authorization Code Protection
281
272
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.
273
+
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.
274
+
(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
275
276
+
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).
277
+
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
278
287
279
### 3.3 Open Redirection
280
+
288
281
An attacker may craft malicious redirect URIs to direct users to phishing sites.
289
282
290
283
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
288
and discard any results that do not include or have a mis-match with the original state.
296
289
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)
290
+
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
291
299
292
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
293
301
294
### 3.4 Confused Deputy Problem
302
295
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.
296
+
Attackers can exploit MCP servers acting as intermediaries to third-party APIs, leading to confused deputy vulnerabilities.
297
+
By using stolen authorization codes, they can obtain access tokens without user consent.
298
+
See [Security Best Practices 2.1](/specification/draft/basic/security_best_practices) for details.
304
299
305
300
MCP proxy servers using static client IDs **MUST** obtain user consent for each dynamically
306
301
registered client before forwarding to third-party authorization servers (which may require additional consent).
0 commit comments