python-sdk
python-sdk copied to clipboard
MCP client doesn't not initialize new session when getting 404 session not found
Initial Checks
- [x] I confirm that I'm using the latest version of MCP Python SDK
- [x] 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