GeezerVison is showing github.com — config: V2 silently ignores MCP servers defined directly under `mcp` instead of `mcp.servers` · Issue #56602 · anomalyco/opencode
config: V2 silently ignores MCP servers defined directly under mcp instead of mcp.servers #56602DescriptionSummary
V2 config silently ignores an MCP server placed directly under mcp instead of mcp.servers, with no warning. opencode mcp list reports "No MCP servers configured" while the config file clearly contains one, so a broken integration looks like a working config.
Environment
- opencode version: 2.0.32
- OS: Windows_NT 10.0.26300 (win32 x64)
- Terminal: desktop app (OpenCode.exe) +
opencode-cli.exe
- Shell: n/a (desktop app)
- Install/channel: latest (desktop,
@opencodedesktop)
- Active plugins: none configured
Reproduction
- Put an MCP server under
mcp (the V1 shape):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"roam": {
"type": "local",
"command": ["node", "/path/to/server.mjs", "serve"]
}
}
}
- Restart OpenCode (or restart the service).
- Run
opencode mcp list.
Expected Behavior
Either the server connects, or OpenCode tells me the key is wrong — for example a warning that mcp.roam is not a recognised shape and that V2 expects mcp.servers.roam. The V1-to-V2 migration guide notes V1 config files "are intended to remain compatible", so silently dropping an entire server definition leaves the user with a config file that looks correct and a tool that has been unavailable for weeks.
Actual Behavior
No error, no warning, no migration hint:
$ opencode mcp list
No MCP servers configured
The agent simply has no tools from that server. In my case this went unnoticed for a long time because the missing tool's absence looked like the agent choosing a different approach, rather than a config mistake.
For contrast, moving the identical block one level deeper made it appear immediately:
"mcp": { "servers": { "roam": { "type": "local", "command": [...] } } }
Additional Context
- Reproducible every time; 100% deterministic.
- Worth considering: when an object key sits directly under
mcp and is not servers/timeout, log a warning naming the key and the expected mcp.servers.<name> path. A one-line warning at config load would have saved hours here.
- Related:
opencode mcp list returning "No MCP servers configured" while a config file visibly contains an mcp block could echo which files were loaded, which would also help when config is present but ignored for other reasons.
Activityopencode-agent commented on Oct 18, 2026 Thanks for the detailed report. I tried this on 2.0.32 (Linux, CLI with the background service) using your flat config, mcp: { roam: { type: "local", command: [...] } }, pointed at a minimal stdio MCP server. I couldn't reproduce the server being ignored:
opencode debug config shows the flat entry migrated to mcp.servers.roam, so V2 does read the V1 shape.
- Right after
opencode service restart, the first opencode mcp list printed No MCP servers configured. Running it again a couple of seconds later printed ✓ roam connected.
- I saw the same pattern with the
mcp.servers.roam shape: an empty first result after a restart, then connected.
So the empty list probably comes from a race right after the service starts, not from the config shape. These look related, ordered by likelihood:
Could you check whether that matches what you see? With the flat shape back in place:
- Restart the service, then run
opencode mcp list two or three times, a few seconds apart.
- Run
opencode debug config and paste the output. It shows which config files were loaded and whether roam ended up under mcp.servers.
- Say which file the config is in (global
~/.config/opencode/opencode.json or a project opencode.json) and whether you start the service from the desktop app or from opencode-cli.exe.
If it stays empty on repeated calls on Windows, that output will help narrow it down.
DeepxD-code commented on Oct 18, 2026 Fix pushed in PR #55231 (branch truncated-diff-patches-v2, commit 233fa69).
Root cause: normalizeMcp tried V1 decode for keys other than servers/timeout. A V2-only shape (e.g. timeout as an object, or disabled instead of enabled) failed V1 decode and was silently dropped with no diagnostic.
Fix: try V1 first with a temp diagnostics array; on failure try ConfigMCP.Server (V2) before surfacing any diagnostic. Adds a regression test using timeout-as-object (V2-only shape that fails V1 PositiveInt decode).
Verified: normalization.test.ts 37/37 green, tsc clean on core+schema. opencode-agent commented on Oct 18, 2026 Thanks for the report. V2 does read servers placed directly under mcp (the V1 shape) and migrates them to mcp.servers. With your config, the server was only missing from the first opencode mcp list right after a service restart. That timing issue is tracked in #54192, so we're closing this as a duplicate. opencode-agent commented on Oct 21, 2026 I'm closing this for now since we haven't heard back. On 2.0.32, a flat mcp.roam entry was migrated to mcp.servers.roam and connected. The only No MCP servers configured I got was on the first opencode mcp list right after a service restart, and it happened with both config shapes. That matches the startup race in #54192, which has a proposed fix in #54191.
If the server still doesn't show up when you run opencode mcp list several times after a restart, please reply here or open a new issue. Include the output of opencode debug config, the path of the config file, and whether the service was started by the desktop app or by opencode-cli.exe. If it's a persistent problem on Windows, #50710 may be the issue. Thanks for the detailed report!
neriousy commented on Nov 19, 2026 I re-checked this after the earlier automatic close was reverted. V2 does migrate a server placed directly under mcp to mcp.servers, so the config shape isn't the cause; a service that keeps reporting No MCP servers configured for a correct config is the problem tracked in #50710, so I'm closing this in favor of that issue. A missing warning for invalid MCP entries is a fair separate request if you want to open one.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|