Repository navigation
Description
Summary
Add a configurable per-server MCP initialize/handshake timeout (with a global default). Today the deadline for a stdio upstream to complete the MCP initialize handshake appears to be hardcoded (~30s; observed did not respond to MCP initialize within 27.2s). Servers that do legitimate first-run work before responding to initialize (cache warmup, index build, large API prefetch) get killed mid-startup and never finish — and with docker run --rm the partial work is discarded, so retries loop forever without converging.
Environment
- MCPProxy v0.45.0 (personal), darwin/arm64
- Upstream:
ghcr.io/korotovsky/slack-mcp-server(stdio, un-isolated, run viadocker run --rm -i -v slack-mcp-cache:/root/.cache ...)
Repro / real-world case
On startup the Slack server caches users, then channels, before it answers initialize. When its channel cache is expired (hardcoded 1h TTL) it refetches the full channel list. On a large workspace (~970 channels / 3740 users) that refetch takes longer than the ~27s handshake deadline:
... "Caching channels collection..."
... "Channels cache expired, will refetch" ttl=3600000000000 cache_age=...
=> failed to connect: server did not respond to MCP initialize within 27.2s
(subprocess may have crashed or printed to stderr instead of stdout)
mcpproxy gives up at ~27s and respawns; the killed container never persists channels_cache_v2.json, so every retry repeats the slow refetch. Result: the server is stuck Connecting, retry_count climbing, never reaching Ready. It only recovered once a killed-but-still-running container happened to finish the refetch and write the cache, after which a bounce picked up the warm (<1h) cache.
Why the existing knobs don't cover this
call_tool_timeout(default2m) governs tool calls after connect, not the initialize handshake.docker_isolation.timeout(30s) only applies to isolated servers; this server runs un-isolated (applies_to_server: false), so it doesn't bite here — and even when it does, it's a Docker-isolation knob, not an MCP-handshake knob.- There is no per-server or global field that lengthens the initialize deadline.
Proposal
-
A global default, e.g.
init_timeout(orhandshake_timeout) under top-level config, defaulting to the current value to preserve behavior. -
A per-server override on the upstream entry (and a matching parameter on the
upstream_serverspatch/update management tool), e.g.:{ "name": "slack-gcore", "command": "docker", "args": ["run", "--rm", "-i", "..."], "init_timeout": "120s" } -
Apply it to the stdio connect path that currently enforces the ~27–30s deadline so slow-but-healthy first starts can complete.
Acceptance criteria
- A server configured with
init_timeout: 120sis given up to 120s to complete the MCPinitializehandshake before mcpproxy declares failure / respawns. - Unset → current default behavior (no regression).
- Override settable via config file and via the
upstream_serversmanagement tool (patch/update). - Documented alongside
call_tool_timeout.
Notes
Related but distinct from #599 (which improved classification/stderr surfacing of "subprocess exited before MCP initialize"). This request is about making the deadline itself configurable so slow-warmup servers can connect at all. A configurable timeout would also let operators tune the startup-vs-fail-fast tradeoff per server instead of relying on a server happening to self-warm across retries.
Activity
feat(upstream): configurable per-server MCP initialize timeout
feat(upstream): configurable per-server MCP initialize timeout (#762)
Dumbris commentedon Jun 24, 2026
Shipped in PR #762 (merged to main as 1dec5aa). Adds configurable per-server MCP initialize/handshake timeout with a global default:
init_timeouton global + per-server config (default 30s, no regression), resolver applied at the connect path, settable via config + theupstream_serversmanagement tool, documented alongsidecall_tool_timeout.