From 805af914e897f435001a2140f2cecd228c2fe51b Mon Sep 17 00:00:00 2001 From: Shamil GHASEETA Date: Sun, 14 Dec 2025 23:13:47 +0100 Subject: [PATCH 1/2] fix: MCP OAuth auth commands now recognize remote servers as OAuth-enabled by default - Updated CLI checks to use MCP.supportsOAuth() instead of requiring explicit oauth config - Remote MCP servers now support OAuth authentication without needing 'oauth' in config - Fixes issue where 'opencode mcp auth' showed no OAuth servers for remote configs Closes #5444 --- packages/opencode/src/cli/cmd/mcp.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/cli/cmd/mcp.ts b/packages/opencode/src/cli/cmd/mcp.ts index 9ca4b3bff8b2..dd5e6df13e1a 100644 --- a/packages/opencode/src/cli/cmd/mcp.ts +++ b/packages/opencode/src/cli/cmd/mcp.ts @@ -46,7 +46,7 @@ export const McpListCommand = cmd({ for (const [name, serverConfig] of Object.entries(mcpServers)) { const status = statuses[name] - const hasOAuth = serverConfig.type === "remote" && !!serverConfig.oauth + const hasOAuth = await MCP.supportsOAuth(name) const hasStoredTokens = await MCP.hasStoredTokens(name) let statusIcon: string @@ -109,7 +109,12 @@ export const McpAuthCommand = cmd({ const mcpServers = config.mcp ?? {} // Get OAuth-enabled servers - const oauthServers = Object.entries(mcpServers).filter(([_, cfg]) => cfg.type === "remote" && !!cfg.oauth) + const oauthServers = [] + for (const [name, cfg] of Object.entries(mcpServers)) { + if (await MCP.supportsOAuth(name)) { + oauthServers.push([name, cfg]) + } + } if (oauthServers.length === 0) { prompts.log.warn("No OAuth-enabled MCP servers configured") @@ -149,7 +154,7 @@ export const McpAuthCommand = cmd({ return } - if (serverConfig.type !== "remote" || !serverConfig.oauth) { + if (!(await MCP.supportsOAuth(serverName))) { prompts.log.error(`MCP server ${serverName} does not have OAuth configured`) prompts.outro("Done") return From e6f064d94f105c0aca865e24ded3f421c30e3ded Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 20 Dec 2025 00:28:41 +0100 Subject: [PATCH 2/2] fix: add type annotation to oauthServers in McpAuthCommand --- packages/opencode/src/cli/cmd/mcp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/cli/cmd/mcp.ts b/packages/opencode/src/cli/cmd/mcp.ts index dd5e6df13e1a..a4c7f7c8c427 100644 --- a/packages/opencode/src/cli/cmd/mcp.ts +++ b/packages/opencode/src/cli/cmd/mcp.ts @@ -109,7 +109,7 @@ export const McpAuthCommand = cmd({ const mcpServers = config.mcp ?? {} // Get OAuth-enabled servers - const oauthServers = [] + const oauthServers: Array<[string, Config.Mcp]> = [] for (const [name, cfg] of Object.entries(mcpServers)) { if (await MCP.supportsOAuth(name)) { oauthServers.push([name, cfg])