[BUG] GitHub MCP server fails with 400 "Authorization header is badly formatted" in VS Code extension, but works fine in terminal

Status Open
Reported on v2.1.251
Maintainer reply None cached
Activity 0 comments · opened Aug 30, 2026

Description

The GitHub MCP server (https://api.githubcopilot.com/mcp/) configured via .mcp.json works correctly when using Claude Code in the terminal, but fails in the VS Code extension with:

400: "Authorization header is badly formatted"

Same .mcp.json, same machine, same GITHUB_PAT environment variable — only the client differs (terminal vs. VS Code extension).

.mcp.json

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

Steps to reproduce

  1. Add the .mcp.json above to a project (with GITHUB_PAT set in the environment).
  2. Run claude in the terminal in that project → GitHub MCP tools connect and work normally.
  3. Open the same project in VS Code with the Claude Code extension → the GitHub MCP server fails to connect with 400: "Authorization header is badly formatted".

Expected behavior

The VS Code extension should build the Authorization header the same way the terminal CLI does, and connect successfully.

Actual behavior

The VS Code extension sends a malformed Authorization header, causing the MCP server to reject the request with 400.

Environment

  • Claude Code CLI version: 2.1.251
  • OS: macOS 26.6 (BuildVersion 25G72)
  • Client: Claude Code VS Code extension (works fine on the CLI in the same environment/config)

Possibly related

  • #79653 (plugin:github:github MCP server fails with HTTP 400 "missing required Authorization header")
  • #84367 (github plugin MCP: Authorization header not built correctly from ${GITHUB_PERSONAL_ACCESS_TOKEN} template)

These look related but report different symptoms/messages, so filing separately in case the VS Code-specific header construction is a distinct bug.

View original on GitHub ↗