Repository navigation
Description
Summary
Three related problems with MCP timeout configuration in opencode 2.2.5:
- The documented default is wrong. The published schema says
5000ms. The bundled MCP client uses a 30000 ms startup deadline. - A per-server scalar
timeoutsilently rewrites the execution window."timeout": 60000is normalized to{startup: 60000, catalog: 60000, execution: 60000}— it lowers the 12 h execution budget to 60 s. The schema does not mention that the scalar is broadcast to all three phases. - The per-server object form is dropped, taking the whole server with it (same class of bug as mcp: server entries with a "timeout" field are silently dropped from the normalized config #50807, still present in 2.2.5), even though an object is accepted one level up at
mcp.timeout.
Net effect for a user who reads the schema to fix intermittent Request timed out on a slow local MCP: wrong default, silently truncated execution budget, and — if they try the object form — a server that disappears from the config.
Environment
- opencode
2.2.5(channel=latest), macOS darwin, packaged binary - schema:
https://opencode.ai/config.json
Evidence
1. Documented default vs. actual constant
Schema ($defs.McpLocalConfig.properties.timeout and $defs.McpRemoteConfig.properties.timeout):
Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified.
Bundled client in 2.2.5 (strings on the binary):
var J=30000,pe=30000,ue=43200000,fe=600000,K=1000,
...
C.connect(e,{timeout:U?.startup??J})Startup 30 s, catalog 30 s, execution 12 h, attached execution 10 min.
Behavioral check — a local MCP server that answers initialize only after 10 s connects successfully, which is impossible under a 5 s default:
level=INFO message="mcp connected" server=slowdemo10 tools=0 http.span=12892
2. Scalar timeout is broadcast to startup + catalog + execution
opencode debug config with a local server carrying "timeout": 60000:
"slow": {
"type": "local",
"command": ["/bin/true"],
"disabled": false,
"timeout": { "startup": 60000, "catalog": 60000, "execution": 60000 }
}Same normalization on a real entry:
"playwright": { ..., "timeout": { "startup": 60000, "catalog": 60000, "execution": 60000 } }The default execution budget is 43200000 (12 h), so raising the startup budget the documented way caps long-running tool calls at 60 s.
3. Per-server object form drops the server
Config:
{
"mcp": {
"s": {
"type": "local",
"command": ["/bin/true"],
"timeout": { "startup": 60000, "catalog": 60000, "execution": 43200000 }
}
}
}opencode debug config output for that source:
temp source mcp = undefined
Only a log line, nothing on stdout:
level=WARN message="configuration normalization diagnostic" source=<config>
path=$.mcp.s kind=invalid action="skipped malformed recognized value"
Workaround that does work
Use the global object instead of a per-server scalar:
{
"mcp": {
"timeout": { "startup": 60000, "catalog": 60000, "execution": 43200000 },
"slow": { "type": "local", "command": ["..."] }
}
}Verified — a local MCP answering after 35 s connects (http.span=36951) with startup: 60000, and fails under the default 30 s.
Expected behavior
- Schema docstring and the constant should agree (30 s looks intentional; the docstring was likely never updated).
- Document that a per-server scalar
timeoutsetsstartupandcatalogandexecution. - Either accept the object form per server, or reject it with a warning that keeps the server configured instead of deleting it (regression of mcp: server entries with a "timeout" field are silently dropped from the normalized config #50807).
References
- Documentation for MCP timeout configuration doesn't match schema #23648 — same doc/schema mismatch report, auto-closed after 60 days without verification
- mcp: server entries with a "timeout" field are silently dropped from the normalized config #50807 —
timeoutfield silently removing the whole MCP server entry (2.0.13) - [FEATURE] Official MCP warm-up / pre-spawn mechanism (+ reconnect path) — all local MCPs marked failed at session start when many cold-start concurrently #48743 — local MCP cold-start race at session start
Activity
opencodejr commentedon Nov 10, 2026
Thanks for the detailed report. I reproduced this on 2.2.5, and it still happens on the latest
dev(98e4b53). There, I checked by running the config normalizer directly, because the CLI from source wouldn't start in my sandbox.timeouttext inhttps://opencode.ai/config.json(McpLocalConfig/McpRemoteConfig) still says "Defaults to 5000 (5 seconds)", but the client uses a 30 s startup default.timeouton a server directly undermcp: the entire server disappears fromopencode debug config. The only trace is theskipped malformed recognized valuewarning in the log file. The same object undermcp.servers.<name>.timeoutis kept, so that form, or the globalmcp.timeoutobject you found, works as a workaround. This matches the mechanism in config: V2 silently ignores MCP servers defined directly undermcpinstead ofmcp.servers#56602.timeout: setting all three phases (startup, catalog, execution) from a scalar is intentional. It keeps V1-style configs compatible (fix(core): accept numeric MCP timeouts #55851). But the schema doesn't say so, which is part of the docs problem.The script below runs
opencode debug configon the three config shapes.Related: #56602, #50807 / #54184 (fixed by #55851), #23648.
Reproduction script (repro.sh)
Run it:
bash repro.shccclucky commentedon Nov 10, 2026
I'll take the config behavior part of this: keep a flat
mcp.<name>server whosetimeoutuses the object form instead of dropping the whole entry.normalizeMcpdecodes flat entries with the V1 schema, wheretimeoutis a number, so an object there fails the decode and the server disappears with only a log warning. I'll read such an entry as a current server (mapping V1enabledtodisabled), mirroring the tolerance that already exists in the other direction —expandServerTimeoutsaccepts a bare number undermcp.servers.<name>so one V1-shaped field does not drop the server — and add regression tests inpackages/core/test/config/normalization.test.ts.The wrong
5000default text lives in the frozen V1 schema definitions that the publishedconfig.jsonstill serves for the deprecated flat form, so that is a separate docs change; I'll keep this PR to the normalization behavior unless you would rather see both together.ccclucky commentedon Nov 11, 2026
#63166 now covers the config part I said I would take (accepting the per-server object form plus the corrected documented default), so I will not duplicate it. Leaving that half to #63166 and stepping back unless a maintainer wants the behaviour split out.