modelcontextprotocol / modelcontextprotocol/python-sdk
ClientAuthenticator ignores token_endpoint_auth_method="none" when client_secret is stored
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.3k
- Forks
- 4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 31
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
ClientAuthenticator behavior is only partially honoring token_endpoint_auth_method="none":
Essentially:
token_endpoint_auth_method="none"=> skip extracting credentials from the request (correct)client.client_secretexists => raise error if no credentials were extracted from the request (incorrect)
If token_endpoint_auth_method="none" is set, it should never be checking for a client_secret value on the request, regardless of whether a secret has ever been generated for the client.
Suggested fix is to condition the client.client_secret check on token_endpoint_auth_method not being none:
if token_endpoint_auth_method != "none" and client.client_secret: # pragma: no branch
if not request_client_secret:
raise AuthenticationError("Client secret is required") # pragma: no cover
Example Code
Python & MCP Python SDK
1.25.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/mcp/server/auth/middleware/client_auth.py at the linked ClientAuthenticator logic. Reproduce the case where token_endpoint_auth_method is none while a client secret is stored, then verify that request credentials are not required for this method and that other methods retain their checks. Add or update the relevant authentication test to cover the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100