Repository navigation
Description
Summary
Remote MCP servers that fail to connect during session init (e.g. Request timed out while the machine's network is briefly down) are marked failed and never retried for the lifetime of that session — even hours after connectivity returns. Only a NEW session (or a substantive config edit to the mcp section, see workaround) recovers them. opencode mcp list reports the persisted failed state rather than probing, so it also keeps showing failed after the network recovers.
Environment
- opencode version: 2.2.3
- OS: macOS (Darwin 25.6.0), arm64
- Terminal: Apple_Terminal, TERM=xterm-256color
- Shell: /bin/zsh
- Install/channel: release (homebrew stable, bottled 2.2.3)
- Active plugins: none found
Reproduction
- Configure remote MCP servers (any
type: remote,enabled: true; content-agnostic — all three remote servers in this setup reproduced it). - Stall outbound TCP during session init. Reproduced by waking the laptop from deep idle sleep while a VPN client's tunnel (default-route capture) was still reconnecting; all remote endpoints time out.
- At the failing init, the log records
mcp connect failed ... status.error="Request timed out" http.span≈30000for every server. - Connectivity returns: a direct
curlMCPinitializeto the same endpoints returns 200, and NEW sessions in the same running server connect all servers fine (connect is per-session at init). - Keep using the original session for hours — no MCP tools ever appear, no retry is attempted, and
opencode mcp listkeeps showing failed.
Expected Behavior
Failed-at-init MCP servers are retried at some later point (next user message, config-change event, or an explicit reconnect verb) so that a transient network stall during startup does not silently cost the session all of its MCP tools.
Actual Behavior
No retry for the session lifetime. The log shows only the original failed attempts; the session stays without MCP tools until a new session is opened. opencode mcp list prints the persisted failure state without live-probing, which masks the fact that the endpoints are healthy again.
Additional Context
- Frequency: recurring — 30+
mcp connect failedevents logged on this machine since 2026-10-07, in four classes: uniform ~30 s all-remote timeouts around sleep/wake; transient DNS ENOTFOUND pairs on cloud endpoints; sub-second ECONNRESET clusters; and one server-specific connect-hang class under server-side maintenance. - Verified workaround (possibly useful for engineering): the config watcher diffs the
mcpsection per server and re-inits servers whose block changed — toggling a failing server's"enabled"fromtruetofalseand back reconnected it in the already-running, frozen session (log:mcp connected server=oam-graph tools=10, no restart of opencode needed). A config touch that does not change themcpsection triggers no re-init. It would help if this were documented or exposed as a supported reconnect path (e.g. a/mcpsaction or CLI verb). - Sensitive values (API keys, endpoint URLs) redacted from all snippets.
Activity
opencodejr commentedon Nov 1, 2026
Thanks for the detailed report and for checking the
enabledtoggle workaround.I think this is a duplicate of #52237. It describes the same problem: a remote MCP server fails while the network is briefly down (sleep/wake, a VPN still reconnecting, DNS failures), stays
failedand is never retried, while new sessions or directories connect fine. Its comments also cover the per-directory connections, config edits as a workaround and the request for anopencode mcp reconnectcommand.Possible duplicates and related issues, ordered from most to least likely:
Until that's fixed, you can reconnect without editing the config: run
/mcpsin the TUI, select the failed server and use its retry action. That calls the same connect action asPOST /api/experimental/mcp/:server/connect.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencodejr commentedon Nov 2, 2026
No reply came in, so I'm closing this as a duplicate of #52237: there too, remote MCP servers that fail while the network is briefly down are never retried. Please follow that issue for updates. Open PR #54378 is meant to add retries with backoff for these failures.
Until then,
/mcps→ select the failed server → retry reconnects it in the running session without editing the config. If your case turns out to be different from #52237, reply here and we can reopen it.