modelcontextprotocol / modelcontextprotocol/python-sdk
Support MCP client session resumption (sessionId reuse) in Python SDK
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.3k
- Forks
- 4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 31
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the Python SDK creates and manages client sessions, then review the linked C# SDK issue for the session-resumption context. Done should include a supported way to reuse a previously issued sessionId, resume a session independently of client lifetime, and document the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100