I killed an opencode MCP server in the middle of a call six times on 2.4.5, and six times the very next call started a fresh process and got an answer. On 2.4.4 with its default settings the same sequence got an answer from the server zero times in three. Every call after the crash said MCP server "pingsrv" is not connected. Switch the flag OPENCODE_FLAGS=mcp_resilience on and 2.4.4 reconnects too, four runs of four that reached the third call.
My verdict: upgrade to 2.4.5 if any opencode MCP server of yours can die, or set that flag on 2.4.4 until you do, and then fix the two things that still bite in a script. A run that names no model can land on a free hosted one after a failed run, and a call that dies in flight is lost, not replayed, while the job exits 0.

What is opencode for?
opencode is an MIT-licensed coding agent for the terminal: you give it a sentence, it reads the folder, edits files and runs shell commands. The anomalyco/opencode repository showed 231,093 stars on the GitHub API at 05:05 UTC on 5 December 2026. Claude Code sits at 158,146 on the same read, and Codex CLI, yesterday’s post, at 137,349.
The release is v2.4.5, tagged at 23:55 UTC on 4 December. Its first highlight reads: “When an MCP server drops, its tools stay available and reconnect on the next call.” The work is in pull request 67926, and it removes the old mcp_resilience flag by making its behaviour the default. In 2.4.4 that flag is listed in flag.ts as “Keep MCP tools available through dropped connections and reconnect on demand”, and releases ship it off.
An MCP server is a small program that hands your agent extra tools, a database or a browser. It is a separate process, and processes die. Before 2.4.5, with the flag off, a dead server stayed dead until a person opened the /mcps screen, and a headless opencode run has no person. It is the command I used on 3 December for permissions in scripted runs.
How do you set up an opencode MCP server that reconnects?
Install the release into a local folder, with Node 22 and nothing global:
$ npm i --prefix ./npm @opencode/cli@2.4.5
$ ./npm/node_modules/.bin/opencode --version
opencode v2.4.5
The model key is an environment variable, OPENAI_API_KEY here. To get the reconnect on 2.4.4, set OPENCODE_FLAGS=mcp_resilience in the shell, or "experimental": { "mcp_resilience": true } in opencode.json. The opencode MCP server goes in opencode.json at the project root, as described on the MCP servers page. Mine is a local server, started by a command:
{
"$schema": "https://opencode.ai/config.json",
"model": "openai/gpt-5.4-mini",
"mcp": {
"pingsrv": { "type": "local", "command": ["python3", "/tmp/w5/srv/pingsrv.py"], "enabled": true }
}
}
The one line that matters is "model". The models page says to set model in opencode.json to choose the default for new work, and the next section shows what happens without it.
The server is fifteen lines of Python on the MCP SDK 1.30.0, with two tools. ping returns its own process id, so I can see whether an answer came from the old process or a new one. crash calls os._exit(3) and never replies. Every run got a fresh git folder and stdin from /dev/null.
What goes wrong with opencode in a script?
Two things, and neither is the crash itself.
A failed run changes which model the next run uses
You write opencode run "do the thing" in a nightly job, with no -m, because the key is in the environment. I tested what the default is. Two good runs first, one with -m openai/gpt-5.4-mini and one with -m openai/gpt-5.2, then a third opencode run with no -m. On 2.4.5 it used gpt-5.2, the model of the run before it, three of three. On 2.4.4 it used the free subq-savant-1.4-free, three of three. Carrying the last model forward is a 2.4.5 change, from pull request 68099.
Then I made one typo. A run with -m openai/gpt-5.4-nano failed with Model unavailable: openai/gpt-5.4-nano and exit 1, which a job would notice. The next run, with no -m, printed > build · tinsel-alpha-free in the morning runs and > build · subq-savant-1.4-free in the later ones, and answered. Three of three on each version in the later runs, six of six in the morning.
Both are free hosted models. The Zen page says of the first: “Not used for model training. Data is retained for 30 days.” Of the second: “Not used for model training, but requests are retained and may be reviewed by the provider to detect misuse.” Your prompt and the files the agent reads went to a provider you never chose, because a previous run failed.
The switch the Zen page documents, OPENCODE_DISABLE_FREE_MODELS=1, changed nothing when set in the shell: still tinsel-alpha-free, six of six. With --standalone, which runs a private server instead of the background one, the model became gpt-6-astra-healthcare, three of three, a name I never typed either. The fix was the line from the setup section. With "model": "openai/gpt-5.4-mini" in opencode.json, the run after the typo used gpt-5.4-mini, three of three.
The call that was in flight is lost, and the job still exits 0
The fix for reconnecting is real. The call that was running when the server died is still gone. The agent gets MCP tool "crash" on server "pingsrv" failed: Connection closed: MCP server process exited with code 3, and nothing replays the call on the new process.
Mettons the dying tool does its work first. My charge tool appends a line to a ledger file and, for an amount of 99, exits before it replies. I asked for one call with 99. The ledger held one line, six of six, three on each version, so a failed call is not sent twice. Every one of those runs exited 0.
A half-done write and a green job live together. Give the tool an idempotency key, so a retry can ask “did charge 99 land?”, and read the ledger, not the exit code.
One limit is the tool’s own: the reconnect fires on the next call, not before it, so the call that meets the crash always fails.
What did I actually run?
All of it on 5 December 2026 between 05:08 and 07:30 UTC, in a Linux container with Node 22.23.5, both versions installed side by side, model openai/gpt-5.4-mini unless a row says otherwise.
| Test | Version | Result |
|---|---|---|
| ping, crash, ping on a local server, default settings | 2.4.4 | is not connected 3 of 3, 1 launch |
the same with OPENCODE_FLAGS=mcp_resilience | 2.4.4 | new pid answered, 4 of 4 |
| the same | 2.4.5 | new pid answered, 3 of 3 |
charge 99, a tool that dies after writing | both | 1 ledger line, exit 0, 3 of 3 |
two good runs, then no -m | 2.4.4 / 2.4.5 | subq-savant-1.4-free / gpt-5.2, 3 of 3 each |
good run, a typo run, then no -m | both | a free hosted model, 3 of 3 on each |
the same with "model" in opencode.json | 2.4.5 | gpt-5.4-mini, 3 of 3 |
The capture at the top of this post is runs A_2, B_2 and C_1, each started with this command, trimmed:
$ opencode run -m openai/gpt-5.4-mini "Call the pingsrv tool ping, then the pingsrv tool crash, then the pingsrv tool ping again, in that order. Report each result or error on its own line."
2.4.5 3 {"result":"pong from pid 828"} (call 1 answered by pid 671)
2.4.4 3 ERROR: MCP server "pingsrv" is not connected: Connection closed: MCP server process exited with code 3
2.4.4 + the flag 3 pong from pid 446 (call 1 answered by pid 307)
That is the prompt as sent; the wording changes what the agent does.
Would I run it? On 2.4.5, yes, for any job that leans on an opencode MCP server I do not control, with "model" written in opencode.json and the ledger read after the run. Bon. On 2.4.4, only with the flag set: by default one crash ends the tool for the rest of the run.