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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions