Zum Inhalt

GitHub MCP server

Registers a global GitHub Model Context Protocol (MCP) server for every Claude Code project by merging a github entry into ~/.claude.json. It authenticates with a GitHub Personal Access Token read from the GITHUB_MCP_PAT environment variable, so no secret is stored in this repository.

Export the token before starting Claude Code — if the variable is unset, Claude Code fails to parse the configuration. The snippet below reads it from the authenticated GitHub CLI (run gh auth login first):

export GITHUB_MCP_PAT="$(gh auth token)"

Add that line to your shell startup file (for example ~/.zshrc) so every session has it. The browser-based OAuth login (claude mcp login) is not usable here, because that flow requires OAuth dynamic client registration, which the remote endpoint doesn't support.

Der Eintrag, den chezmoi_config/modify_dot_claude.json in ~/.claude.json einfügt:

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

Claude Code löst ${GITHUB_MCP_PAT} beim Verbindungsaufbau aus der Umgebung auf. Prüfe die Verbindung mit claude mcp list; der github-Server sollte ✔ Connected melden.