GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcp: local server that needs a late-starting daemon (docker) stays failed for the whole session — add a reachability watchdog with backoff · Issue #64095 · anomalyco/opencode

mcp: local server that needs a late-starting daemon (docker) stays failed for the whole session — add a reachability watchdog with backoff #64095

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
mcp: local server that needs a late-starting daemon (docker) stays failed for the whole session — add a reachability watchdog with backoff#64095
Copy link
Labels
area/mcpMCP servers and toolsplatform/macosmacOStype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@kabirdkng
kabirdkng
opened on Nov 15, 2026
Issue body actions

Summary

A local stdio MCP server whose command depends on a daemon that finishes booting after OpenCode starts (canonical case: docker run … ghcr.io/github/github-mcp-server) loses the startup race, fails its single connect attempt, and then stays failed for the entire session. There is no retry, no re-probe of the dependency, and no CLI recovery path — even though the dependency answers docker info seconds later.

Requested fix: a reachability watchdog — failed servers get re-probed on a backoff schedule and are auto-connected once their dependency becomes reachable — plus optional per-server readyCheck / readyTimeout and opencode mcp reconnect [name].

Environment

  • opencode version: 2.3.0 (homebrew stable, /opt/homebrew/bin/opencode)
  • OS: macOS 26.6 (Darwin 25.6.0) arm64
  • Terminal: Ghostty, TERM=xterm-256color; shell /bin/zsh
  • Active plugins: one local .opencode/plugin/ file only (no MCP plugins)
  • MCP config:
"github": {
  "type": "local",
  "command": ["docker", "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"],
  "environment": { "GITHUB_PERSONAL_ACCESS_TOKEN": "{env:GITHUB_PERSONAL_ACCESS_TOKEN}" },
  "enabled": true
}

Reproduction

  1. Configure the server above (image already pulled: ghcr.io/github/github-mcp-server v2.0.2, stdio transport).
  2. Quit OpenCode. Make sure Docker Desktop is not up yet (it is a login item here, so on a cold boot it appears 20–60 s after the desktop session).
  3. Start OpenCode. github fails within the first second.
  4. ~25 s later Docker Desktop is ready: docker info succeeds and printf '<initialize>' | docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server answers on stdio.
  5. opencode mcp list keeps reporting the server as failed for as long as the service lives, and GitHub tools never appear in the session.
  6. Only rewriting the mcp block of opencode.json (or a service restart) recovers it.

Actual behaviour (v2.3.0 log excerpt)

# connect attempt — Docker socket does not exist yet
timestamp=2026-11-15T13:25:20.282Z level=WARN message="mcp transport error" server=github
  error="MCP server process exited with code 1: failed to connect to the docker API at unix:///Users/chainweb/.docker/run/docker.sock; check if the path is correct and if the daemon is running: dial unix /Users/chainweb/.docker/run/docker.sock: connect: no such file or directory"
timestamp=2026-11-15T13:25:20.283Z level=WARN message="mcp connect failed" server=github status.status=failed

# Docker Desktop finished launching 24 s later (process start 2026-11-15T13:25:44Z). Nothing retries.

# 2 h 22 m later: first successful connect — triggered only by an edit to the mcp config block
timestamp=2026-11-15T15:47:43.073Z level=INFO message="mcp connected" server=github tools=46 http.span=8544821

http.span=8544821 (ms) is the time between the failed attempt and the connect, i.e. the config rewrite rather than a retry. The same docker-socket failure appears on 2026-11-13 (twice) and 2026-11-15, so this is a recurring cold-boot pattern, not a one-off.

The three remote servers in the same config recovered across locations; only the local docker run server stayed wedged for the whole session.

Expected behaviour

A server whose dependency is currently unreachable should be treated as waiting, not terminal failed, and should connect automatically as soon as the dependency becomes reachable — with no config edit and no service restart.

