Skip to content

Commit 63e1dbb

Browse files
Merge pull request modelcontextprotocol#166 from modelcontextprotocol/justin/require-client-id
[auth] Require client ID even for localhost redirects
2 parents 843186c + e035a26 commit 63e1dbb

File tree

1 file changed

+18
-38
lines changed

1 file changed

+18
-38
lines changed

docs/specification/draft/basic/authorization.md

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -135,43 +135,27 @@ remain unchanged.
135135

136136
### 2.3 Dynamic Client Registration
137137

138-
MCP authorization makes use of the
138+
MCP clients and servers **SHOULD** support the
139139
[OAuth 2.0 Dynamic Client Registration Protocol](https://datatracker.ietf.org/doc/html/rfc7591)
140-
to allow MCP clients to obtain OAuth client IDs without user interaction.
141-
142-
- MCP clients **SHOULD** support
143-
[OAuth 2.0 Dynamic Client Registration Protocol](https://datatracker.ietf.org/doc/html/rfc7591)
144-
- MCP servers with non-localhost redirect URIs **SHOULD** support Dynamic Client
145-
Registration.
146-
- MCP servers with localhost redirect URIs **MAY** support Dynamic Client Registration.
147-
148-
Note that it is not required to support Dynamic Client Registration. MCP clients that do
149-
not support Dynamic Client Registration need to provide alternative ways to obtain a
150-
client id (and if applicable client secret).
151-
152-
#### 2.3.1 Localhost Redirect URIs
153-
154-
When using localhost redirect URIs (http://localhost:{port} or http://127.0.0.1:{port}),
155-
clients:
156-
157-
- Dynamic registration is **OPTIONAL** (a client ID is not required).
158-
- **MAY** proceed directly to authorization.
159-
- **SHOULD** be considered public clients and not store any clients secrets.
160-
161-
This exception for localhost is explicitly supported by OAuth 2.1 for public clients and
162-
provides a secure flow through the combination of PKCE and localhost-only redirects.
163-
164-
#### 2.3.2 Non-Localhost Redirect URIs
165-
166-
For all other redirect URIs, MCP clients and servers **SHOULD** support dynamic client
167-
registration. This provides a standardized way for clients to automatically register with
168-
new servers, which is crucial for MCP because:
140+
to allow MCP clients to obtain OAuth client IDs without user interaction. This provides a
141+
standardized way for clients to automatically register with new servers, which is crucial
142+
for MCP because:
169143

170144
- Clients cannot know all possible servers in advance
171145
- Manual registration would create friction for users
172146
- It enables seamless connection to new servers
173147
- Servers can implement their own registration policies
174148

149+
Any MCP servers that _do not_ support Dynamic Client Registration need to provide
150+
alternative ways to obtain a client ID (and, if applicable, client secret). For one of
151+
these servers, MCP clients will have to either:
152+
153+
1. Hardcode a client ID (and, if applicable, client secret) specifically for that MCP
154+
server, or
155+
2. Present a UI to users that allows them to enter these details, after registering an
156+
OAuth client themselves (e.g., through a configuration interface hosted by the
157+
server).
158+
175159
### 2.4 Authorization Flow Steps
176160

177161
The complete Authorization flow proceeds as follows:
@@ -189,7 +173,7 @@ sequenceDiagram
189173
M->>C: 404 (Use default endpoints)
190174
end
191175
192-
alt Non-Localhost Redirect URI
176+
alt Dynamic Client Registration
193177
C->>M: POST /register
194178
M->>C: Client Credentials
195179
end
@@ -213,17 +197,13 @@ flowchart TD
213197
B -->|Available| C[Use Metadata Endpoints]
214198
B -->|Not Available| D[Use Default Endpoints]
215199
216-
C --> E{Check Redirect URI}
217-
D --> E
218-
219-
E -->|Localhost| F[Skip Registration]
220-
E -->|Non-localhost| G{Check Registration Endpoint}
200+
C --> G{Check Registration Endpoint}
201+
D --> G
221202
222203
G -->|Available| H[Perform Dynamic Registration]
223204
G -->|Not Available| I[Alternative Registration Required]
224205
225-
F --> J[Start OAuth Flow]
226-
H --> J
206+
H --> J[Start OAuth Flow]
227207
I --> J
228208
229209
J --> K[Generate PKCE Parameters]

0 commit comments

Comments
 (0)