modelcontextprotocol / modelcontextprotocol/python-sdk

Streamable HTTP client performance regression starting with v1.12.0

Open
#1,274 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 ready for work
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Initial Checks
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.

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 the linked mcp-client-performance-testing reproduction repository and compare its client-session, tool-list, and tool-call measurements across SDK versions 1.11.0, 1.12.1, and 1.13.0. Focus on the streamable HTTP transport and the OAuthClientProvider context mentioned in the report; done means the Notion scenarios no longer incur the roughly 10-second delay without regressing the unaffected GitHub and simple-client cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.