Repository navigation
Description
Summary
After upgrading from v1 (1.18.x) to v2 (2.0.28), a remote MCP server with OAuth credentials stored in the v1 mcp-auth.json file shows needs authentication in opencode mcp list, even though the stored tokens are valid. V2 appears to never read the v1 flat-file store.
Environment
- opencode version: 2.0.28 (channel
latest, release build,local=false); last working version: 1.18.35 - OS: Linux 7.2.5-3-omarchy (linux x64)
- Terminal: TERM=xterm-256color, COLORTERM=truecolor
- Shell: /usr/bin/zsh
- Install/channel: mise (
npm:@opencode/cli/aqua:anomalyco/opencodebackends observed), release channellatest - Active plugins: none found in config
Reproduction
- On v1 (1.18.35), configure a remote MCP server with an
oauthblock and complete login so~/.local/share/opencode/mcp-auth.jsoncontains a valid entry:{ "imanage-work": { "tokens": { "accessToken": "...", "refreshToken": "...", "expiresAt": ..., "scope": "..." }, "clientInfo": { "clientId": "...", "clientSecret": "..." }, "serverUrl": "https://..." } } - Verify
opencode mcp listshows✓ imanage-work connected (OAuth)on v1, and that the access token works (directtools/callagainst the MCP endpoint succeeds). - Upgrade to v2 (2.0.28) with the same config and the same
mcp-auth.jsonin place. - Run
opencode mcp list.
Expected Behavior
Per the V1 migration guide, supported V1 functionality should keep working in V2. The valid stored OAuth credentials should be honored (or migrated), and the server should show connected.
Actual Behavior
V2 reports ⚠ imanage-work needs authentication. There are zero references to mcp-auth.json in the v2 codebase (verified via code search), while v2's MCP layer stores OAuth state through the Credential service instead (packages/core/src/mcp/index.ts — "the credential lives in the global store"; packages/core/src/mcp/oauth.ts Store abstraction backed by Credential). So v1 credentials are silently orphaned with no migration path and no warning pointing at the new store.
Additional Context
- Consistently reproducible: v1 binary against the same files →
connected (OAuth); v2 →needs authentication. Token validity confirmed independently of either CLI. - Config uses the V1
mcp.<name>shape with camelCaseoauth.clientId/clientSecret/scope/redirectUri, which V2 is documented to normalize, so the failure is in credential lookup, not config parsing. - Workaround: pin to
[email protected](e.g. via miseversion = "1.18"), which tracks 1.18.x patches while holding back the v2 breaking change. - Suggestion: on startup, detect a non-empty v1
mcp-auth.jsonwith no corresponding v2 credential and either import it or emit a warning telling the user to re-runopencode mcp auth <name>.
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the detailed report. I think this is a duplicate of #54879, which reports the same thing: V2 doesn't import the OAuth tokens V1 stored in
mcp-auth.json, so remote MCP servers showneeds authenticationafter the upgrade.Possible duplicates and related issues, ordered by likelihood:
dev. Other users have confirmed it on 2.0.28 and 2.0.29.mcp-auth.jsoncredentials during migration. It is linked to migrate-v1: remote MCP OAuth tokens (mcp-auth.json) are not migrated; every OAuth remote server needs re-auth after upgrade #54879.Until that's resolved, running
opencode mcp auth <name>on V2 to sign in again should store a V2 credential for the server.This issue will be closed as a duplicate in 1 day unless you reply explaining how your problem is different. Please add any further details to #54879.
opencode-agent commentedon Oct 17, 2026
We haven't heard back since the duplicate notice, so I'm closing this as a duplicate of #54879. That issue covers the same problem: V2 doesn't import V1's
mcp-auth.jsonOAuth credentials, so remote MCP servers showneeds authenticationafter upgrading. PR #55197 adds the import during migration.Please follow #54879 for updates, and add any further details there. Until it's resolved, running
opencode mcp auth <name>on V2 should sign you in again. If your problem turns out to be different, reply here and we can reopen.