Skip to content

fix(mcp): use correct authorization server URL for OAuth discovery - #7234

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
rscarvalho:7228-mcp-oauth-auth-flow
Jan 7, 2026
Merged

rekram1-node merged 1 commit into
anomalyco:devfrom
rscarvalho:7228-mcp-oauth-auth-flow

Conversation

@rscarvalho

Copy link
Copy Markdown
Contributor

Summary

Upgrade @modelcontextprotocol/sdk from 1.15.1 to 1.25.2 to fix OAuth discovery for external authorization servers.

Fixes #7228

Problem

When an MCP server's protected resource metadata returns an external authorization_servers URL (e.g., Auth0), OpenCode incorrectly fetches /.well-known/oauth-authorization-server from the MCP server instead of the authorization server.

Solution

Upgrade the MCP SDK to 1.25.2, which fixes the URL construction in discoverOAuthMetadata().

Related

PR #5940 addresses the same SDK bug but also adds a redirectUri configuration option. This PR is a minimal fix focusing only on the SDK upgrade. The redirectUri feature could be considered separately.

@github-actions

github-actions Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PR Found

PR #5940: fix(mcp): Upgrade SDK and add redirectUri config for OAuth callback
#5940

Why it's related:

@rscarvalho
rscarvalho force-pushed the 7228-mcp-oauth-auth-flow branch from e43c2d1 to 7e3865a Compare January 7, 2026 17:28
@rekram1-node
rekram1-node merged commit a160eee into anomalyco:dev Jan 7, 2026
3 checks passed
@rscarvalho
rscarvalho deleted the 7228-mcp-oauth-auth-flow branch January 7, 2026 18:47
triklozoid pushed a commit to triklozoid/opencode that referenced this pull request Feb 2, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP OAuth authentication fails to use authorization_servers URL from Protected Resource Metadata

2 participants