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.
- The remote endpoint is
https://api.githubcopilot.com/mcp/. GitHub hosts it. - Scope it:
/x/pull_requests,/x/issues,/x/actionsand thirteen more. - Append
/readonlyto any toolset URL. Start there. - Use a fine-grained PAT, not a classic one.
claude mcp addnever validates it. ghis 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
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.
Add the server
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer YOUR_GITHUB_PAT"
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.
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.
| Toolset | Endpoint |
|---|---|
| Everything | https://api.githubcopilot.com/mcp/x/all |
| Pull requests | https://api.githubcopilot.com/mcp/x/pull_requests |
| Issues | https://api.githubcopilot.com/mcp/x/issues |
| Repositories | https://api.githubcopilot.com/mcp/x/repos |
| Actions | https://api.githubcopilot.com/mcp/x/actions |
| Code security | https://api.githubcopilot.com/mcp/x/code_security |
| Secret protection | https://api.githubcopilot.com/mcp/x/secret_protection |
| Dependabot | https://api.githubcopilot.com/mcp/x/dependabot |
| Discussions | https://api.githubcopilot.com/mcp/x/discussions |
| Notifications | https://api.githubcopilot.com/mcp/x/notifications |
| Organizations | https://api.githubcopilot.com/mcp/x/orgs |
| Projects | https://api.githubcopilot.com/mcp/x/projects |
| Gists | https://api.githubcopilot.com/mcp/x/gists |
| Git | https://api.githubcopilot.com/mcp/x/git |
| Labels | https://api.githubcopilot.com/mcp/x/labels |
| Code quality | https://api.githubcopilot.com/mcp/x/code_quality |
| Users | https://api.githubcopilot.com/mcp/x/users |
| Security advisories | https://api.githubcopilot.com/mcp/x/security_advisories |
# 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) | |
|---|---|---|
| Setup | One command | Docker plus a token |
| Updates | GitHub ships them | You pull a new image |
| Auth | OAuth or PAT header | GITHUB_PERSONAL_ACCESS_TOKEN |
| Traffic | Through GitHub's MCP host | Direct from your machine |
| GitHub Enterprise Server | No | Yes, via GITHUB_HOST |
| Toolset control | URL path or headers | GITHUB_TOOLSETS or --toolsets |
| Read-only | /readonly or a header | GITHUB_READ_ONLY=true |
| Latency | A hop | Local process |
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 run | Use |
|---|---|
| github.com | Remote, https://api.githubcopilot.com/mcp/ |
| GitHub Enterprise Cloud | Remote, same endpoint |
| Enterprise Cloud with data residency | https://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".
| Task | Better with |
|---|---|
| "What is failing on PR 412?" | gh. One command, zero standing context |
| Scripted or CI use | gh. No MCP client in a shell script |
Machine already logged in with gh auth | gh. Nothing to configure |
| Multi-step work across issues and PRs | MCP. Structured results, no output parsing |
| Reading review comments in position | MCP. gh flattens the thread |
| Code search across an organisation | MCP |
| A permission boundary you can prove | MCP. Read-only endpoint, scoped token |
| Running inside a sandbox without network | Neither. 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.
| Pattern | Matches |
|---|---|
mcp__github | Every 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_request | That one tool |
mcp__* | Every MCP tool, deny and ask only |
{
"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
| Symptom | Cause | Fix |
|---|---|---|
✘ Failed to connect right after adding | Bad or expired token | Regenerate; add is never validated |
! Needs authentication | No header, so it wants OAuth | Run /mcp and sign in |
| Connects, but tools 404 on your repo | Fine-grained token missing that repo | Add the repository to the token |
| Tools exist but every write fails | You are on a /readonly endpoint | Intended. Use the writable URL |
| Some tools missing entirely | Toolset not enabled | /x/all, or the right toolset URL |
| Works for you, not the team | Local scope | Re-add with --scope project |
| Enterprise Server returns 404 | Remote server cannot see GHES | Local Docker plus GITHUB_HOST |
| Everything got slower | All toolsets loaded | Narrow the endpoint |
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.