Skip to content
Open
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
8 changes: 7 additions & 1 deletion packages/opencode/src/mcp/oauth-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ export async function ensureRunning(redirectUri?: string): Promise<void> {

const running = await isPortInUse(port)
if (running) {
return
// Cannot reuse: the other listener may not be opencode, and OAuth
// callbacks landing there surface as a misleading CSRF error.
throw new Error(
`OAuth callback port ${port} is already in use. ` +
`Set "oauth.callbackPort" (or "oauth.redirectUri") on the MCP server ` +
`entry in your opencode config to use a different port.`,
)
}

currentPort = port
Expand Down
Loading