modelcontextprotocol / modelcontextprotocol/python-sdk

`auth` specification in `ClientSessionGroup`

未关闭
#1,723 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

auth enhancement help wanted needs decision P2
主要语言
Python
星标
24.3k
派生
4k
平均合并
1 天 1 小时
30 天内合并 PR
31

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先从 ClientSessionGroup 及其对 ServerParameters 的处理入手,然后将其与 examples/clients/simple-auth-client/mcp_simple_auth_client/main.py 中引用的 singleton OAuth 流程进行比较。确认应如何提供 OAuth httpx.Auth provider,并添加一个使用相同流程的 ClientSessionGroup 示例。完成的标准是该 group 支持此 provider,而无需手动传递 bearer token,并且示例能够展示这一点。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, authentication
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。