Skip to content

fix(mcp): mcp auth returns "Unexpected status: disabled" after successful OAuth #20278

Description

@Ayushlm10

Bug

After completing OAuth for a remote MCP server, opencode mcp auth <name> shows:

┌  MCP OAuth Authentication
│
■  Unexpected status: disabled
│
└  Done

Even though the authentication itself succeeded.

Root Cause

In finishAuth (packages/opencode/src/mcp/index.ts), after OAuth completes successfully, createAndStore(mcpName, mcpConfig) is called with the raw config from getMcpConfig(). If the server has enabled: false (e.g. was previously disconnected), create() short-circuits and returns { status: "disabled" } without attempting to connect.

The authenticate CLI handler doesn't have a case for "disabled" status, so it falls through to the else branch printing "Unexpected status: disabled".

Fix

Pass { ...mcpConfig, enabled: true } to createAndStore in finishAuth, matching what connect() already does.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

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