Skip to content

Commit 805af91

Browse files
author
Shamil GHASEETA
committed
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 anomalyco#5444
1 parent 0f9ef84 commit 805af91

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • packages/opencode/src/cli/cmd

‎packages/opencode/src/cli/cmd/mcp.ts‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const McpListCommand = cmd({
4646

4747
for (const [name, serverConfig] of Object.entries(mcpServers)) {
4848
const status = statuses[name]
49-
const hasOAuth = serverConfig.type === "remote" && !!serverConfig.oauth
49+
const hasOAuth = await MCP.supportsOAuth(name)
5050
const hasStoredTokens = await MCP.hasStoredTokens(name)
5151

5252
let statusIcon: string
@@ -109,7 +109,12 @@ export const McpAuthCommand = cmd({
109109
const mcpServers = config.mcp ?? {}
110110

111111
// Get OAuth-enabled servers
112-
const oauthServers = Object.entries(mcpServers).filter(([_, cfg]) => cfg.type === "remote" && !!cfg.oauth)
112+
const oauthServers = []
113+
for (const [name, cfg] of Object.entries(mcpServers)) {
114+
if (await MCP.supportsOAuth(name)) {
115+
oauthServers.push([name, cfg])
116+
}
117+
}
113118

114119
if (oauthServers.length === 0) {
115120
prompts.log.warn("No OAuth-enabled MCP servers configured")
@@ -149,7 +154,7 @@ export const McpAuthCommand = cmd({
149154
return
150155
}
151156

152-
if (serverConfig.type !== "remote" || !serverConfig.oauth) {
157+
if (!(await MCP.supportsOAuth(serverName))) {
153158
prompts.log.error(`MCP server ${serverName} does not have OAuth configured`)
154159
prompts.outro("Done")
155160
return

0 commit comments

Comments
 (0)