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.
The entry merged into ~/.claude.json by chezmoi_config/modify_dot_claude.json:
{
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_MCP_PAT}"
}
}
Claude Code expands ${GITHUB_MCP_PAT} from the environment at connect time. Verify the connection with claude mcp list; the github server should report ✔ Connected.