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
Oath MCP always using root level even though my rul is .../xmcp/mcp #7135
My mcp url is /xmcp/mcp. This works fine for claude code and cursor.
However I think opencode is tyring to authenticate with mcp using root urls only. What do I need to change to fix?
AI informs me opencode may not be using the authroization information?
I have the same issue, my mcp is in localhost, and the auth server is on a different public url. Opencode call /authorize on the mcp url instead of using the WWW-Authenticate ressource_metadata. A hack to make it work is to do a redirect on your mcp for /authorize and a PROXY for /token (you proxy the token request to your actual oauth server, and respond back to opencode).If you are using a reverse proxy type kong or traefik you could play also on the ingress routes to redirect any /authorize or /proxy to your auth server.
But I agree this is a mis implementation of how Oauth is supposed to work
Erratum actually it's working well. On the MCP endpoint, www-authenticate header should point to his own ressource .well-known/oauth-protected-resource so that opencode can fetch it and discover the actual Oauth server
Expected response format of your own .well-known/oauth-protected-resource/<mcp_path>
Closing as fixed by the current MCP SDK discovery behavior. SDK 1.29 performs path-aware RFC 9728 and RFC 8414/OIDC discovery, including /.well-known/oauth-protected-resource/<mcp-path> and path-aware authorization-server metadata lookup. As noted in the thread, the MCP WWW-Authenticate response must point to its protected-resource metadata document.
Activity
jodem commentedon Mar 18, 2026
I have the same issue, my mcp is in localhost, and the auth server is on a different public url. Opencode call /authorize on the mcp url instead of using the WWW-Authenticate ressource_metadata. A hack to make it work is to do a redirect on your mcp for /authorize and a PROXY for /token (you proxy the token request to your actual oauth server, and respond back to opencode).If you are using a reverse proxy type kong or traefik you could play also on the ingress routes to redirect any /authorize or /proxy to your auth server.
But I agree this is a mis implementation of how Oauth is supposed to work
jodem commentedon Mar 18, 2026
Erratum actually it's working well. On the MCP endpoint, www-authenticate header should point to his own ressource .well-known/oauth-protected-resource so that opencode can fetch it and discover the actual Oauth server
Expected response format of your own .well-known/oauth-protected-resource/<mcp_path>
then opencode calls https://.well-known/oauth-authorization-server and discovers authorization_endpoint, token_endpoint, etc
rekram1-node commentedon Jun 24, 2026
Closing as fixed by the current MCP SDK discovery behavior. SDK 1.29 performs path-aware RFC 9728 and RFC 8414/OIDC discovery, including
/.well-known/oauth-protected-resource/<mcp-path>and path-aware authorization-server metadata lookup. As noted in the thread, the MCPWWW-Authenticateresponse must point to its protected-resource metadata document.