modelcontextprotocol / modelcontextprotocol/python-sdk

Streamable HTTP client performance regression starting with v1.12.0

オープン
#1,274 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P2 ready for work
主要言語
Python
スター
24.3k
フォーク
4k
平均マージ
1日 1時間
マージ済み PR(30日)
31

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた mcp-client-performance-testing 再現リポジトリから始め、SDK バージョン 1.11.0、1.12.1、1.13.0 における client-session、tool-list、tool-call の測定値を比較してください。streamable HTTP トランスポートと、レポートで言及されている OAuthClientProvider コンテキストに焦点を当てます。完了条件は、影響を受けていない GitHub および simple-client のケースをリグレッションさせることなく、Notion のシナリオで約 10 秒の遅延が発生しなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。