Claude Code + GitHub
Status: Documentation only. Not run: it needs a GitHub account and a personal access token.
GitHub's remote MCP server lets Claude Code read and change issues, pull requests and repositories. Unlike the free servers in this directory, it needs a token, and many of its tools write.
| Field | Value |
|---|---|
| Client and version | Claude Code. GitHub's guide says claude mcp add-json needs Claude Code 2.1.1 or newer. Not run on 2.1.314 |
| Server | GitHub MCP Server (remote), published by GitHub |
| URL | Read-only, used below: https://api.githubcopilot.com/mcp/readonly. With write tools: https://api.githubcopilot.com/mcp/ |
| Transport | Streamable HTTP (--transport http) |
| Authentication | GitHub personal access token sent as Authorization: Bearer ${GITHUB_PAT}: the config names the environment variable, never the token. Anthropic's example uses a fine-grained token limited to the repos you want |
| Read or write | Read and write (for example, creating issues and reviewing pull requests). GitHub documents a read-only mode: add /readonly to the URL, or send the X-MCP-Readonly header |
| Cost, limits, account | A GitHub account and a token are required. GitHub's install guide does not say whether a paid or Copilot plan is needed; not verified |
| Sources | https://code.claude.com/docs/en/mcp ("Example: Connect to GitHub for code reviews"); https://github.com/github/github-mcp-server/blob/main/docs/installation-guides/install-claude.md; https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md |
| Last checked | 2026-11-20 |
Set it up
Start read-only, and keep the token out of the command. The /readonly URL gives Claude Code GitHub's read tools
only. The header names an environment variable, ${GITHUB_PAT}, instead of the token itself, so the token is never
typed into a command, saved in shell history or written into a config file.
-
Put the token in an environment variable without typing it into a command. In bash or zsh,
read -rsasks for it and does not echo it or save it in history:read -rs GITHUB_PAT && export GITHUB_PATUse a fine-grained token limited to the repos you want, as Anthropic's example suggests.
-
Add the server with the variable reference. The single quotes matter: they stop the shell from expanding
${GITHUB_PAT}, so Claude Code stores the reference and reads the variable when it connects:claude mcp add --scope project --transport http github https://api.githubcopilot.com/mcp/readonly \ --header 'Authorization: Bearer ${GITHUB_PAT}'This writes the project's
.mcp.json(checked on Claude Code 2.1.314, 2026-11-20: the file holds the literal${GITHUB_PAT}, never the token). It is safe to commit:{ "mcpServers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/readonly", "headers": { "Authorization": "Bearer ${GITHUB_PAT}" } } } }
Claude Code expands ${VAR} in url and headers (Claude Code MCP docs). If GITHUB_PAT is not set, the docs say
the config still loads, claude mcp list warns about the missing variable, and the literal ${GITHUB_PAT} text is
sent instead of a token, so expect the connection to fail.
Need write tools (creating issues, reviewing pull requests)? Use https://api.githubcopilot.com/mcp/ instead of the
/readonly URL, with the same header, and only after you have read which tools it adds.
Anthropic's docs show the same server added with the token pasted into --header. We don't lead with that form:
a token typed into a command line stays in your shell history.
How to check it (from the docs)
claude mcp addsaves the config without checking the token, so a placeholder is accepted and fails later.- Run
/mcpin a session, orclaude mcp get githubin the shell. A good token shows a checkmark (✔ Connected). A bad one shows✘with the HTTP status, such as a401, in the failure detail. - GitHub's guide adds: check the token has not expired and has the scopes you need.