OmniscioGuidesGitHub MCP server
GitHub's MCP server in Claude Code, in one command
GitHub's MCP server puts issues, pull requests, code search and workflow runs inside the conversation, so Claude reads a ticket and opens the pull request without you copying anything into the prompt.
There are two ways to run it: GitHub's hosted endpoint, which needs only a URL and a token, and the local server, which runs in Docker on your machine. This page gives both commands, the .mcp.json equivalent, the scope to pick, the token step, and the check that proves it worked.
Sources read November 25, 2026. By the Omniscio team. Updated .
What it gives Claude Code
The server publishes a set of toolsets rather than one flat list of tools. By default it loads five: context, repos, issues, pull_requests and users. Everything else, including actions, code security and discussions, is a toolset you switch on.
That matters for two reasons. A toolset you do not load costs nothing in the context window, and a toolset you do not load cannot be called, which is the simplest way to keep Claude out of workflow secrets it does not need.
In practice the useful pattern is: ask Claude to read an issue, let it find the file, make the change, open a pull request, and then read the review comments back. Each of those is one tool call against a repository you already have open locally.
The command
The hosted server
GitHub's README calls the remote server the easiest way to get started, and its URL is fixed: https://api.githubcopilot.com/mcp/. Anthropic's MCP page shows the same server with a token in a header, which is the form below.
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer $GITHUB_PAT"Keep the trailing slash on the URL. It is part of the address GitHub publishes. Run the command in your terminal rather than inside a Claude Code session, and keep the token out of the command itself, where it would land in your shell history.
The local server, in Docker
The local server is a Go binary that GitHub ships as a container image, ghcr.io/github/github-mcp-server. Its own README gives this Claude Code line, which passes the token with an environment flag and hands everything after the double dash to Docker. The server name comes first, then the flag: a name written directly after the environment flag is read as one more KEY=value pair and refused.
claude mcp add github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT -- \
docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-serverRunning the container directly is the same thing without Claude Code, and it is the form to use when you want to pass a toolset as an environment variable, which is the one setting the hosted form takes as a header instead:
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \
-e GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" \
ghcr.io/github/github-mcp-serverThe double dash is not decoration. Claude Code reads its own options before it and passes everything after it to the server untouched, so a Docker flag written on the wrong side would be read as a Claude Code option and refused.
The .mcp.json equivalent
The hosted server as a project-scoped entry. Claude Code expands ${VAR} references, so the token stays out of the file:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": { "Authorization": "Bearer ${GITHUB_PAT}" }
}
}
}The local server as an entry. There is no type here, because an entry with a command is a stdio server:
{
"mcpServers": {
"github": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PAT}" }
}
}
}An entry that carries a url and no type is a configuration error rather than a working server, because Claude Code reads an entry with no type as a stdio server.
Which scope to use
The scope decides where the entry is stored and who can read it. For a GitHub token, that second half is the whole decision.
| Scope | Stored in | Who gets the server |
|---|---|---|
local (default) | Your own configuration | You, in this project only |
project | .mcp.json at the repository root | Everyone who clones the repository, once they approve it |
user | Your own configuration | You, in every project |
A personal GitHub token belongs at user scope. A project-scoped entry is a file your team reads and commits, so a token written there is a token you have shared, and ${VAR} only moves the problem to a machine's environment.
Project-scoped servers are also the ones Claude Code makes you approve: the first time a session loads one from .mcp.json, it asks, and claude mcp reset-project-choices clears those answers.
The auth step
Both forms take a personal access token. The hosted endpoint wants it in the Authorization: Bearer header; the Docker server reads it from GITHUB_PERSONAL_ACCESS_TOKEN. GitHub's README states that a token takes precedence over OAuth.
Create the token in GitHub with the scopes the work needs and nothing more: repository access for code, issues and pull requests, plus the workflow scope if Claude has to touch actions. A token minted for a person cannot be revoked per tool, so the toolset list is the finer control.
A GitHub Enterprise Server installation has no hosted endpoint, because GitHub states that GHES does not support remote server hosting. Run the local server there and set GITHUB_HOST or --gh-host to your instance, with the https:// scheme in front of the hostname.
Confirm it connected
Outside a session, list the servers:
claude mcp list
claude mcp get githubThe list prints a health status beside each server. A connected GitHub server reads ✔ Connected; one whose token was missing or rejected reads ! Needs authentication or ✘ Failed to connect, and each means something different.
Inside a session, run /mcp. It lists each server with the tools it exposed, which is the check that matters: a server can be connected and still offer no tools. Tool names follow the pattern mcp__github__<tool>, which is also how a permission rule names one.
If the server is listed and connected but Claude never reaches for it, ask for a specific action in plain words, such as reading issue 412, rather than asking whether GitHub is available. The model picks a tool from its description, so a vague question gives it nothing to grab.
The failure people hit
With the Docker form, the command is refused when the server name sits directly after the environment flag. That flag, -e or its long form --env, takes any number of KEY=value pairs, so github is read as one more pair and rejected. Write the name before the flag, exactly as the two commands above do.
With the hosted form, a token GitHub rejects is reported as a failed connection rather than as one needing authentication, and Claude Code does not fall back to OAuth once an Authorization header is configured. So check the header value first: the word Bearer, one space, then the token, with the whole thing quoted.
The rest of the messages, and what each one means, are in the MCP errors guide. The flags and scopes common to every server are in Add an MCP server to Claude Code.
Sources
Every line on this page rests on one of these. The date beside each one is the day we read it.
- github/github-mcp-server README, for the hosted URL and the recommendation of it, the Docker image and run command, the documented Claude Code line, the default toolsets and the
GITHUB_TOOLSETSprecedence, the token variable and the Enterprise host flag. Read November 25, 2026. - Anthropic: Connect Claude Code to tools via MCP, for the GitHub example with a Bearer header, the
--separator, the--envpair rule, the scope table, the project-scope approval prompt, the health statuses, the JSON entry and the missing-typerule. Read November 25, 2026.
Common questions
What command adds the GitHub MCP server to Claude Code?
For the hosted server, claude mcp add --transport http github https://api.githubcopilot.com/mcp/ followed by a header flag carrying your token. GitHub's own README shows a Docker form instead: claude mcp add github followed by an environment flag, a double dash, and the docker run command.
Do I need a personal access token?
The hosted endpoint authenticates with a token you put in an Authorization header, and the local Docker server reads one from GITHUB_PERSONAL_ACCESS_TOKEN. GitHub's README says a personal access token takes precedence over OAuth.
Which scope should a GitHub server use?
User scope, in almost every case. A project-scoped server is written to .mcp.json in the repository, which is a file your team reads and commits, so a token placed there is shared with everyone who clones it.
How do I check that it connected?
Run claude mcp list and read the status beside github: connected, needs authentication, or failed to connect. Inside a session /mcp lists the server and the tools it exposed, and claude mcp get github prints that server's details.
Can I limit which GitHub tools load?
Yes, on both forms. Both load five toolsets by default: context, repos, issues, pull_requests and users. The local Docker server takes GITHUB_TOOLSETS, which wins over its command line flag. The hosted server takes the same list in a header, added to the add command as --header "X-MCP-Toolsets: repos,issues,pull_requests".
Every session, one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness — Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.