HTTP MCP client gives up after ~15 s of connection-refused; session loses server until manual /mcp
Preflight
Searched existing issues. #55228 describes the same runtime behaviour but was auto-closed as stale and locked (not fixed); #90494 (open) covers the related startup-ordering case. Filing fresh per the bot's guidance.
What's Wrong?
For an HTTP (streamable-http) MCP server on localhost, Claude Code's MCP client gives up reconnecting after roughly 15 seconds of connection-refused. The log shows:
Max reconnection attempts (5) reached, giving up
After that the session has no access to that server until the user manually runs /mcp and reconnects. Nothing retries on the next tool use.
A session that starts while the port is refused behaves the same way: it retries only 3 times, then has no tools from that server for the rest of the session.
Fleet impact: with many concurrent Claude Code sessions sharing one local MCP server, a single server restart longer than ~15 s (deploy, container recreate, upgrade) strands every session at once. Each one needs a manual /mcp reconnect, and unattended or background sessions silently lose the server's tools for good.
What Should Happen?
Any of:
- a configurable reconnect budget (max attempts, initial delay, max delay) per server in
.mcp.json/claude mcp add; - retry with capped exponential backoff, indefinitely, for http transports;
- automatic reconnect attempt on the next tool call to a server that is marked failed.
Steps to Reproduce
- Run any local HTTP MCP server, e.g.
http://127.0.0.1:8080/mcp, and add it:claude mcp add --transport http example http://127.0.0.1:8080/mcp. - Start
claude; confirm the server's tools work. - Stop the server (port now refuses connections) and wait about 20 s.
- Restart the server on the same port.
- Tools from the server remain unavailable. Only
/mcp-> reconnect restores them. - Variant: stop the server first, start
claude, start the server 20 s later. Tools never appear (3 retries only).
Error Messages/Logs
Max reconnection attempts (5) reached, giving up
Environment
- Claude Code 2.1.287
- macOS (Darwin 25.x)
- Transport: http / streamable-http, localhost
- Regression: unknown