modelcontextprotocol / modelcontextprotocol/python-sdk

`auth` specification in `ClientSessionGroup`

Open
#1,723 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auth enhancement help wanted needs decision P2
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Description

It would be nice for the ClientSessionGroup to be OAuth compatible by allowing us to specify the OAuth httpx.Auth provider when passing in the ServerParameters rather than passing the bearer tokens manually via the headers field. This will allow us to do the OAuth token exchange flow straight from the ClientSessionGroup.

References

Here is the singleton ClientSession example of an OAuth flow: https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/clients/simple-auth-client/mcp_simple_auth_client/main.py

It would be nice to have an example of a ClientSessionGroup using that same flow.

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 with ClientSessionGroup and its ServerParameters handling, then compare it with the referenced examples/clients/simple-auth-client/mcp_simple_auth_client/main.py singleton OAuth flow. Confirm how an OAuth httpx.Auth provider should be supplied and add a ClientSessionGroup example using the same flow. Done means the group supports the provider without manually passing bearer tokens and the example demonstrates it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authentication
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.