Skip to content

Commit 6c895ae

Browse files
committed
Fix client_secret validation for token_endpoint_auth_method=none
The MCP SDK now validates that client_secret is provided if it's set, regardless of token_endpoint_auth_method. Since the proxy uses 'none' for client auth (handling upstream auth itself), we must also set client_secret=None to be consistent.
1 parent 654442b commit 6c895ae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/fastmcp/server/auth/oauth_proxy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,9 +1021,13 @@ async def register_client(self, client_info: OAuthClientInformationFull) -> None
10211021
# Create a ProxyDCRClient with configured redirect URI validation
10221022
if client_info.client_id is None:
10231023
raise ValueError("client_id is required for client registration")
1024+
# We use token_endpoint_auth_method="none" because the proxy handles
1025+
# all upstream authentication. The client_secret must also be None
1026+
# because the SDK requires secrets to be provided if they're set,
1027+
# regardless of auth method.
10241028
proxy_client: ProxyDCRClient = ProxyDCRClient(
10251029
client_id=client_info.client_id,
1026-
client_secret=client_info.client_secret,
1030+
client_secret=None,
10271031
redirect_uris=client_info.redirect_uris or [AnyUrl("http://localhost")],
10281032
grant_types=client_info.grant_types
10291033
or ["authorization_code", "refresh_token"],

0 commit comments

Comments
 (0)