Skip to content

Commit a78316c

Browse files
committed
fix: include "none" in token_endpoint_auth_methods_supported metadata
The `build_metadata()` function hardcoded `token_endpoint_auth_methods_supported` to `["client_secret_post", "client_secret_basic"]`, but the registration handler already supports `token_endpoint_auth_method: "none"` for public clients. MCP clients like Claude Code follow the metadata to determine supported auth methods. Without "none" advertised, public client flows break: the client registers successfully (no client_secret), but then cannot complete the token exchange because the metadata implies a secret is required. Also includes "none" in `revocation_endpoint_auth_methods_supported` for consistency. Fixes #2260
1 parent f8d98b6 commit a78316c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/mcp/server/auth/routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def build_metadata(
165165
response_types_supported=["code"],
166166
response_modes_supported=None,
167167
grant_types_supported=["authorization_code", "refresh_token"],
168-
token_endpoint_auth_methods_supported=["client_secret_post", "client_secret_basic"],
168+
token_endpoint_auth_methods_supported=["client_secret_post", "client_secret_basic", "none"],
169169
token_endpoint_auth_signing_alg_values_supported=None,
170170
service_documentation=service_documentation_url,
171171
ui_locales_supported=None,
@@ -182,7 +182,7 @@ def build_metadata(
182182
# Add revocation endpoint if supported
183183
if revocation_options.enabled: # pragma: no branch
184184
metadata.revocation_endpoint = AnyHttpUrl(str(issuer_url).rstrip("/") + REVOCATION_PATH)
185-
metadata.revocation_endpoint_auth_methods_supported = ["client_secret_post", "client_secret_basic"]
185+
metadata.revocation_endpoint_auth_methods_supported = ["client_secret_post", "client_secret_basic", "none"]
186186

187187
return metadata
188188

tests/client/test_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,10 +1245,10 @@ def test_build_metadata(
12451245
"registration_endpoint": Is(registration_endpoint),
12461246
"scopes_supported": ["read", "write", "admin"],
12471247
"grant_types_supported": ["authorization_code", "refresh_token"],
1248-
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
1248+
"token_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic", "none"],
12491249
"service_documentation": Is(service_documentation_url),
12501250
"revocation_endpoint": Is(revocation_endpoint),
1251-
"revocation_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic"],
1251+
"revocation_endpoint_auth_methods_supported": ["client_secret_post", "client_secret_basic", "none"],
12521252
"code_challenge_methods_supported": ["S256"],
12531253
}
12541254
)

tests/server/fastmcp/auth/test_auth_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ async def test_metadata_endpoint(self, test_client: httpx.AsyncClient):
320320
assert metadata["revocation_endpoint"] == "https://auth.example.com/revoke"
321321
assert metadata["response_types_supported"] == ["code"]
322322
assert metadata["code_challenge_methods_supported"] == ["S256"]
323-
assert metadata["token_endpoint_auth_methods_supported"] == ["client_secret_post", "client_secret_basic"]
323+
assert metadata["token_endpoint_auth_methods_supported"] == ["client_secret_post", "client_secret_basic", "none"]
324324
assert metadata["grant_types_supported"] == [
325325
"authorization_code",
326326
"refresh_token",

0 commit comments

Comments
 (0)