GitHub MCP server in Claude Code: setup, toolsets, and when not to

GitHub runs the server itself, so setup is one line. The part worth getting right is scope: the default endpoint hands over every toolset, and there are seventeen narrower URLs that do not.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

Add it with claude mcp add --transport http github https://api.githubcopilot.com/mcp/ and either a fine-grained personal access token in an Authorization header or OAuth via /mcp. Scope it by appending a toolset path such as /x/pull_requests, and append /readonly for read-only access. A local Docker variant exists for GitHub Enterprise Server and for keeping traffic inside your network.

What you need to know
  • The remote endpoint is https://api.githubcopilot.com/mcp/. GitHub hosts it.
  • Scope it: /x/pull_requests, /x/issues, /x/actions and thirteen more.
  • Append /readonly to any toolset URL. Start there.
  • Use a fine-grained PAT, not a classic one. claude mcp add never validates it.
  • gh is already installed, costs no context, and wins for most one-off commands.
  • GitHub Enterprise Server needs the local Docker server with GITHUB_HOST.

Sixty-second setup

01

Create a fine-grained token

Open github.com/settings/personal-access-tokens and generate a fine-grained token with access to the specific repositories you want Claude to work with. Fine-grained, not classic: a classic token is an all-repositories credential and there is no good reason to hand an agent one.

02

Add the server

claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"
03

Verify it connected

claude mcp list

You want ✔ Connected. claude mcp add saves the configuration without validating the credential, so a typo in the token is accepted at add time and surfaces here as a failure instead.

04

Use it

Review PR #456 and suggest improvements
Show me the failing job logs for the latest run on main
Create an issue for the bug we just found, and link the PR

Scope it with toolset endpoints

This is the feature that makes the GitHub server unusually well behaved, and almost nobody uses it. The base URL exposes the default toolsets. Appending a path narrows the server to one, which cuts the tool surface, cuts the context cost, and cuts what a confused agent can reach.

Read from the github-mcp-server remote server documentation, 7 August 2026.

ToolsetEndpoint
Everythinghttps://api.githubcopilot.com/mcp/x/all
Pull requestshttps://api.githubcopilot.com/mcp/x/pull_requests
Issueshttps://api.githubcopilot.com/mcp/x/issues
Repositorieshttps://api.githubcopilot.com/mcp/x/repos
Actionshttps://api.githubcopilot.com/mcp/x/actions
Code securityhttps://api.githubcopilot.com/mcp/x/code_security
Secret protectionhttps://api.githubcopilot.com/mcp/x/secret_protection
Dependabothttps://api.githubcopilot.com/mcp/x/dependabot
Discussionshttps://api.githubcopilot.com/mcp/x/discussions
Notificationshttps://api.githubcopilot.com/mcp/x/notifications
Organizationshttps://api.githubcopilot.com/mcp/x/orgs
Projectshttps://api.githubcopilot.com/mcp/x/projects
Gistshttps://api.githubcopilot.com/mcp/x/gists
Githttps://api.githubcopilot.com/mcp/x/git
Labelshttps://api.githubcopilot.com/mcp/x/labels
Code qualityhttps://api.githubcopilot.com/mcp/x/code_quality
Usershttps://api.githubcopilot.com/mcp/x/users
Security advisorieshttps://api.githubcopilot.com/mcp/x/security_advisories
Two narrow servers beat one wide one, and they are separately removable.
# code review: PRs, read-only
claude mcp add --transport http gh-pr \
  https://api.githubcopilot.com/mcp/x/pull_requests/readonly \
  --header "Authorization: Bearer $GITHUB_PAT"

# CI triage: Actions, read-only
claude mcp add --transport http gh-ci \
  https://api.githubcopilot.com/mcp/x/actions/readonly \
  --header "Authorization: Bearer $GITHUB_PAT"

Remote or local

