Skip to content
MCP Shelf

Pod to App: Claude Code

How to install the GitHub MCP server in Claude Code

By Sophie Filer · Updated 10 Nov 2026 · Steps checked against GitHub's own docs on 10 Nov 2026

The short answer

Run one claude mcp add-json command in your terminal, with a GitHub personal access token where it says YOUR_GITHUB_PAT. It points Claude Code at GitHub's hosted server, so there is nothing to download or keep updated.

Terminal (not inside a Claude Code chat)
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}'
Claude Code
2.1.1 or newer for this command
Sign-in
Personal access token in a header
Runs on
GitHub's hosted server
Price
Free, no Copilot plan needed

Before you start

  • Claude Code 2.1.1 or newer. Run claude --version to check; older versions need the legacy command further down.
  • A fine-grained personal access token, made on GitHub's new token page. Limit it to the repositories you want Claude Code to touch.
  • A terminal open in your project folder. Claude Code saves servers per project by default, so where you run the command matters.
  • Docker, but only if you want the local version instead of the hosted one.

Install it step by step

  1. Step 1: Make the token. On GitHub's token page, pick the repositories, then give read access to what you want Claude Code to see (contents, issues, pull requests) and write access only where you want it to make changes.
  2. Step 2: In your normal terminal, not in a running Claude Code session, paste the command at the top of this page with your token after Bearer .
  3. Step 3: Quit and reopen Claude Code so it loads the new server.
  4. Step 4: Run claude mcp list. GitHub should be listed as connected. claude mcp get github shows the URL and scope it was saved with.
  5. Step 5: Inside Claude Code, type /mcp to see the server and its tools, then try a real task: "List the open pull requests in this repo and sum up what each one changes."

Choose where Claude Code saves it

Add --scope to the end of the command to decide who gets the server. Leave it off and you get the first row.

ScopeWho can use itGood for
local (the default)Only you, only in this project folderTrying it out on one repo
projectEveryone who opens the project, through a .mcp.json file in the repoTeams, as long as each person brings their own token
userOnly you, in every projectUsing GitHub tools everywhere

Keep the token out of the command

GitHub's guide suggests keeping the token in a .env file (listed in .gitignore) and reading it into the command, so it is not typed out in full. On macOS or Linux:

Terminal (macOS, Linux)
export GITHUB_PAT="$(grep '^GITHUB_PAT=' .env | cut -d '=' -f2-)"
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer '"$GITHUB_PAT"'"}}'

GitHub's Claude install guide has the PowerShell version for Windows.

On Windows or an older Claude Code

If claude mcp add-json answers Invalid input (it can on Windows), or you are on Claude Code 2.1.0 or earlier, use the older form, which takes the URL and header as flags:

Terminal
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_GITHUB_PAT"

In PowerShell, an error saying missing required argument 'name' means the name has to come straight after claude mcp add: start with claude mcp add github --transport http and keep the rest the same.

Give Claude Code fewer GitHub tools

Out of the box the hosted server turns on five toolsets: context, repos, issues, pull_requests and users. Every tool it offers takes up room in Claude Code's context, so naming only the ones you use helps it pick the right tool. Extra headers do this on the hosted server:

HeaderWhat it does
X-MCP-Toolsets: repos,issues,pull_requestsOnly these groups of tools
X-MCP-Readonly: trueOnly tools that read; nothing can be changed
X-MCP-Lockdown: trueHides public issue and comment text from people without push access, a best-effort guard against prompt injection in strangers' issues
Terminal: read-only, three toolsets
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT","X-MCP-Toolsets":"repos,issues,pull_requests","X-MCP-Readonly":"true"}}'

For one toolset you can change the URL instead, for example https://api.githubcopilot.com/mcp/x/issues/readonly. The full list is in GitHub's remote server docs.

Run it on your own machine instead

Pick the Docker image when you use GitHub Enterprise Server or would rather the server ran locally. GitHub's image can sign you in through the browser the first time, so no token is needed; the port must be fixed so the sign-in can call back.

Terminal (Docker running)
claude mcp add github -e GITHUB_OAUTH_CALLBACK_PORT=8085 -- docker run -i --rm -p 127.0.0.1:8085:8085 -e GITHUB_OAUTH_CALLBACK_PORT ghcr.io/github/github-mcp-server

To use a token with Docker instead, pass it as -e GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PAT and drop the port settings. A token wins over the browser sign-in when both are set.

If it does not work

What you seeWhat to do
claude mcp list does not show githubYou are probably in a different folder from where you added it. Open the original project, or add it again with --scope user.
401 or "Bad credentials"The token is wrong, expired or has a stray space. The header must read Bearer then the token.
403 on an organisation's repositoriesThe organisation has to approve fine-grained tokens, or authorise the token for SSO, in its settings.
Listed, but no GitHub tools in /mcpRestart Claude Code. If that fails, run claude mcp remove github and add it again.
Docker version will not pullMake sure Docker is running, then try docker logout ghcr.io and pull ghcr.io/github/github-mcp-server again.

MCP Shelf take

Is GitHub worth adding to Claude Code?

Claude Code can already run git and, if you have it signed in, the gh command line tool, so for pushing a branch or opening one pull request you may not need this server at all. It earns its place when you want GitHub work with guard rails: a token limited to a few repositories, read-only mode while Claude Code explores, and lockdown when it reads issues from strangers. It is also the easier route on machines where gh is not installed. Start read-only with three toolsets and add more only when you miss them.

Sophie Filer

Questions

Do I need GitHub Copilot to use the GitHub MCP server in Claude Code?

No. The hosted server works with any GitHub account and a personal access token, and it costs nothing. A few optional toolsets relate to Copilot features, but the default ones do not.

Can Claude Code sign in to GitHub without a token?

With the hosted server, GitHub's own guide for Claude Code uses a token in a header. The local Docker version can sign you in through your browser instead, as shown in the section on running it on your own machine.

How do I remove the GitHub server from Claude Code?

Run claude mcp remove github in your terminal. If you added it with a scope other than the default, run the command from a place where that scope applies, or add --scope user or --scope project.

Where does Claude Code save the GitHub server?

Local and user scope are kept in your own Claude Code settings file, ~/.claude.json. Project scope writes .mcp.json in the project folder, which is the file to keep out of commits if it holds a token.

Sources: the steps on this page are written in our own words from GitHub's own install docs, install-claude.md, remote-server.md, the README. If they disagree with this page, the project's docs win; please tell us from the server page.