PlugWiki
GitHub MCP Server logo

Add GitHub to Claude Code

Add GitHub's hosted server to Claude Code with a personal access token, and Claude Code can work with your pull requests, issues and repos.

Create a fine-grained GitHub personal access token, add GitHub's hosted server to Claude Code with the command above, and check it in /mcp. Signing in with your GitHub account does not work here yet, so the token is your login. Claude Code can then read code, open pull requests and sort issues in the repos your token reaches. Start with the read-only address and a token limited to the repos you need.

Good for

  • Developers who review and open pull requests from Claude Code
  • Engineers who triage issues and failed checks without leaving the terminal
  • Teams that share one .mcp.json and keep each person's token in their own environment
  • Anyone who wants Claude Code to read GitHub without being able to change it

Add GitHub to Claude Code

Claude Code

  1. 1

    Copy this prompt.

    Add the GitHub MCP server to Claude Code. Run this command:
    
    claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}'
    
    Then check that it loaded and tell me if I need to sign in or restart.
  2. 2

    Paste it into Claude Code. It shows the change and asks before running it.

Requires GitHub personal access token, Claude Code 2.1.1+.

Read-only mode: Want it to only read, never change anything? Use https://api.githubcopilot.com/mcp/readonly as the server address. If you run it on your own computer, add GITHUB_READ_ONLY=1 to its settings instead.

Signing in with your GitHub account does not work with the hosted server in Claude Code yet, so every hosted option uses a personal access token. Run the command in your terminal, not inside a Claude Code session, then open /mcp: a working server shows a checkmark, a bad token shows an X with the error. Add --scope user to use it in every project. On Windows, if add-json returns Invalid input, use the second option. To load fewer tools, add an X-MCP-Toolsets header such as repos,issues,pull_requests next to Authorization. A token typed into the command is saved in plain text in ~/.claude.json; the team option keeps it out of the file.

From the project README. Source.

Common errors and fixes

  • 'Incompatible auth server: does not support dynamic client registration' when signing in

    Cause: GitHub's hosted server does not support the automatic app registration Claude Code's sign-in uses.

    Fix: Put a personal access token in the Authorization header, or register your own GitHub OAuth app and add the server with --client-id, --client-secret and --callback-port.

    claude-code Source

  • GitHub plugin fails with HTTP 400 'Authorization header is badly formatted' while claude mcp list says Connected

    Cause: GITHUB_PERSONAL_ACCESS_TOKEN never reaches the Claude Code process, so the header is empty.

    Fix: Add the token under env in ~/.claude/settings.json, then reload plugins. The log in ~/.claude/debug shows the real error.

    claude-code Source

  • /mcp shows an X with 401 next to github

    Cause: claude mcp add saves the server without checking the token, and GitHub rejected it.

    Fix: Create a new fine-grained token, remove the server and add it again with the new token.

    claude-code Source

  • claude mcp add-json returns 'Invalid input' on Windows

    Cause: A parsing quirk with the JSON argument.

    Fix: Use claude mcp add --transport http with -H for the header. In PowerShell, put the server name right after claude mcp add.

    claude-code Source

  • Large GitHub results are cut off or trigger a size warning

    Cause: Claude Code warns above 10,000 tokens and caps MCP output at 25,000 by default.

    Fix: Start Claude Code with MAX_MCP_OUTPUT_TOKENS=50000, or ask for fewer results.

    claude-code Source

  • No tools load from the latest Docker image and Claude Code says the tool list is invalid

    Cause: Reported as a missing field the newest MCP version needs; a maintainer could not reproduce it.

    Fix: Pin the image to ghcr.io/github/github-mcp-server:v1.14.0 until it is resolved.

    claude-code Source

Permissions

High risk

With a broad token Claude Code can push code, merge pull requests and delete repos, and text in a public issue can try to steer it through prompt injection. Use the read-only address and a fine-grained token, and auto-approve only GitHub's read tools.

What it can do

