Repository navigation
mcp: Windows service registers zero MCP servers from global config #50710
Description
Activity
Additional repro data (Windows, opencode v2.0.12) — same symptoms confirmed on opencode v2.0.12 (npm @opencode/cli), extending the affected range below your 2.0.14. Extra findings beyond the OP:
- Project-level configs fail too, not just global. Minimal temp project dir with a single server (
opencode.jsonat cwd) →mcp liststill printsNo MCP servers configured, for both V1-flat (mcp: {name: {...}}) and V2-native (mcp: {servers: {...}}) shapes. mcp add's own output is invisible.opencode mcp add <name> -- <cmd>writes a valid V2 entry to the project config (file contents verified) and the immediately followingmcp liststill reports zero. So content, authoring, normalization flags, and V1-vs-V2 shape are all ruled out — every path lands on an empty resolved view.debug configis healthy in every case: the document layer shows all servers converted undermcp.servers(e.g.{"type":"local","command":[...],"disabled":true}), while the runtime consumers (configuredServersincli/cmd/mcp.ts,MCP.status()inmcp/index.ts,GET /api/mcp) see nothing. Resolved-view shape is not externally observable — it is either still nested ({servers}iterated as a flat map yields one non-typekey) or themcpkey is dropped entirely during merge; both produce identical symptoms.- TUI impact: the MCP dialog (fed by the
mcp.status()sync) renders an empty list with the same payload, so the MCP picker/toggle UI is unusable on Windows as well — this was the user-visible symptom that started the investigation here. - Release-window analysis: path-filtered commit history on both
devand thev2release branch shows no commits since 2026-09-19 touchingpackages/opencode/src/mcp/index.ts,packages/opencode/src/cli/cmd/mcp.ts,packages/opencode/src/config/config.ts, orpackages/opencode/src/config/v2-compat.ts→ 2.0.15/2.0.16 almost certainly still carry this.
Windows-specific hypothesis worth checking: the resolved config may be stored/looked up under a location key with mismatched path normalization (e.g. C:\Users\... from the location layer vs C:/Users/... from path.win32 APIs, or drive-letter casing). A map lookup miss would yield an empty/undefined config exactly for the runtime consumers while documents (read per file path) stay correct — and on Linux the two key forms coincide, which would explain the cross-OS contrast in the OP.
Environment: Windows, isolated v2.0.12 alongside v1.18.32, shared ~/.config/opencode/opencode.json.
This is not Windows-specific. Reproducing the same symptom set on macOS 27.0 (Apple Silicon), opencode v2.0.22, which contradicts the "same config shape on Linux lists and connects the servers normally" scoping in the report.
Identical signature to yours:
opencode debug configreports the MCP servers correctly — both of mine appear undermcp, normalised, withdisabled: false.opencode mcp listprintsNo MCP servers configured.- Providers defined in the same file resolve fine; a custom OpenAI-compatible provider in that config works, so the file is being read.
- The running agent has zero MCP tools. Asked directly, it answers that the only tools it can call are the
tools.opencode.*namespace ones (list_mcp_resources,models,read_mcp_resource,session_move,session_rename), andtools.opencode.list_mcp_resources({})returns nothing.
Two extra data points that may help narrow it:
- Transport makes no difference. One of my two servers is remote HTTP (
{"type":"remote","url":"http://127.0.0.1:…/mcp"}), the other local stdio ({"type":"local","command":[...]}). Neither reaches the agent. The HTTP one is independently confirmed healthy — other clients on the same machine connect to it and call its tools right now. - Config shape makes no difference either. I tried both the flat
mcp.<name>form and the nestedmcp.servers.<name>form thatopencode mcp add --globalwrites (see MCP: invalid location of mcp when used --global #49904), with an agent run after each. Zero tools either way. So this is not the--globalwrite-location issue wearing a disguise.
One suggestion on diagnosis, from the outside: debug config and mcp list disagreeing is itself the most useful signal here, and it points at the gap between parsing the config and the service registering from it. I had initially written mcp list off as the unreliable one and debug config as ground truth — testing at the agent level showed the opposite, that mcp list accurately reports what the runtime holds while debug config only echoes the parsed file. If that framing is right, anyone trusting debug config will believe their MCP setup works when no tool is reachable, which is a quiet way to lose a feature.
Happy to run anything specific against this install — it reproduces every time, no intermittency here.
Summary
On Windows, OpenCode 2.0.14 loads the global config from the expected location — providers defined in the same file resolve and
opencode debug configreports the MCP servers correctly — but the running service registers zero MCP servers.opencode mcp listprintsNo MCP servers configured, andGET /api/mcpreturns an emptydataarray for the location. The same config shape on Linux lists and connects the servers normally, so this looks Windows-specific. It is not caused by config content: it reproduces with a 266-byte minimal config containing exactly one MCP server.Environment
opencode v2.0.14)opencode mcp listC:\WINDOWS\system32\cmd.exe)@opencode/[email protected]toC:\Users\<user>\.opencode\bin\opencode.exe(the documented Windows path, since Windows package managers are unsupported)Reproduction
On Windows, install 2.0.14 and write a minimal global config at
C:\Users\<user>\.config\opencode\opencode.json:{ "$schema": "https://opencode.ai/config.json", "mcp": { "filesystem": { "type": "local", "command": [ "C:\\Program Files\\nodejs\\node.exe", "C:\\Users\\<user>\\AppData\\Roaming\\npm\\node_modules\\@modelcontextprotocol\\server-filesystem\\dist\\index.js", "C:\\Users\\<user>" ] } } }opencode service restartopencode mcp list→No MCP servers configuredopencode api get /api/mcp→{"location":{"directory":"C:\\Users\\<user>"},"data":[]}opencode debug config→ the same server IS present, under the normalizedmcp.servers, withdisabled: falseThe same outcome occurs with a 20-server real-world config (local
node/npxservers,uvxservers, and remote URL servers), and with the V1 flatmcpmap as well as withenabledflags removed.Expected Behavior
opencode mcp listlists each configured server with its connection status, andGET /api/mcpreturns them for the current location. On Linux, with an equivalent global config,opencode mcp listprints e.g.:Actual Behavior
On Windows the server catalog is empty:
No
mcp connectormcp connect failedlog lines are emitted at all on Windows, i.e. the service never attempts to start any configured server. There is no error to report — the servers are silently absent from the catalog.Additional Context
opencode modelsreturns 269 models, including providers defined in the sameopencode.json(llama-server,moonshot,claude-code,ollama-cloud). Onlymcpis missing.GET /api/mcpconfirms the service itself has no servers, so this is not just a CLI formatting bug.enabledflags — no difference.opencode debug pathsreportsconfig = C:\Users\<user>\.config\opencode, andopencode debug configlists that file as a loaded document with themcpkey normalized tomcp.servers.experimental.policies,enterprise, or provider-filter entries are present that could explain a hard deny.