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: issuer mismatch on a trailing slash rejects a valid authorization server (regression since 2.0.3) #50036
Remote MCP servers whose authorization server has an issuer identifier ending in / fail to connect on 2.0.4+:
Issuer mismatch in authorization server metadata (RFC 8414 §3.3): expected "https://oauth.id.jumpcloud.com", received "https://oauth.id.jumpcloud.com/"
The protected resource metadata (RFC 9728) advertises the authorization server without a trailing slash. The authorization server's own metadata returns its issuer with one. Both forms resolve to the same metadata URL, because RFC 8414 §3.1 requires any terminating / to be removed before inserting the well-known path. So the two strings name the same issuer but fail the §3.3 equality check.
This is a regression. I have logs of the same config connecting on 2.0.1 (2026-09-18) and failing on 2.0.10 (2026-09-19); I have not bisected the releases in between. #48937 (MCP client rework for SDK v2) merged 2026-09-14, between 2.0.3 and 2.0.4, and looks like where the comparison was introduced.
oauth.auth_server_metadata_url from #49126 is not a workaround — it changes where the metadata is fetched from, not the comparison done afterwards. I tested it on 2.0.10 and the error is unchanged.
JumpCloud is publicly reproducible: both https://oauth.id.jumpcloud.com/.well-known/oauth-authorization-server and https://oauth.id.jumpcloud.com/.well-known/openid-configuration return "issuer": "https://oauth.id.jumpcloud.com/". An AWS Bedrock AgentCore gateway configured with a JumpCloud discovery URL publishes "authorization_servers": ["https://oauth.id.jumpcloud.com"], which is the pairing that triggers this.
Would it be reasonable to normalize a trailing slash when comparing issuer identifiers on the metadata path?
OpenCode version
2.0.10 (working on 2.0.1)
Steps to reproduce
Configure a remote MCP server whose protected resource metadata lists "authorization_servers": ["https://oauth.id.jumpcloud.com"], with OAuth against that JumpCloud tenant.
Run opencode mcp list.
The server fails with the error above. opencode upgrade 2.0.1 and the same config connects.
Thanks for the detailed report. I reproduced this.
Setup:
A local mock MCP resource server that returns 401 and protected resource metadata with "authorization_servers": ["https://oauth.id.jumpcloud.com"] (no trailing slash).
The real JumpCloud authorization server, whose metadata returns "issuer": "https://oauth.id.jumpcloud.com/".
A remote MCP entry pointing at the mock, then opencode mcp list.
Results:
2.0.10:failed: Issuer mismatch in authorization server metadata (RFC 8414 §3.3): expected "https://oauth.id.jumpcloud.com", received "https://oauth.id.jumpcloud.com/"
2.0.3: the same setup gets past discovery and shows needs authentication, which confirms the regression.
Latest dev (62ae125), run from source: still fails with the same error.
The strict comparison is done inside the MCP client SDK that OpenCode switched to in 2.0.4. The script below reproduces it.
Activity
cestercian commentedon Sep 19, 2026
Taking this — will treat trailing-slash issuer mismatch as equivalent for MCP OAuth.
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I reproduced this.
Setup:
401and protected resource metadata with"authorization_servers": ["https://oauth.id.jumpcloud.com"](no trailing slash)."issuer": "https://oauth.id.jumpcloud.com/".opencode mcp list.Results:
failed: Issuer mismatch in authorization server metadata (RFC 8414 §3.3): expected "https://oauth.id.jumpcloud.com", received "https://oauth.id.jumpcloud.com/"needs authentication, which confirms the regression.dev(62ae125), run from source: still fails with the same error.The strict comparison is done inside the MCP client SDK that OpenCode switched to in 2.0.4. The script below reproduces it.
Related:
Reproduction script (repro.sh)
Run it:
bash repro.sh