What it gives the AI
The AI starts working with GitHub like a real teammate: reading issues and PRs, leaving review comments, creating branches and PRs, checking CI status (GitHub Actions), searching code and security alerts — without copy-pasting from the browser.
Example: "Take issue #412, fix it and open a PR" — the AI reads the ticket through the server, makes the changes, pushes a branch and files a pull request with a description.
Setup (exact steps)
Claude Code
The recommended path is the GitHub remote server, authorized with a fine-grained PAT via a header:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer YOUR_GITHUB_PAT"
Create the token in GitHub → Settings → Developer settings → Personal access tokens (fine-grained), scoped to just the repositories you need.
Alternative — locally in Docker (the official image), handy for offline work or a strict perimeter:
claude mcp add github --env GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_PAT \
-- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
Cursor / Claude Desktop
Remote config (type http) with an authorization header:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer YOUR_GITHUB_PAT"
}
}
}
}
Usage example
Say: "Show the open PRs assigned to me and review the biggest one" → the AI pulls the PR list, reads the diff and leaves structured comments. Or "file an issue for the bug we just found" → it creates a ticket with reproduction steps.
Security
- Least privilege: run it read-only — the
--read-onlyflag (locally) orGITHUB_READ_ONLY=1(Docker env). Then the AI reads but can't push or close issues. - Shrink the surface: with
--toolsets repos,issues,pull_requests(or theGITHUB_TOOLSETSenv var) keep only the tool groups you need and disable, say,actionsandcode_security. - Token: use a fine-grained PAT scoped to specific repositories only, never a classic account-wide token. The PAT is passed in a header — don't commit it into the repository's
.mcp.json.
Gotchas
- The remote server talks to
api.githubcopilot.com/mcp/— for private corporate perimeters that's an external host; those setups go with the Docker option. - The tool set is large: without
--toolsets/tool search it bloats the context. Enable only what the task actually needs. - A classic PAT gives the AI access to all your repositories — a common mistake; use fine-grained tokens and least privilege.