modelcontextprotocol / modelcontextprotocol/python-sdk
Support MCP client session resumption (sessionId reuse) in Python SDK
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 24.3k
- 分支
- 4k
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先追蹤 Python SDK 如何建立及管理用戶端工作階段,然後檢視連結的 C# SDK issue,以了解工作階段恢復的脈絡。完成後應包括一種受支援的方式來重新使用先前簽發的 sessionId、獨立於用戶端生命週期恢復工作階段,以及記錄相關行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api, backend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100