You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MCP OAuth callback fails on Windows: callback server binds IPv6 but redirect URI uses 127.0.0.1 #31824
On Windows, opencode mcp auth <server> can fail after successful OAuth approval because the local callback server listens on IPv6, while the redirect URI uses IPv4.
Observed behaviour:
browser opens normally
OAuth approval succeeds in Keycloak / identity provider
browser is redirected to http://127.0.0.1:19876/mcp/oauth/callback?...
packages/opencode/src/mcp/oauth-callback.ts starts the callback server with:
server!.listen(currentPort,()=>{resolve()})
On Windows/Bun, this binds the callback server to :: / IPv6.
But the redirect URI generated by packages/opencode/src/mcp/oauth-provider.ts is:
http://127.0.0.1:19876/mcp/oauth/callback
So the browser redirects to IPv4 (127.0.0.1), while the server is listening on IPv6. On affected Windows machines, the IPv4 callback does not reach the IPv6 listener, and OAuth completion fails.
Manual OAuth code exchange works, which suggests the failure is specifically in the local callback listener path rather than the provider configuration or token exchange itself.
Activity
github-actions commentedon Jun 11, 2026
This issue might be a duplicate of existing issues. Please check:
listen(port)is called without a host address, causing callback failures. That issue covers WSL2; this one covers native Windows, but the underlying fix is identical.