Streamable HTTP client builds per-message debug log strings even when DEBUG is off

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

メンテナーはふだん 1 日以内に返信

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

  • #3932 @tchardonnens による — マージされずにクローズ

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Read src/mcp/client/streamable_http.py at the two logger.debug calls named in the issue. Check Python logging’s lazy formatting pattern, then confirm both calls preserve their current messages while deferring message formatting. Done means both per-message debug calls use lazy %s formatting; the issue does not name a test to run.

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

説明

StreamableHTTPTransport formats every message into a debug log with an f-string, so the full repr of each JSON-RPC message is built even when DEBUG is off:

  • src/mcp/client/streamable_http.py: logger.debug(f"SSE message: {message}") (every received SSE message)
  • src/mcp/client/streamable_http.py: logger.debug(f"Sending client message: {message}") (every sent message)

Impact: in a proxy that relays MCP traffic with large tool results, CPU profiles showed about 2.4% of total CPU going into these discarded reprs.

Expected: use lazy %s formatting (logger.debug("SSE message: %s", message)), so the repr is only built when DEBUG is enabled. Log output is unchanged.

I'd be happy to send the two-line PR if you assign this to me.

(Drafted with AI assistance; I hit this in production and reviewed it.)

主要言語
Python
スター
25k
フォーク
4.2k
平均マージ
10分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

modelcontextprotocol/python-sdk のほかの issue

modelcontextprotocol/python-sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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