modelcontextprotocol / modelcontextprotocol/python-sdk

Client Credentials In the token Handler

Open
#881 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth enhancement improves spec compliance P1 pending SEP approval
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Is your feature request related to a problem? Please describe.
The MCP Authorization Spec 2.1.1 OAuth Grant Types mentions that both Authorization Code and Client Credentials should be handled.

Describe the solution you'd like
In /server/auth/handlers/token.py, we only currently support "authorization-code". It would be fantastic if we could support "client-credentials" as well.

https://github.com/modelcontextprotocol/python-sdk/blob/544176770b53e6a0ae8c413d3b6c5116421f67df/src/mcp/server/auth/handlers/token.py#L26-L47

Describe alternatives you've considered
I mean it's just more convenient, so I don't have to do the whole PKCE exchange thing if it's not necessary.

Additional context

Image

Link to MCP spec: https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#2-1-1-oauth-grant-types

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading /server/auth/handlers/token.py, especially the existing authorization-code handling, and compare it with the MCP OAuth Grant Types specification linked in the issue. Confirm the expected client-credentials behavior and identify the relevant tests or test entry points in the repository. Done means the token handler supports client-credentials as well as authorization-code without requiring a PKCE exchange.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.