modelcontextprotocol / modelcontextprotocol/python-sdk
MCP client doesn't not initialize new session when getting 404 session not found
オープン
まだ誰も着手していません。
bug
improves spec compliance
P2
ready for work
- 主要言語
- 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
Per https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#session-management
When a client receives HTTP 404 in response to a request containing an MCP-Session-Id, it MUST start a new session by sending a new InitializeRequest without a session ID attached.
This is not the case with the python client. It just sends a session terminated error in streamable_http.py
Example Code
Python & MCP Python SDK
mcp: 1.22.0
python: 3.14.0
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
MCP-Session-Idを含む404レスポンスが処理されるsrc/mcp/client/streamable_http.pyの277行目付近から始め、issueにリンクされているセッション管理の要件とその動作を比較してください。クライアントの初期化のエントリーポイントを追跡し、404レスポンスを発生させて、実装された動作を確認してください。クライアントはsession IDなしで新しいInitializeRequestを送信し、session-terminatedエラーを返すべきではありません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 70/100