Proposal

  1. Backoff retry for failed servers — reconnect attempts with exponential backoff (0.5s, 1s, 2s … 60s, then a 60 s steady poll bounded by a configurable retryWindow/attempts) instead of one attempt per location. Keep attempts strictly serial so this does not become the retry-storm class of bug (mcp: no-backoff resources/list retry storm wedges the service; new MCP connects stall #63876).
  2. Dependency probe (readyCheck) — let a local server declare how to detect that its dependency is up, so the client can skip doomed spawns and reconnect the moment it is ready:
"github": {
  "type": "local",
  "command": ["docker", "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"],
  "readyCheck": ["docker", "info", "--format", "{{.ServerVersion}}"],
  "readyTimeout": 300000,
  "retry": { "initialDelay": 500, "maxDelay": 60000, "attempts": 20 }
}
  1. Probe triggers — initial connect failure, config.updated, new session in a location, service restart, and (nice to have) system wake / network change, which would also cover the remote cases in mcp: remote MCP servers that fail once are never retried until service restart #52237 and mcp: remote server stays failed after system wake, retries stop after ~1.3s #62405.
  2. Status surface — opencode mcp list should distinguish waiting for dependency (probe failing) from failed (probe fine, server broken), and there should be a manual trigger: opencode mcp reconnect [name], or the TUI equivalent.
  3. Agent visibility — a configured-but-retrying server should be visible to the model as retrying so it cannot silently conclude "not configured" (mcp: failed servers are indistinguishable from unconfigured ones for the agent #62973).

Workaround used meanwhile

Make sure the dependency is up before OpenCode spawns MCP, e.g. with a launcher wrapper:

command -v docker >/dev/null && ! docker info >/dev/null 2>&1 && open -a Docker 2>/dev/null
for _ in $(seq 60); do docker info >/dev/null 2>&1 && break; sleep 1; done
exec opencode "$@"

Related

  • mcp: remote MCP servers that fail once are never retried until service restart #52237 — remote servers that fail once are never retried until service restart (open)
  • mcp: local server not restarted after transport error #53226 — local server not restarted after transport error (open)
  • mcp: failed servers are indistinguishable from unconfigured ones for the agent #62973 — failed servers are indistinguishable from unconfigured ones for the agent (open)
  • Can't disable an MCP server that failed or is stuck connecting #56451 — cannot disable an MCP server that failed or is stuck connecting (open)
  • closed duplicates with the same root cause: mcp: failed-at-init servers are never retried for the session lifetime #61105, mcp: remote server latched as failed after one transient DNS error (no retry/backoff) #62369, mcp: remote server stays failed after system wake, retries stop after ~1.3s #62405, mcp: local stdio servers exit(1) and never auto-reconnect on Windows #62841

I also prototyped the client-side workaround as a V2 plugin (ctx.mcp.list() poll + ctx.mcp.reload() once the dependency probes OK). Happy to upstream it, or to send a PR for the retry policy itself, if you can confirm the preferred shape (retry loop inside the location's MCP supervisor vs. a new readyCheck config field).

Additional finding: a plugin cannot work around this today

I tried to implement the watchdog as a V2 plugin, since ctx.mcp does expose the connection state:

const list = await ctx.mcp.list()
// { location: { directory }, data: [{ name: "github", status: { status: "failed", error: "…" } }] }

but there is no reconnect primitive:

  • ctx.mcp.reload() re-reconciles config and does not re-spawn a failed server — list() before/after a reload() with the dependency demonstrably reachable stays failed (verified on 2.3.0, probe:failed → probe:failed).
  • The documented lifecycle lever (ctx.mcp.transform(editor => editor.update(name, s => { s.disabled = true })) + reload() + re-enable + reload()) is the only other option, and it is a config-level disable/enable rather than a connection retry.
  • The HTTP client routes (/mcp/{name}/connect) are not reachable from the plugin context, and opencode mcp exposes no reconnect/retry subcommand.

So the only client-side mitigation available to users today is to make sure the dependency is up before OpenCode starts (launcher wrapper in the workaround above). A retry loop or a plugin-callable ctx.mcp.connect(name) would unblock this properly.

Activity

  1. kabirdkng
    changed the title [-]probe[/-] [+]mcp: local server that needs a late-starting daemon (docker) stays failed for the whole session — add a reachability watchdog with backoff[/+] on Nov 15, 2026
  2. opencodejr commented on Nov 15, 2026

    @opencodejr
    opencodejrBot
    on Nov 15, 2026
    Contributor
    More actions

    Thanks for the very thorough report. The timeline with the http.span value and the wrapper workaround make the cold-boot race easy to follow.

    I think this is a duplicate of #52237. That issue covers the same gap: once an MCP server's connect attempt fails, it stays failed and nothing retries it until the config changes or the service restarts. Its title says remote servers, but the comments include local stdio servers that failed at startup and never recovered. The fixes requested there match yours: backoff retry, retry on new sessions or wake, and a manual reconnect command.

    Possible duplicates and related issues, ordered by likelihood:

    • mcp: remote MCP servers that fail once are never retried until service restart #52237: the same problem. A server that fails once is never retried.
    • mcp: remote server stays failed after system wake, retries stop after ~1.3s #62405: closed as a duplicate of mcp: remote MCP servers that fail once are never retried until service restart #52237. It is the same pattern triggered by DNS being down after wake. The pull requests fix(mcp): recover remote servers without unnecessary sign-in #61762 and fix(mcp): reconnect dropped servers with backoff #54378 linked there aim to add recovery with backoff.
    • mcp: local server not restarted after transport error #53226: related. A local server that is not restarted after its process exits while connected.

    I'm closing this issue now as a duplicate of #52237. Please add your details there: the Docker Desktop timing, the readyCheck / readyTimeout proposal and the plugin you prototyped would all help whoever designs the retry policy. If you think your problem is different, reply here and the issue will be reopened.

    Until then, you can reconnect the failed server from /mcps in the TUI without restarting the service.

  3. opencodejr
    closed this as a duplicateof mcp: remote MCP servers that fail once are never retried until service restart #52237 on Nov 15, 2026
  4. opencodejr
    added
    area/mcpMCP servers and tools
    platform/macosmacOS
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mcpMCP servers and toolsplatform/macosmacOStype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.