modelcontextprotocol / modelcontextprotocol/python-sdk

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

Open
#2,116 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P2 v2
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.