modelcontextprotocol / modelcontextprotocol/python-sdk
`ClientConfig` has inconsistent naming: `message_handler` should be `message_callback`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 24.3k
- フォーク
- 4k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 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
ClientConfig exposes five user-facing callback fields, but four of them use the *_callback suffix while one uses *_handler:
# src/mcp/client/client.py
sampling_callback: SamplingFnT | None = None
list_roots_callback: ListRootsFnT | None = None
logging_callback: LoggingFnT | None = None
elicitation_callback: ElicitationFnT | None = None
message_handler: MessageHandlerFnT | None = None # ← inconsistent
The same inconsistency is present in ClientSession.__init__ and ServerConnectionParams:
# src/mcp/client/session.py
def __init__(self, ..., message_handler: MessageHandlerFnT | None = None, ...)
# src/mcp/client/session_group.py
class ServerConnectionParams:
message_handler: MessageHandlerFnT | None = None
A TODO comment in the codebase already flags this:
# TODO(Marcelo): Why do we have both "callback" and "handler"?
message_handler: MessageHandlerFnT | None = None
Proposed Fix
Rename message_handler → message_callback consistently across all three sites:
| File | Change |
|---|---|
src/mcp/client/client.py |
message_handler → message_callback (field + forwarding call) |
src/mcp/client/session.py |
message_handler parameter → message_callback; internal _message_handler → _message_callback |
src/mcp/client/session_group.py |
ServerConnectionParams.message_handler → message_callback + forwarding call |
src/mcp/client/__main__.py |
local variable + keyword arg rename |
Since this is the v2 rewrite on main, a breaking rename is appropriate and there is no need for a deprecation shim.
I'd like to take this on if you're open to a fix.
Python & MCP Python SDK
Python 3.13
Reproduced on: main @ 161834d (2026-05-13)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/mcp/client/client.py の callback 定義と転送呼び出しから始め、次に src/mcp/client/session.py の関連するパラメーターと内部属性を追ってください。src/mcp/client/session_group.py の ServerConnectionParams と、src/mcp/client/main.py のローカル変数およびキーワード引数を確認してください。4 つすべての箇所で一貫して message_callback が使用され、このフローに message_handler という命名が残っていなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 73/100