MCP OAuth broken with agentgateway + Entra ID
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
Describe the bug
Earlier, https://github.com/github/copilot-cli/issues/4490 was closed but I tested with the 1.0.81 prerelease and for our case the same error persists:
Authentication failed: MCPOAuthError: Incompatible authorization server: authorization server advertised an issuer that does not match the URL its metadata was discovered from (RFC 8414 §3.3); refusing to connect
This issuer mismatch is introduced by https://github.com/agentgateway/agentgateway/pull/2408 that works around several MCP OAuth & Entra ID incompatibilities at the cost of introducing an authorization server discovery proxy.
This works fine with Copilot version 1.0.78. The error occurs with GitHub Copilot CLI 1.0.80 and GitHub Copilot CLI 1.0.81-8 preview.
Can you please implement a skipIssuerValidation configuration option to make this work again?
Affected version
GitHub Copilot CLI 1.0.81-8
Steps to reproduce the behavior
Try to authenticate to MCP server configured on agentgateway with Entra ID following the documentation.
The https://agentgateway.domain/.well-known/oauth-authorization-server/mcp resource returns the original Entra ID issuer:
"issuer": "https://login.microsoftonline.com/tenant-id/v2.0"
Expected behavior
Copilot can authenticate to MCP OAuth server with agentgateway authorization server proxy and Entra ID again.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Copilot CLI MCP OAuth authentication flow and reproduce the failure against the agentgateway Entra ID setup described in the issue. Compare versions 1.0.78, 1.0.80, and 1.0.81-8, then verify that authentication succeeds while preserving the authorization-server issuer safety behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, authentication, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100