Skip to content

Unable to connect Gemini CLI to MCP Server #1219

@SirHawbly

Description

@SirHawbly

Describe the bug

Sabre is trying to setup MCP in Gemini CLI, but their outgoing requests keep getting a "missing header" response, though it sounds like things are working in their JetBrains client. They seem to be using the steps on this page and the configs in this section here. Has anyone seen this before?

Image

Links:

Customer emails:

Post 1

Regardless the configuration below the GitHub MCP status is always returning message as below.
Assume that it explains why Gemini CLI is not able to connect to it - what can be a cause of it?

$ curl https://api.githubcopilot.com/mcp/ping -H "Authorization: github_pat_XXX"
GET requests are disabled

https://github.com/github/github-mcp-server/blob/main/docs/installation-guides/install-gemini-cli.md

Post 2

The message below is not changing regardless the settings to be or not active:

Image Image
Post 3

I found the time to debug it one more time: I have MCP enabled, I can use those in IDE (copilot plugin) but not in gemini cli.

MCP active on the Org level:

Image

MCP works in IDE:

Image
{
  "servers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/",
      "requestInit": {
        "headers": {
          "Authorization": "Bearer ghp_XXX"
        }
      }
    }
  }
}

MCP does not work in Gemini CLI:

Image
{
  "mcpServers": {
    "github": {
      "httpUrl": "https://api.githubcopilot.com/mcp/",
      "trust": true,
      "headers": {
        "Authorization": "Bearer ghp_XXX"
      }
    }
  }
}

Gemini config files taken from: https://github.com/github/github-mcp-server/blob/main/docs/installation-guides/install-gemini-cli.md

The MCP API response seems to be irrelevant since always the same:

$ curl https://api.githubcopilot.com/mcp/ping -H "Authorization: ${GITHUB_TOKEN}"
GET requests are disabled
Post 4

This is exactly the config I'm using, if the suggestion was that I accidently used Copilot specific settings (for such config the list of MCP server is empty). I see in debug mode that it is not sending the auth header, in contrast to what is defined in the config.

Image
Post 5

Any hints to what the permissions the token should have... I have tried user, org level tokens and it is always the same 404 (and obviously 401 if the token is not there).

curl -I https://api.githubcopilot.com/mcp/_ping -H "Authorization: ${GITHUB_TOKEN}"
HTTP/2 404 
access-control-allow-headers: Content-Type, Authorization, X-MCP-Readonly, X-MCP-Toolsets, Mcp-Session-Id
access-control-allow-methods: GET, POST, OPTIONS
access-control-allow-origin: *
access-control-max-age: 86400
content-length: 19
content-security-policy: default-src 'none'; sandbox
content-type: text/plain; charset=utf-8
date: Tue, 07 Oct 2025 20:01:48 GMT
server: github-mcp-server-remote
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-github-backend: Kubernetes
x-github-request-id: A002:B8102:2BF320:33EA37:68E571AC
curl -I https://api.githubcopilot.com/mcp/_ping
 curl -I https://api.githubcopilot.com/mcp/_ping
HTTP/2 401 
content-security-policy: default-src 'none'; sandbox
content-type: text/plain; charset=utf-8
strict-transport-security: max-age=31536000
www-authenticate: Bearer error="invalid_request", error_description="No access token was provided in this request", resource_metadata="https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/_ping"
x-content-type-options: nosniff
date: Tue, 07 Oct 2025 20:08:10 GMT
content-length: 51
x-github-backend: Kubernetes
x-github-request-id: A000:2DC0A2:3C5671:474067:68E5732A

Affected version

Please run docker run -i --rm ghcr.io/github/github-mcp-server ./github-mcp-server --version and paste the output below

Steps to reproduce the behavior

  1. Type this '...'
  2. View the output '....'
  3. See error

Expected vs actual behavior

A clear and concise description of what you expected to happen and what actually happened.

Logs

Paste any available logs. Redact if needed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions