[bot] MCP (Model Context Protocol) Python SDK: no instrumentation for ClientSession tool-calling execution
维护者通常 1 天内回复
@raoashish10 已经在做这个了。
开始于 2026年8月2日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
从 py/src/braintrust/integrations/adk/test_adk_mcp_tool.py 及其周围的 py/src/braintrust/integrations/ 布局开始,因为该仓库没有独立的 mcp 集成。检查 issue 中列出的稳定 mcp.ClientSession 接口以及现有的 tracing 约定;当直接的工具调用、资源读取和 prompt 操作都使用所述的输入、输出和元数据完成 instrumentation,并且 README integrations 表已更新时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
The official Model Context Protocol Python SDK (PyPI package mcp, https://github.com/modelcontextprotocol/python-sdk) is not instrumented anywhere in this repo. mcp.ClientSession exposes an execution surface for agent tool-calling — call_tool(), list_tools(), read_resource(), list_resources(), list_prompts(), get_prompt() — that a developer's own agent code can call directly, independent of any of the agent frameworks this repo already instruments (claude_agent_sdk, openai_agents, google-adk, etc., which each embed their own MCP client internally).
Braintrust already instruments several agent-run frameworks that use MCP under the hood (e.g. Google ADK — see py/src/braintrust/integrations/adk/test_adk_mcp_tool.py — plus Claude Agent SDK and OpenAI Agents SDK), but a developer who talks to an MCP server directly via the standalone mcp SDK (not through one of those frameworks) gets zero tracing for their tool calls, resource reads, or prompt fetches.
Braintrust docs status: not_found. https://www.braintrust.dev/docs/guides/tracing lists supported providers ("OpenAI, Anthropic, Gemini, AWS Bedrock, Azure, Mistral, Together, Groq, and many more") and frameworks ("LangChain, LangGraph, CrewAI, Vercel AI SDK, Pydantic AI, DSPy, and many more") but does not mention the standalone MCP Python SDK or ClientSession instrumentation.
What needs to be instrumented
| SDK surface | Already traced? |
|---|---|
ClientSession.call_tool(name, arguments) |
No |
ClientSession.list_tools() |
No |
ClientSession.read_resource(uri) |
No |
ClientSession.list_resources() |
No |
ClientSession.get_prompt(name, arguments) |
No |
A useful span for call_tool should record input (tool name + arguments), output (CallToolResult.content / structuredContent), and metadata (provider: "mcp", server name/transport).
Upstream sources
- Repo: https://github.com/modelcontextprotocol/python-sdk
- PyPI:
mcp— latest stable release1.28.1(2026-06-26): https://pypi.org/project/mcp/ - Client quickstart showing
ClientSession.list_tools()/call_tool()usage: https://modelcontextprotocol.io/quickstart/client
Local repo files inspected
- Repo-wide grep for
import mcp,from mcp,ClientSessionunderpy/src/braintrust/— zero matches py/src/braintrust/integrations/adk/test_adk_mcp_tool.py— MCP only exercised as a sub-feature of the Google ADK integration; no standalonemcppatcherpy/src/braintrust/integrations/— nomcp/directoryREADME.mdintegrations table — no MCP entry
Note: as of this writing the mcp package's v2 line (2.0.0b1) is an explicit pre-release not intended for production per its own README, so instrumentation should target the stable v1.x ClientSession API.
- 主要语言
- Python
- 星标
- 21
- 派生
- 23
- 平均合并
- 19 小时 55 分钟
- 30 天内合并 PR
- 95
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
braintrustdata/braintrust-sdk-python 的其他 Issue
-
feature python
难度 2/5 1-3 小时 新手友好度 76/100
braintrustdata/braintrust-sdk-python#868 ·
维护者通常 1 天内回复
-
feature integration: mistral python
难度 2/5 1-3 小时 新手友好度 75/100
braintrustdata/braintrust-sdk-python#867 ·
维护者通常 1 天内回复
-
[bot] Google GenAI: streaming responses drop `url_context_metadata` that non-streaming responses preserve可能已有人在做 @Kayvan-Zahiri 于 5 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
braintrustdata/braintrust-sdk-python#774 ·
维护者通常 1 天内回复
-
OpenAI: trace computer-use Agents session items and capture Responses `access_programs`可能已有人在做 @AbhiPrasad 于 2 天前认领。 未关闭feature integration: openai python
braintrustdata/braintrust-sdk-python#869 · 已指派 1 人 ·
维护者通常 1 天内回复
-
feature python
难度 3/5 1-2 天 新手友好度 72/100
braintrustdata/braintrust-sdk-python#866 ·
维护者通常 1 天内回复
查看 braintrustdata/braintrust-sdk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
Task
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
war-and-code/dircue#200 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复