Remote (hosted)Local (Docker)
SetupOne commandDocker plus a token
UpdatesGitHub ships themYou pull a new image
AuthOAuth or PAT headerGITHUB_PERSONAL_ACCESS_TOKEN
TrafficThrough GitHub's MCP hostDirect from your machine
GitHub Enterprise ServerNoYes, via GITHUB_HOST
Toolset controlURL path or headersGITHUB_TOOLSETS or --toolsets
Read-only/readonly or a headerGITHUB_READ_ONLY=true
LatencyA hopLocal process
The local server. Note the -i: stdio needs stdin held open.
claude mcp add github-local \
  --env GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_PAT \
  --env GITHUB_TOOLSETS=repos,issues,pull_requests \
  --env GITHUB_READ_ONLY=true \
  -- docker run -i --rm \
     -e GITHUB_PERSONAL_ACCESS_TOKEN -e GITHUB_TOOLSETS -e GITHUB_READ_ONLY \
     ghcr.io/github/github-mcp-server

Default toolsets on the local server are context, repos, issues, pull_requests, and users. Set GITHUB_TOOLSETS="all" to enable everything, which you should not do without a reason.

Enterprise variants.

You runUse
github.comRemote, https://api.githubcopilot.com/mcp/
GitHub Enterprise CloudRemote, same endpoint
Enterprise Cloud with data residencyhttps://copilot-api.{subdomain}.ghe.com/mcp
GitHub Enterprise Server (self-hosted)Local Docker, with GITHUB_HOST

Three workflows that justify it

Adding the server and then using it the way you used gh is how people conclude MCP is overrated. The payoff is in multi-step work where the agent holds the whole picture, not in single lookups.

Reviewing a pull request with its history

Read PR #412, including every review comment and the diff.
Then check whether the concerns raised in review #3 on PR #388 apply here too,
and tell me which ones are unresolved.

That is four or five calls the agent sequences itself. Doing it with gh means parsing JSON in Bash and losing comment position, which is the thing that makes a review thread legible in the first place.

Triaging a failing build

The latest Actions run on main failed. Get the failing job logs, find the first
real error rather than the last line, then check whether the commit that
introduced it touched anything the test covers.

The Actions toolset is the underrated one. Log output is enormous, and having the agent fetch and reduce it beats scrolling a web UI. Watch the size: Claude Code truncates any single MCP result over 25,000 tokens by default, so ask for a job rather than a run.

Closing the loop from issue to PR

Read issue #219. Implement it on a branch, open a PR that closes it, and
summarise in the PR body what you changed and what you deliberately did not.

The honest comparison: gh CLI

Claude Code can already run gh through Bash, on a machine where it is probably already authenticated. Before adding the MCP server, it is worth knowing what you are buying, because for a meaningful set of tasks the answer is "nothing".

TaskBetter with
"What is failing on PR 412?"gh. One command, zero standing context
Scripted or CI usegh. No MCP client in a shell script
Machine already logged in with gh authgh. Nothing to configure
Multi-step work across issues and PRsMCP. Structured results, no output parsing
Reading review comments in positionMCP. gh flattens the thread
Code search across an organisationMCP
A permission boundary you can proveMCP. Read-only endpoint, scoped token
Running inside a sandbox without networkNeither. Both need the network

The pragmatic setup for most people: keep gh for the quick, imperative things, and add a read-only GitHub MCP server for the structured reading an agent does during review. They coexist fine.

Locking it down with permission rules

A read-only endpoint is the strong boundary. Permission rules are the finer one, and they are how you keep write access for the two tools you want while refusing the rest. Every MCP tool is addressable by name, in the form mcp__<server>__<tool>, where the server segment is the name you gave it in claude mcp add.

Matching rules, from the Claude Code permissions reference.

