Skip to content

Commit 7487b55

Browse files
committed
feat: clarify server metadata discovery mechanisim
1 parent 843fb58 commit 7487b55

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

docs/specification/draft/basic/authorization.mdx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ as described in [RFC9728 Section 5.1 "WWW-Authenticate Response"](https://datatr
9494

9595
MCP clients **MUST** be able to parse `WWW-Authenticate` headers and respond appropriately to `HTTP 401 Unauthorized` responses from the MCP server.
9696

97+
#### Server Metadata Discovery
98+
99+
To handle different issuer URL formats and ensure interoperability with both OAuth 2.0 Authorization Server Metadata and OpenID Connect Discovery 1.0 specifications, MCP clients **MUST** attempt multiple well-known endpoints when discovering authorization server metadata.
100+
101+
The discovery approach is based on [RFC8414 Section 3.1 "Authorization Server Metadata Request"](https://datatracker.ietf.org/doc/html/rfc8414#section-3.1) for OAuth 2.0 Authorization Server Metadata discovery and [RFC8414 Section 5 "Compatibility Notes"](https://datatracker.ietf.org/doc/html/rfc8414#section-5) for OpenID Connect Discovery interoperability.
102+
103+
For issuer URLs with path components (e.g., `https://auth.example.com/tenant1`), clients **MUST** try endpoints in the following priority order:
104+
105+
1. OAuth 2.0 Authorization Server Metadata with path insertion: `https://auth.example.com/.well-known/oauth-authorization-server/tenant1`
106+
2. OpenID Connect Discovery with path insertion: `https://auth.example.com/.well-known/openid-configuration/tenant1`
107+
3. OpenID Connect Discovery 1.0 legacy path appending: `https://auth.example.com/tenant1/.well-known/openid-configuration`
108+
109+
For issuer URLs without path components (e.g., `https://auth.example.com`), clients **MUST** try:
110+
111+
1. OAuth 2.0 Authorization Server Metadata: `https://auth.example.com/.well-known/oauth-authorization-server`
112+
2. OpenID Connect Discovery: `https://auth.example.com/.well-known/openid-configuration`
113+
97114
#### Sequence Diagram
98115

99116
The following diagram outlines an example flow:
@@ -112,11 +129,8 @@ sequenceDiagram
112129
M-->>C: Resource metadata with authorization server URL
113130
Note over C: Validate RS metadata,<br />build AS metadata URL
114131
115-
alt OAuth 2.0 Authorization Server Metadata
116-
C->>A: GET /.well-known/oauth-authorization-server
117-
else OpenID Connect Discovery
118-
C->>A: GET /.well-known/openid-configuration
119-
end
132+
C->>A: GET Authorization server metadata endpoint
133+
Note over C,A: Try OAuth 2.0 and OpenID Connect<br/>discovery endpoints in priority order
120134
A-->>C: Authorization server metadata
121135
122136
Note over C,A: OAuth 2.1 authorization flow happens here
@@ -172,12 +186,9 @@ sequenceDiagram
172186
173187
Note over C: Parse metadata and extract authorization server(s)<br/>Client determines AS to use
174188
175-
alt OAuth 2.0 Authorization Server Metadata
176-
C->>A: GET /.well-known/oauth-authorization-server
177-
else OpenID Connect Discovery
178-
C->>A: GET /.well-known/openid-configuration
179-
end
180-
A->>C: Authorization server metadata response
189+
C->>A: GET Authorization server metadata endpoint
190+
Note over C,A: Try OAuth 2.0 and OpenID Connect<br/>discovery endpoints in priority order
191+
A-->>C: Authorization server metadata
181192
182193
alt Dynamic client registration
183194
C->>A: POST /register

0 commit comments

Comments
 (0)