Description
Running opencode mcp auth <name> on a remote MCP server prints Unexpected status: disabled even though the OAuth flow completes fine. The token gets saved, but the CLI reports failure and the server doesn't connect for that run.
It only happens when the server is "enabled": false in the config, which is how I keep MCP servers parked until I actually need one in order to save on context window usage.
The cause is in finishAuth (packages/opencode/src/mcp/index.ts): after OAuth succeeds it calls createAndStore(mcpName, mcpConfig) with the raw config, so enabled: false makes create() short-circuit to { status: "disabled" }. The CLI handler has no case for disabled, so it falls through to "Unexpected status". connect() already avoids this by passing { ...mcp, enabled: true } — finishAuth just needs to do the same.
Same bug and fix were reported in #20278 / PR #20279, but that PR was closed unmerged and the Effect refactor (#19042) carried it forward, so it's still on dev.
OpenCode version
1.17.11
Steps to reproduce
- Add a remote MCP server with OAuth and
"enabled": false in opencode.json
- Run
opencode mcp auth <name> and complete the browser OAuth
- CLI prints
Unexpected status: disabled instead of Authentication successful!
Operating System
macOS (Apple Silicon)
Terminal
Ghostty
Description
Running
opencode mcp auth <name>on a remote MCP server printsUnexpected status: disabledeven though the OAuth flow completes fine. The token gets saved, but the CLI reports failure and the server doesn't connect for that run.It only happens when the server is
"enabled": falsein the config, which is how I keep MCP servers parked until I actually need one in order to save on context window usage.The cause is in
finishAuth(packages/opencode/src/mcp/index.ts): after OAuth succeeds it callscreateAndStore(mcpName, mcpConfig)with the raw config, soenabled: falsemakescreate()short-circuit to{ status: "disabled" }. The CLI handler has no case fordisabled, so it falls through to "Unexpected status".connect()already avoids this by passing{ ...mcp, enabled: true }—finishAuthjust needs to do the same.Same bug and fix were reported in #20278 / PR #20279, but that PR was closed unmerged and the Effect refactor (#19042) carried it forward, so it's still on
dev.OpenCode version
1.17.11
Steps to reproduce
"enabled": falsein opencode.jsonopencode mcp auth <name>and complete the browser OAuthUnexpected status: disabledinstead ofAuthentication successful!Operating System
macOS (Apple Silicon)
Terminal
Ghostty