MCP Oauth fails when the server metadata URL is redirected
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- shell
- Domínio
- authentication, cli, security
Direção de pesquisa
Reproduza a falha fazendo o .well-known/openid-configuration do servidor MCP retornar um redirecionamento 301 e, em seguida, rastreie a validação do issuer usada pelo fluxo HTTP de /mcp add. Está concluído quando os metadados da URL redirecionada são aceitos se o issuer corresponder a essa URL final, e a autenticação prosseguir até o navegador ou até o código de autorização exibido.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
When the .well-known/openid-configuration is behind an http redirect, authentication fails with:
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
I believe that copilot-cli checks the issuer against the original URL instead of the redirected URL. Note that RFC 8414 states that the issuer must match "the URL used to retrieve the metadata," which strictly speaking is the redirection target, not the source.
Affected version
GitHub Copilot CLI 1.0.83.
Steps to reproduce the behavior
- Run an MCP server on a different server from its OAuth authorization server, e.g. https://my.mcp.server vs https://my.oauth.server
- Configure the MCP server so that https://my.mcp.server/.well-known/openid-configuration returns an HTTP 301 redirect to https://my.oauth.server/.well-known/openid-configuration
- Configure the OAuth server so that https://my.oauth.server/.well-known/openid-configuration specifies https://my.oauth.server as the issuer
- In
copilot-cli, type/mcp add FooBar, select type HTTP, remote server URL https://my.mcp.server, and the client ID when asked
Expected behavior
Copilot should ask to authenticate, then open the authentication URL in my browser (or display the authentication code and URL so that I can copy-paste them in my browser), then complete the authentication flow.
Additional context
This may be related to #4480 except that in #4480, the Atlassian MCP server gave the wrong issuer, whereas here the issuer is correct for the real URL and copilot-cli is checking against the wrong URL.
- Linguagem predominante
- Shell
- Estrelas
- 11.2k
- Forks
- 1.9k
- Merge médio
- 14h 16min
- PRs com merge (30d)
- 6
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/copilot-cli
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
github/copilot-cli#4932 ·
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
github/copilot-cli#4909 ·
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
github/copilot-cli#4906 ·
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
github/copilot-cli#4848 ·
-
area:agents area:mcp
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
github/copilot-cli#4729 ·
Todas as issues de github/copilot-cli
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
bug easy help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
lacs-project/sysknife#503 ·
-
help wanted kind/documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
liquidmetal-dev/flintlock#1239 ·