fix(client): raise typed error for lost Streamable HTTP sessions

Closed
2Z
9d ago
+45-7

Fixes #3799.

When a Streamable HTTP request carries a session ID but the server responds with HTTP 404, raise a dedicated SessionNotFoundError while preserving the original JSON-RPC code, message, and data. Normal 404 responses without an active session continue to use the existing MCPError behavior.

Added regression coverage for session termination responses, including 204 DELETE termination flow.

Validation: python -m compileall -q src/mcp tests/shared/test_streamable_http.py and git diff --check. Runtime pytest could not be run in this environment because pytest and project dependencies are not installed.