Skip to content

Commit 91b992b

Browse files
committed
fix: expand OAuth metadata validation to support compliant servers
The OAuthMetadata validation was too restrictive, rejecting valid OAuth 2.0 server configurations that advertise additional authentication methods beyond the minimum required set. Changes: - Allow 'client_secret_basic' in token_endpoint_auth_methods_supported - Allow 'plain' in code_challenge_methods_supported This fixes compatibility with MCP servers like Asana (mcp.asana.com) that advertise support for multiple OAuth authentication methods as allowed by the OAuth 2.0 specification and MCP specification. The MCP specification does not restrict which authentication methods servers can support, only requiring that PKCE is used. These changes ensure the client can connect to any compliant MCP server regardless of which optional authentication methods they also support.
1 parent 2ca2de7 commit 91b992b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mcp/shared/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class OAuthMetadata(BaseModel):
117117
list[Literal["authorization_code", "refresh_token"]] | None
118118
) = None
119119
token_endpoint_auth_methods_supported: (
120-
list[Literal["none", "client_secret_post"]] | None
120+
list[Literal["none", "client_secret_post", "client_secret_basic"]] | None
121121
) = None
122122
token_endpoint_auth_signing_alg_values_supported: None = None
123123
service_documentation: AnyHttpUrl | None = None
@@ -134,4 +134,4 @@ class OAuthMetadata(BaseModel):
134134
list[Literal["client_secret_post"]] | None
135135
) = None
136136
introspection_endpoint_auth_signing_alg_values_supported: None = None
137-
code_challenge_methods_supported: list[Literal["S256"]] | None = None
137+
code_challenge_methods_supported: list[Literal["S256", "plain"]] | None = None

0 commit comments

Comments
 (0)