Skip to content

mcp auth returns "Unexpected status: disabled" after successful OAuth on enabled:false servers #33915

Description

@MaxAnderson95

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

  1. Add a remote MCP server with OAuth and "enabled": false in opencode.json
  2. Run opencode mcp auth <name> and complete the browser OAuth
  3. CLI prints Unexpected status: disabled instead of Authentication successful!

Operating System

macOS (Apple Silicon)

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions