Skip to content

fix(mcp): mcp auth returns disabled instead of connected after OAuth#20279

Closed
Ayushlm10 wants to merge 2 commits into
anomalyco:devfrom
Ayushlm10:fix/mcp-auth-disabled-after-oauth
Closed

fix(mcp): mcp auth returns disabled instead of connected after OAuth#20279
Ayushlm10 wants to merge 2 commits into
anomalyco:devfrom
Ayushlm10:fix/mcp-auth-disabled-after-oauth

Conversation

@Ayushlm10

@Ayushlm10 Ayushlm10 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #20278

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

After completing OAuth for a remote MCP server, opencode mcp auth <name> shows "Unexpected status: disabled" even though auth succeeded.

The problem is in finishAuth — it calls createAndStore(mcpName, mcpConfig) with the raw config from getMcpConfig(). If enabled is false (e.g. server was previously disconnected), create() short-circuits and returns { status: "disabled" } without reconnecting.

The fix passes { ...mcpConfig, enabled: true } to createAndStore, which is the same pattern connect() already uses on line 601.

How did you verify your code works?

  1. Configured a remote MCP server with OAuth
  2. Ran bun run dev -- mcp auth <server-name> before the fix — got "Unexpected status: disabled"
  3. Applied the fix, ran again — got "Authentication successful!"

Screenshots / recordings

N/A — CLI output change only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

After successful OAuth, finishAuth called createAndStore with the raw
config which may have enabled=false (e.g. server was previously
disconnected). This caused create() to short-circuit and return
status disabled instead of reconnecting.

Pass { ...mcpConfig, enabled: true } to match what connect() already
does.

Fixes anomalyco#20278
@github-actions github-actions Bot added contributor needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants