@@ -50,14 +50,28 @@ while maintaining simplicity:
50
50
Server Metadata ([ RFC8414] ( https://datatracker.ietf.org/doc/html/rfc8414 ) ). Servers
51
51
that do not support Authorization Server Metadata ** MUST** follow the default URI
52
52
schema.
53
+
54
+ OAuth specifies different flows or grant types, which in essence, are different ways of obtaining an access token.
55
+ Each of these targets different use cases and scenarios.
53
56
54
- ### 2.2 Basic OAuth 2.1 Authorization
57
+ This specification focuses on two authorization scenarios:
58
+
59
+ 1 . User to system: The client is operated by the end user (a human), allowing the client to operate on the user's behalf.
60
+ 2 . System to system: The client is another application (LLM or not)
61
+
62
+ ** NOTE** : For simplicity purposes, the following examples will assume the MCP server to also function as the authorization server. However,
63
+ in a real implementation the authorization server will probably be deployed as its own distinct service.
64
+
65
+ ### 2.2 OAuth 2.1 User to System through the Authorization Code Grant Type
66
+
67
+ A human user completes the OAuth flow through a web browser, obtaining an access token that identifies them personally and allows the
68
+ client to act on their behalf.
55
69
56
70
When authorization is required and not yet proven by the client, servers ** MUST** respond
57
71
with _ HTTP 401 Unauthorized_ .
58
72
59
73
Clients initiate the
60
- [ OAuth 2.1 IETF DRAFT] ( https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12 )
74
+ [ OAuth 2.1 IETF DRAFT] ( https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-authorization-code-grant )
61
75
authorization flow after receiving the _ HTTP 401 Unauthorized_ .
62
76
63
77
The following demonstrates the basic OAuth 2.1 for public clients using PKCE.
@@ -81,8 +95,32 @@ sequenceDiagram
81
95
C->>M: MCP Request with Access Token
82
96
Note over C,M: Begin standard MCP message exchange
83
97
```
98
+ ### 2.3 OAuth 2.1 System to System through the Client Credentials Grant Type
99
+
100
+ In this case, the client acts not in behalf of a human user but a system. Therefore, the access token is obtained by only sharing the client
101
+ credentials and doesn't require browser interaction.
102
+
103
+ When authorization is required and not yet proven by the client, servers ** MUST** respond
104
+ with _ HTTP 401 Unauthorized_ .
105
+
106
+ Clients initiate the
107
+ [ OAuth 2.1 IETF DRAFT] ( https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-client-credentials-grant )
108
+ Client Credentials flow after receiving the _ HTTP 401 Unauthorized_ .
109
+
110
+ ``` mermaid
111
+ sequenceDiagram
112
+ participant C as Client
113
+ participant M as MCP Server
114
+
115
+ C->>M: MCP Request
116
+ M->>C: HTTP 401 Unauthorized
117
+ C->>M: Token Request with client_id + client_secret
118
+ M->>C: Access Token (+ Refresh Token)
119
+ C->>M: MCP Request with Access Token
120
+ Note over C,M: Begin standard MCP message exchange
121
+ ```
84
122
85
- ### 2.3 Server Metadata Discovery
123
+ ### 2.4 Server Metadata Discovery
86
124
87
125
For server capability discovery:
88
126
0 commit comments