[BUG] Cannot connect Remote GitHub MCP Server

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 11 comments · opened Jun 18, 2025 · closed Jun 19, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: <!-- output of claude --version --> 1.0.27 (Claude Code)
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 --> macOS 15.5
  • Terminal: <!-- e.g. iTerm2, Terminal App --> iTerm2

Bug Description

<!-- A clear and concise description of the bug -->

The OAuth authentication fails for the GitHub MCP Server (https://github.com/github/github-mcp-server) added with the following command:

claude mcp add -t http github-server https://api.githubcopilot.com/mcp/

and https://docs.anthropic.com/en/docs/claude-code/mcp#authenticate-with-remote-mcp-servers

Based on the observed behavior, it seems that Claude immediately tries to connect to /.well-known/oauth-authorization-server and ignores the resource_metadata in the www-authenticate header, preventing it from properly following the GitHub MCP Server flow.

I believe GitHub MCP Server could be supported by implementing the following flow:

  1. Retrieve resource_metadata from the www-authenticate header returned by GET https://api.githubcopilot.com/mcp/
  2. Send a request to the URL obtained in step 1, and use authorization_servers to perform OAuth
  3. Continue with the normal flow

Steps to Reproduce

  1. do claude mcp add -t http github-server https://api.githubcopilot.com/mcp/
  2. run claude and try /mcp command

Expected Behavior

<!-- What you expected to happen -->

Complete OAuth 2.0 authentication flow

Actual Behavior

<!-- What actually happened -->

Failed OAuth 2.0 authentication flow

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

11 Comments

ashwin-ant collaborator · 1 year ago

The github mcp server doesn't support dynamic oauth client registration, meaning it doesn't support our normal oauth flow out of the box. Their docs touch on this a bit: https://github.com/github/github-mcp-server?tab=readme-ov-file#installation.

Instead you need to configure a PAT and set up the server config like:

"github": {
  "type": "http",
  "url": "https://api.githubcopilot.com/mcp",
  "headers": {
    "Authorization": "YOUR_PAT_HERE"
  }
}
lukemauldinks · 1 year ago

I am still having this issue. Example of config:

    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp",
      "headers": {
        "Authorization": "Bearer github_pat_XXXXXXXXXXX"
      }
    }

I get the error:

[DEBUG] MCP server "github": No client info found


[DEBUG] MCP server "github": Connection failed: Error: Dynamic client registration failed: HTTP 404
[DEBUG] MCP server "github": Error message: Dynamic client registration failed: HTTP 404
[DEBUG] MCP server "github": Error stack: Error: Dynamic client registration failed: HTTP 404


[DEBUG] MCP server "github": No token data found
[DEBUG] MCP server "github": Using redirect port: 61749
[DEBUG] MCP server "github": Saving OAuth state
[DEBUG] MCP server "github": Starting SDK auth
[DEBUG] MCP server "github": Server URL: https://api.githubcopilot.com/mcp
[DEBUG] MCP server "github": No client info found
[DEBUG] MCP server "github": SDK auth error: Error: Dynamic client registration failed: HTTP 404
logorrheic · 1 year ago

I'm seeing the same behaviour with a different OAuth implementation that does support dynamic registration. It is working when I use Inspector as the client rather than Claude Code.

Our /mcp endpoint replies with the resource_metadata option:

> GET /mcp HTTP/2
...
< HTTP/2 401 
...
< www-authenticate: Bearer resource_metadata="https://.../.well-known/oauth-protected-resource"
...

Claude Code never attempts to fetch the protected resource metadata. Instead we see it makes a request for /.well-known/oauth-authorization-server at the MCP server, rather than our authorization server, which fails. I think the issue might still be unresolved.

archulan · 1 year ago

I'm still having the same issue when I try to initialise mcp serve with /mcp command after adding the mcp server with claude mcp add --transport http github https://api.githubcopilot.com/mcp/

Github MCP Server                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                       │
│ Status: ✘ failed                                                                                                                                                                                                                      │
│ URL: https://api.githubcopilot.com/mcp/                                                                                                                                                                                               │
│                                                                                                                                                                                                                                       │
│ Error: Dynamic client registration failed: HTTP 404   
malisancube · 1 year ago
I'm still having the same issue when I try to initialise mcp serve with /mcp command after adding the mcp server with claude mcp add --transport http github https://api.githubcopilot.com/mcp/ `` Github MCP Server │ │ │ │ Status: ✘ failed │ │ URL: https://api.githubcopilot.com/mcp/ │ │ │ │ Error: Dynamic client registration failed: HTTP 404 ``

Same error on WSL

ashwin-ant collaborator · 1 year ago

@Archulan @malisancube are you adding a bearer token with a PAT as mentioned above?

archulan · 1 year ago

@ashwin-ant I was able to configure the MCP via the json including the PAT as that was the final resort. But the original issue raised was related to dynamic OAuth not working.

kennethdreyer · 1 year ago

I'm starting to really hate MCP all together. What a shit show maintaining mcp servers..

ashwin-ant collaborator · 1 year ago

@Archulan that's an issue with the github server not offering dynamic OAuth, not actually a bug in Claude Code

archulan · 1 year ago

@ashwin-ant 💯 . That's why I didn't reopen this issue.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.