claude-code
claude-code copied to clipboard
[BUG] 404 for Invalid Session ID should trigger a new session
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The latest MCP specification 2025-06-18 mentions in Trasports // 2.5 Session Management (4) that:
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.
Current behavior using Claude Code is to just report the error and quit.
⏺ myserver - time_get_current_time (MCP)(timezone: "America/New_York")
⎿ Error: Error POSTing to endpoint (HTTP 404):
{"jsonrpc":"2.0","error":{"code":-32000,"message":"No valid session ID provided"},"id":null}
⏺ The error persists.
What Should Happen?
Claude Code to initialize a new session / reconnect to the MCP server and continue.
Error Messages/Logs
Steps to Reproduce
Preparations:
- Set up a local MCP server in-memory only session management, like https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/examples/server/sseAndStreamableHttpCompatibleServer.ts
-
claude mcp add --transport http myserver http://localhost:{port}/mcp
Steps:
- Start
claude. Verify that the mcp is connected/mcp - Close the MCP server and open again
- Try to call a tool from the server
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
1.0.128 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response