How to Install GitHub MCP with Claude Code: Connect Your Repos in 2026
A. Frans
Published May 28, 2026
Table of Contents
- 01What this guide covers
- 02Prerequisites
- 03Step 1: Create the GitHub Personal Access Token
- 04Step 2: Install the GitHub MCP server
- 05Step 3: Configure Claude Code
- 06Step 4: Verify the connection
- 07The four workflows that justify the setup
- 08Troubleshooting
- 09Security notes
- 10What about GitHub Copilot's own MCP integration?
- 11FAQ
Claude Code with the GitHub MCP server installed knows three things it did not before: the contents of your private repos, the state of your open pull requests, and the issue tracker your team actually uses. That changes what you can ask Claude to do. "Find me everywhere we still call the old auth endpoint" stops being a Grep job and becomes a single-sentence request.
This is the install path for the official GitHub MCP server, the four workflows that make it worth the setup, and the things that will trip you up the first time.
What this guide covers
- Installing the GitHub MCP server in Claude Code
- Authenticating with the right token scopes
- Verifying the connection works
- Four real workflows that the integration unlocks
- Troubleshooting the three failure modes I have hit
Time to install: about 8 minutes if you already have a GitHub Personal Access Token. About 12 minutes from scratch.
Prerequisites
- Claude Code installed (CLI version 1.0+ or the IDE plugin)
- A GitHub account with admin or write access to the repos you want to expose
- Node.js 18+ on your machine (the GitHub MCP server is a Node process)
- About 10 minutes
If you do not have Claude Code yet, see our Claude Code vs Windsurf vs Cursor comparison for context on the IDE landscape before committing.
Step 1: Create the GitHub Personal Access Token
The MCP server authenticates to GitHub on your behalf using a Personal Access Token (PAT). The scopes you grant decide what Claude can see and do.
Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.
Name it something obvious like claude-mcp-{your-name}. Set the expiry to 90 days unless you have a specific reason to extend.
The scopes you need depend on what you want Claude to do:
| Scope | Why you need it |
|---|---|
repo (Contents — read+write) | Read source code, create branches, write files |
pull_request (read+write) | List, create, review, comment on PRs |
issues (read+write) | List, create, comment on issues |
actions (read) | Read CI status if you want Claude to monitor builds |
metadata (read) | Required, granted automatically |
repo and issues and add write scopes when you actually need them. A token with full write access to all your repos is a meaningful blast-radius increase if it leaks.
Generate the token and copy it immediately — GitHub shows it once and never again.
Step 2: Install the GitHub MCP server
The official server is published as @modelcontextprotocol/server-github. Two ways to install:
Option A . One-line via npx (no install, runs on demand):
npx -y @modelcontextprotocol/server-github
This is what Claude Code's config will invoke. You do not need to run it manually , that command just verifies it can be fetched.
Option B . Global install:
npm install -g @modelcontextprotocol/server-github
Faster startup on subsequent Claude Code launches. Slightly less convenient to update.
For 95% of users, Option A is the right pick.
Step 3: Configure Claude Code
Open your Claude Code MCP config. The location depends on platform:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
For the Claude Code CLI, the config lives at ~/.claude/mcp_servers.json (check claude --help for the version-specific path if you are unsure).
Add the GitHub MCP server block:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_yourTokenHere"
}
}
}
}
Replace ghp_yourTokenHere with the token from Step 1. Save the file.
If you already have other MCP servers configured (Linear, Notion, Postgres, etc.), nest the github block alongside them inside the existing mcpServers object , do not create a second mcpServers key.
Restart Claude Code. The CLI picks up the new config on relaunch.
Step 4: Verify the connection
In Claude Code, type:
list my github repos
Claude should return a list of repositories the token has access to. If you get an error like GitHub MCP server not connected or authentication failed, jump to the Troubleshooting section.
For a deeper sanity check, ask:
list open pull requests in {your-org}/{your-repo}
If you see your real PR list, the integration is live.
The four workflows that justify the setup
Installation gets you nothing on its own. These are the use cases worth the 12 minutes.
Workflow 1: Cross-repo grep with reasoning
Claude with GitHub MCP can search across multiple private repositories and reason about what it finds. "Find every place we still call the deprecated /v1/users/me endpoint across our backend and frontend repos" is a single request. The output is grouped by repo with file paths, line numbers, and a suggested migration.
This used to require either a paid code-search tool or a shell script that cloned everything. With GitHub MCP it is one sentence.
Workflow 2: PR triage and review prep
"Summarize the 8 open pull requests on web-app repo, group them by author, and flag the ones older than 7 days." Claude reads the PR metadata, the diff for each, and produces a triage view. For an engineering manager doing PR review queue cleanup, this saves 20-40 minutes per week.
A more advanced flow: "Review PR #1247 against our internal style guide. Flag anything that violates our naming convention or has a missing test." If you pair this with a custom skill (see Superpowers framework), Claude can do a meaningful first-pass review.
Workflow 3: Issue-to-implementation
"Pick the highest-priority issue from our-org/repo that mentions 'bug', read it, and propose a fix as a draft PR." With write scopes on repo and pull_request, Claude can branch, write the fix, and open a PR with a description. You still review and merge, but the slog of going from issue → fix scaffolding is gone.
Use this carefully. Auto-opened PRs from an AI need clear labels and a clear human-review policy. Some teams add a claude-draft label as a guardrail.
Workflow 4: Release notes from real commits
"Generate release notes for the last 30 days of merged PRs in backend repo, grouped by feature, fix, and chore." Claude pulls the commit history and PR titles, classifies them, and produces a readable changelog. This used to be a manual half-day job before each release.
Pair with a release-automation skill or just paste the output into your release page.
Troubleshooting
"GitHub MCP server not connected"
Most common cause: the config JSON has a syntax error. Run it through a JSON linter. The second most common cause is a typo in the command or args field.
Less common: Node.js isn't on the PATH that Claude Code uses. On macOS this happens when Claude Code is launched outside the terminal and inherits a slim PATH. Fix: add the full path to npx in the command field (/usr/local/bin/npx or wherever your install lives).
"authentication failed" or "401 Unauthorized"
The token is wrong, expired, or has the wrong scopes. Regenerate the token with the scopes from Step 1 and update the config. Tokens with insufficient scope produce confusing errors , "resource not accessible" usually means the token can authenticate but cannot read a specific resource type.
"resource not accessible by personal token"
This is a fine-grained token scope issue. Fine-grained tokens require you to explicitly grant repository access on top of permission scopes. Go back to the token settings and confirm the repos you want Claude to see are listed under "Repository access." The default of "All repositories" is the simplest start.
Claude returns stale data
The MCP server is stateless and queries GitHub live, so this should not happen. If it does, restart Claude Code , the MCP process sometimes caches inside Claude's tool layer in a way that survives a single session.
Security notes
- Treat the PAT like a password. Do not commit the config file to a repo.
- 90-day expiry is the right default. Annual rotation is too long for a token with write access.
- If you grant
repowrite to the token, Claude can technically push to any repo the token can access. Use the fine-grained token's repository-allowlist feature to scope this down. - The MCP server runs locally on your machine , it does not proxy through Anthropic. The token never leaves your laptop.
For a deeper take on agent skill security, see our skill security audit guide.
What about GitHub Copilot's own MCP integration?
GitHub has its own MCP-style integrations inside Copilot Workspace and Copilot Chat. Those are not the same as the official server-github MCP , they live inside GitHub's products and do not work with Claude Code. The MCP server in this guide is the one to install if you are working in Claude Code.
FAQ
Does it work with GitHub Enterprise? Yes, but you need to set GITHUB_API_URL in the env block to point at your Enterprise instance. Documented in the server-github README.
Can I use this with org SAML SSO? The PAT needs to be authorized for the SAML-protected org. Go to the token, click "Configure SSO," and authorize each org you need access to.
Will it work in the Claude Code CLI and the desktop app at the same time? Yes. The MCP config is read independently by each. Some teams keep separate tokens for CLI vs desktop for blast-radius control.
Does the MCP server cost anything? No. The server itself is open source. You pay only for Claude usage and whatever GitHub plan you already have.
Is there a Linear MCP I can install alongside this? Yes, we covered that one in how to install Linear MCP. The two integrations stack . Claude can read GitHub PRs and update Linear tickets in the same conversation.
What if I want Claude to do code review automatically on every PR? That is GitHub Actions territory. The MCP integration is interactive , for hands-off automation, look at the Claude API and GitHub Actions integration.
Share this article
📄Related Articles
Get More AI Tool Guides
New comparisons and guides every week. Join thousands of professionals staying ahead of the AI curve.