Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/opencode/src/mcp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,13 @@ export namespace MCP {
} catch (error) {
lastError = error instanceof Error ? error : new Error(String(error))

const msg = lastError.message.toLowerCase()
const looksLikeAuthFailure =
error instanceof UnauthorizedError ||
(name === "StreamableHTTP" && !oauthDisabled && (msg.includes("401") || msg.includes("unauthorized")))

// Handle OAuth-specific errors
if (error instanceof UnauthorizedError) {
if (looksLikeAuthFailure) {
log.info("mcp server requires authentication", { key, transport: name })

// Check if this is a "needs registration" error
Expand Down
Loading