Repository navigation
Description
Summary
Remote MCP servers that use Microsoft Entra ID (login.microsoftonline.com/organizations/v2.0) fail OAuth sign-in with an issuer mismatch error. Microsoft's metadata returns the issuer with a {tenantid} placeholder, but opencode expects the literal organizations value, so the sign-in can't complete and the server can't connect.
Environment
- opencode version: 2.2.6
- OS: Windows 10/11 (win32 x64)
- Shell: Windows PowerShell / cmd
- Install/channel: latest
- Active plugins: [email protected]
Reproduction
-
Add a remote MCP server that uses the Microsoft Entra authorization server, for example:
"powerbi": { "type": "remote", "url": "https://api.fabric.microsoft.com/v1/mcp/powerbi", "oauth": { "client_id": "<entra app client id>", "callback_port": 19876, "redirect_uri": "http://127.0.0.1:19876/callback" } }
-
Run
/mcpsin opencode, selectpowerbi, and start sign-in. -
Sign-in fails with:
Issuer mismatch in authorization server metadata (RFC 8414 §3.3): expected "https://login.microsoftonline.com/organizations/v2.0", received "https://login.microsoftonline.com/{tenantid}/v2.0" -
The same error occurs for
https://fabriciq.svc.cloud.microsoft/v1/mcp/fabriciq.
Expected Behavior
Sign-in completes. organizations is a valid multi-tenant Entra authorization server, and the metadata Microsoft returns is the documented one.
Actual Behavior
opencode rejects the authorization server metadata during the RFC 8414 issuer check, and the server stays disconnected.
Additional Context
- The protected resource metadata for
fabriciq.svc.cloud.microsoftlistshttps://login.microsoftonline.com/organizations/v2.0as the authorization server. https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configurationreturns"issuer": "https://login.microsoftonline.com/{tenantid}/v2.0".- Setting
oauth.client_id,callback_portandredirect_uridoes not change the error. - Reproduced consistently.
Activity
opencodejr commentedon Nov 19, 2026
Thanks for the clear report. I reproduced this on 2.2.6 against the real Fabric IQ MCP endpoint and Microsoft's real Entra metadata, with nothing mocked:
https://fabriciq.svc.cloud.microsoft/v1/mcp/fabriciqwith anoauthblock (client_id,callback_port: 19876,redirect_uri).opencode mcp listandopencode mcp auth fabriciq.Both fail with:
It still happens on the latest
dev(d33b578). There,mcp listshows the server as needing authentication, butmcp authfails with the same error before the browser sign-in starts. The script below reproduces it.The check is done by the MCP client SDK during authorization server discovery. Microsoft's multi-tenant metadata uses a
{tenantid}placeholder in its issuer, which fails that check. Related: #50036, the same check rejecting an issuer that differs only by a trailing slash.Reproduction script (repro.sh)
Run it:
bash repro.sh