PatternMatches
mcp__githubEvery tool from the github server
mcp__github__*The same thing, written as a glob
mcp__github__get_*Its get_ tools only
mcp__github__create_pull_requestThat one tool
mcp__*Every MCP tool, deny and ask only
.claude/settings.json. Auto-approve the reads, always ask before a write.
{
  "permissions": {
    "allow": [
      "mcp__github__get_*",
      "mcp__github__list_*",
      "mcp__github__search_*"
    ],
    "ask": [
      "mcp__github__create_pull_request",
      "mcp__github__merge_pull_request"
    ],
    "deny": [
      "mcp__github__delete_*"
    ]
  }
}

Hook matchers use the same names, so a PreToolUse hook on mcp__github__.* can log or block writes centrally. If the server arrived from a plugin rather than claude mcp add, the callable name is longer, mcp__plugin_<plugin>_<server>__<tool>, and a matcher written against the bare server key never fires. That mismatch is a genuinely hard bug to see, because the hook is present, valid, and silent.

When it will not connect

SymptomCauseFix
✘ Failed to connect right after addingBad or expired tokenRegenerate; add is never validated
! Needs authenticationNo header, so it wants OAuthRun /mcp and sign in
Connects, but tools 404 on your repoFine-grained token missing that repoAdd the repository to the token
Tools exist but every write failsYou are on a /readonly endpointIntended. Use the writable URL
Some tools missing entirelyToolset not enabled/x/all, or the right toolset URL
Works for you, not the teamLocal scopeRe-add with --scope project
Enterprise Server returns 404Remote server cannot see GHESLocal Docker plus GITHUB_HOST
Everything got slowerAll toolsets loadedNarrow the endpoint
Confirm the credential outside Claude Code first. It removes half the guesswork.
curl -sS -H "Authorization: Bearer $GITHUB_PAT" \
  https://api.github.com/user | jq .login

claude mcp get github
claude mcp remove github && claude mcp add --transport http github \
  https://api.githubcopilot.com/mcp/x/all/readonly \
  --header "Authorization: Bearer $GITHUB_PAT"

Questions people ask

Run claude mcp add --transport http github https://api.githubcopilot.com/mcp/ with a fine-grained personal access token in an Authorization Bearer header, then check claude mcp list shows Connected. Without a header the server uses OAuth, which you complete from /mcp.

Not necessarily. The remote server supports OAuth, so you can add it with no header and sign in from /mcp. A fine-grained token is the better choice when you want to restrict the agent to specific repositories.

Append /readonly to the endpoint, for example https://api.githubcopilot.com/mcp/x/all/readonly, or send an X-MCP-Readonly header. On the local Docker server, set GITHUB_READ_ONLY=true.

Both. gh is already installed, costs no standing context, and wins for one-off commands. The MCP server wins for multi-step work with structured results, and for a permission boundary you can actually enforce with a scoped token and a read-only endpoint.

Add a toolset-scoped endpoint such as /x/pull_requests or /x/issues instead of the base URL, or send X-MCP-Toolsets. On the local server, set GITHUB_TOOLSETS or pass --toolsets.

Not the hosted remote one. Run the local Docker server, ghcr.io/github/github-mcp-server, with GITHUB_HOST set to your instance URL. Enterprise Cloud with data residency uses a copilot-api subdomain on ghe.com instead.

Almost always the token. claude mcp add saves the configuration without validating credentials, so a placeholder or expired token is accepted at add time and only fails at connection. Test the token with a curl to api.github.com/user first.

Treat it like any other write credential. Use a fine-grained token limited to the repositories in play, start with a read-only endpoint, and remember that issue and PR text is untrusted input on a public repository, which makes prompt injection a real rather than theoretical concern.

Sources

Every figure above was read from these pages on 3 August 2026. Vendors reprice without notice; if you find a stale number, tell us.

  1. github/github-mcp-server
  2. GitHub MCP remote server reference
  3. Claude Code MCP documentation
Try it

Big diffs,
big bills.

Continuum shows the token split per session, so a PR-review workflow that doubled your spend is visible while it happens.

free app · your subscriptions · local-first