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 authentication fails to use authorization_servers URL from Protected Resource Metadata #7228
When connecting to a remote MCP server that uses an external authorization server (like Auth0), OpenCode fails with:
HTTP 401 trying to load well-known OAuth metadata
The issue is that OpenCode tries to fetch OAuth metadata directly from the MCP server instead of using the authorization_servers URL from the protected resource metadata response.
This same setup works fine with Claude Code, which correctly follows the two-step discovery flow.
Run opencode mcp auth example-server and observe it fails because it tries:
GET https://mcp-gateway.example.com/example-server/.well-known/oauth-authorization-server
instead of:
GET https://example.auth0.com/.well-known/oauth-authorization-server
Activity
github-actions commentedon Jan 7, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.