modelcontextprotocol / modelcontextprotocol/python-sdk

Support MCP client session resumption (sessionId reuse) in Python SDK

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

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

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

説明

Description

Summary

The Python MCP SDK currently appears to create a new session whenever a client is instantiated. It would be valuable to support resuming an existing MCP session using a previously issued sessionId, similar to functionality discussed and addressed in the C# SDK (see modelcontextprotocol/csharp-sdk#946).

This would enable persistent and stateful workflows in agent-based systems.

Problem

At present, there does not appear to be a documented way in the Python SDK to:

  • Reuse an existing sessionId
  • Resume a previously established MCP session
  • Control session lifecycle independently of the client object's lifetime

Why This Is Important

  • In agent-driven architectures , session continuity allows:
  • More efficient orchestration
  • Reduced overhead from repeated session initialization

As MCP adoption grows across SDKs (C#, TypeScript, Python), having consistent session lifecycle capabilities improves cross-language parity and developer experience.

References

https://github.com/modelcontextprotocol/csharp-sdk/issues/946

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

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

はじめの一歩

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

調査の方向性

まず、Python SDK がクライアントセッションを作成・管理する方法を追跡し、次にセッション再開のコンテキストについて、リンク先の C# SDK issue を確認します。完了条件には、以前発行された sessionId を再利用するサポート対象の方法、クライアントのライフサイクルに依存せずにセッションを再開する方法、およびその動作のドキュメント化が含まれます。

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

評価

技術スタック
python
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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