modelcontextprotocol / modelcontextprotocol/python-sdk
Streamable HTTP client performance regression starting with v1.12.0
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 24.3k
- 派生
- 4k
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 31
描述
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
Summary
I have experienced a major performance degradation with streamable HTTP clients on certain servers starting in version 1.12.0 which is still present in the current version (1.13.0). I see this issue with the Notion remote MCP server on streamable HTTP transport (https://mcp.notion.com/mcp). While other servers work fine, there is a ~10 second delay with any operation on an established client session to this server after v1.11.0. The performance is fine at v1.11.0, and is fine with the current version of inspector.
Steps to Reproduce
I have a repo containing my code to reproduce the issue and more details: repo
Test Results
Testing results, copied from the above repo:
SDK Version 1.11.0 (latest without bug)
Starting tests with official Python MCP SDK version 1.11.0
Running simple client connection tests...
Test results: 0.0614 0.0136 0.0120 0.0116 0.0106 (avg 0.0219s)
Running simple tool list tests...
Test results: 0.0042 0.0041 0.0041 0.0041 0.0047 (avg 0.0042s)
Running simple tool call tests...
Test results: 0.0080 0.0067 0.0068 0.0072 0.0246 (avg 0.0107s)
Starting callback server... done
Running in memory OAuth provider construction tests...
Test results: 0.0016 0.0001 0.0000 0.0000 0.0000 (avg 0.0004s)
Running Notion client connection tests (OAuth)...
Test results: 6.0797 0.9399 0.9005 0.8184 1.0262 (avg 1.9529s)
Running Notion list tools tests...
Test results: 0.3850 0.1293 0.1308 0.1496 0.1233 (avg 0.1836s)
Running Notion call tool tests...
Test results: 0.4083 0.6162 0.8519 0.1946 0.6942 (avg 0.5530s)
Stopping callback server... done
Running GitHub client connection tests (PAT)...
Test results: 0.5784 0.2820 0.2962 0.2857 0.3079 (avg 0.3500s)
Running GitHub list tools tests...
Test results: 0.5216 0.1121 0.1129 0.1286 0.1175 (avg 0.1986s)
Running GitHub call tool tests...
Test results: 0.2627 0.3505 0.2029 0.2623 0.3536 (avg 0.2864s)
Finished!
SDK Version 1.12.1 (earliest with bug)
Starting tests with official Python MCP SDK version 1.12.1
Running simple client connection tests...
Test results: 0.0593 0.0138 0.0120 0.0111 0.0105 (avg 0.0213s)
Running simple tool list tests...
Test results: 0.0039 0.0036 0.0034 0.0050 0.0033 (avg 0.0039s)
Running simple tool call tests...
Test results: 0.0072 0.0058 0.0063 0.0063 0.0062 (avg 0.0064s)
Starting callback server... done
Running in memory OAuth provider construction tests...
Test results: 0.0009 0.0001 0.0000 0.0000 0.0001 (avg 0.0002s)
Running Notion client connection tests (OAuth)...
Test results: 6.3121 11.7071 11.6994 11.6963 11.7797 (avg 10.6389s)
Running Notion list tools tests...
Test results: 10.6288 10.4737 10.3595 10.3114 10.5529 (avg 10.4652s)
Running Notion call tool tests...
Test results: 10.6931 11.1187 13.4962 11.9530 10.8899 (avg 11.6302s)
Stopping callback server... done
Running GitHub client connection tests (PAT)...
Test results: 0.4818 0.2940 0.2908 0.2831 0.2908 (avg 0.3281s)
Running GitHub list tools tests...
Test results: 0.5536 0.1563 0.1076 0.1102 0.1399 (avg 0.2135s)
Running GitHub call tool tests...
Test results: 0.2749 0.2801 0.2645 0.3661 0.3368 (avg 0.3045s)
Finished!
SDK Version 1.13.0 (latest)
Starting tests with official Python MCP SDK version 1.13.0
Running simple client connection tests...
Test results: 0.0596 0.0133 0.0116 0.0108 0.0104 (avg 0.0212s)
Running simple tool list tests...
Test results: 0.0040 0.0035 0.0035 0.0053 0.0036 (avg 0.0040s)
Running simple tool call tests...
Test results: 0.0072 0.0060 0.0064 0.0058 0.0064 (avg 0.0064s)
Starting callback server... done
Running in memory OAuth provider construction tests...
Test results: 0.0021 0.0001 0.0000 0.0000 0.0000 (avg 0.0005s)
Running Notion client connection tests (OAuth)...
Test results: 5.4729 11.4962 11.8369 11.6574 11.5804 (avg 10.4088s)
Running Notion list tools tests...
Test results: 10.5502 10.4495 10.4619 10.3530 10.4236 (avg 10.4476s)
Running Notion call tool tests...
Test results: 10.5274 10.8830 10.5276 11.6691 10.5476 (avg 10.8309s)
Stopping callback server... done
Running GitHub client connection tests (PAT)...
Test results: 0.4458 0.2909 0.2915 0.2900 0.2837 (avg 0.3204s)
Running GitHub list tools tests...
Test results: 0.5327 0.1121 0.1792 0.1069 0.1083 (avg 0.2079s)
Running GitHub call tool tests...
Test results: 0.2469 0.2270 0.2424 0.3186 0.2323 (avg 0.2534s)
Finished!
Comments
As written in my testing repo, I have profiled the OAuthClientProvider and don't believe there is an issue with that. This issue is present when establishing client sessions and calling established client sessions. I believe there must be an underlying issue with the streamable HTTP transport that is only manifest with some servers, but that is beyond my expertise.
Example Code
Python & MCP Python SDK
Python 3.12.11 used for all testing.
Issue present in version 1.12.1 to 1.13.0.
Issue NOT present in version 1.11.0.
No results for version 1.12.0 due to unrelated (as far as I can tell) bug.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 mcp-client-performance-testing 复现仓库开始,比较其在 SDK 版本 1.11.0、1.12.1 和 1.13.0 中的 client-session、tool-list 和 tool-call 测量结果。重点关注 streamable HTTP 传输以及报告中提到的 OAuthClientProvider 上下文;完成标准是 Notion 场景不再产生大约 10 秒的延迟,同时不影响原本不受影响的 GitHub 和 simple-client 用例。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100