Watch out for

  • It can push, merge and delete

    With a broad token Claude Code can change repos. Auto-approve only the read tools with an allow rule like mcp__github__get_* and let every other GitHub tool prompt you. code.claude.com

  • Text in public issues can steer Claude

    Claude Code's docs warn that servers reading outside content carry prompt injection risk. Limit the token to the repos you need; GitHub's X-MCP-Lockdown header hides public issue text from users without push access, but GitHub calls it best-effort. code.claude.com

  • Your token can sit in plain text

    A token written into the add command is stored in Claude Code's config. Keep it in a .env file out of git, or reference it from .mcp.json as a variable. github.com

  • Plugin tools need their own permission rules

    If you installed the GitHub plugin, its tools have longer names, so rules written for a server called github do not cover them. code.claude.com

  • Use a fine-grained token

    Claude Code's own GitHub example asks for a fine-grained token limited to the repositories you want Claude to work with. code.claude.com

Security advisories

Technical details
Turning on read-onlyUse https://api.githubcopilot.com/mcp/readonly as the URL, or send the header X-MCP-Readonly: true. Locally, set GITHUB_READ_ONLY=1 or pass --read-only. In Claude Code, an allow rule such as mcp__github__get_* auto-approves only the read tools; every other GitHub tool keeps asking.
Talks toapi.githubcopilot.com (HTTPS, hosted). api.github.com (local Docker or binary)
Sign-in and keysClaude Code sends the token as a header on every call. A token typed into the command is saved in plain text in ~/.claude.json; a .mcp.json can read it from an environment variable instead.
Scopes
  • Whatever your personal access token allows: the repositories and permissions you pick when you create it

Works in

Tap an app to see how to set it up and any known problems.

Questions

Why does GitHub not show up in Claude Code?

It was probably added in another project folder: by default a server only loads where you added it, so add it again with the user scope. If /mcp shows it with an X, the token was rejected, so create a new one and add the server again.

Why does signing in with GitHub fail in Claude Code?

GitHub's hosted server does not support the automatic app registration Claude Code's sign-in needs, so you get a 'dynamic client registration' error. Use a personal access token instead, or register your own GitHub OAuth app and give Claude Code its client ID.

Is there an official GitHub plugin for Claude Code?

Yes. Anthropic's official plugin marketplace has a GitHub plugin, the third option in the install box. It reads your token from GITHUB_PERSONAL_ACCESS_TOKEN, so set that where Claude Code starts.

Why do GitHub tools fail when claude mcp list says connected?

The token probably never reached Claude Code, so the server got an empty or broken header and returned HTTP 400. Set the token where Claude Code can read it, then check /mcp and the debug log in ~/.claude/debug.

How do I share GitHub MCP with my team without committing my token?

Use the team .mcp.json option in the install box. It reads the token from each person's own environment variable, and claude mcp list warns when that variable is missing.

Do I need GitHub MCP if Claude Code can use the gh command?

Often not. Claude Code's docs say a CLI is usually the easiest way in, and with gh signed in Claude can open pull requests and read review comments.

How much of my context does GitHub MCP use?

Little at first. Claude Code's tool search, on by default, loads only tool names at start and the full details when needed; with it off, every GitHub tool loads up front.

How do I load only some GitHub tools?

Add an X-MCP-Toolsets header such as repos,issues,pull_requests next to the Authorization header. You can also point Claude Code at a toolset address such as https://api.githubcopilot.com/mcp/x/issues.

How do I let Claude read GitHub without asking, but ask before changes?

Add an allow rule for mcp__github__get_*, which Claude Code's docs use as their example. Other GitHub tools keep asking; for no changes at all, use the read-only address.

Why does add-json say 'Invalid input' on Windows?

GitHub's guide notes this parsing quirk on Windows. Use the second option in the install box, which adds the same server with the older command form.

Information

updated Nov 1, 2026

Release binariesGitHub Docs: Setting up the GitHub MCP ServerGitHubDocker image (ghcr.io)Official MCP RegistryInstallation guides per clientChangelogIssuesSupport guideSecurity policy

More on this

Sources

Docs, issue trackers and discussions this page is built from.

Show all 13
  1. github.com · github.com
  2. code.claude.com · code.claude.com
  3. github.com · github.com
  4. github.com · github.com
  5. github.com · github.com
  6. github.com · github.com
  7. github.com · github.com
  8. code.claude.com · code.claude.com
  9. github.com · github.com
  10. github.com · github.com
  11. github.com · github.com
  12. code.claude.com · code.claude.com
  13. github.com · github.com

Updated Nov 1, 2026.