guide

How to Connect Claude Code to the GitHub MCP Server

Connect Claude Code to GitHub in under 5 minutes using the official GitHub MCP server. Beginner guide — manage issues, PRs, and repos by chat.

Caleb NorthBy Caleb North · The ship-it engineerMay 10, 2026
Verified May 2026

Caleb North is a fictional AI persona, not a real person. This article was written by AI and reviewed by a human editor before publishing. How we work →

How to Connect Claude Code to the GitHub MCP Server

You have installed and your code already lives on GitHub. Right now those two things are separate — Claude works on your files locally, and GitHub is where you push when you're done. The GitHub MCP server closes that gap.

Once it's connected, Claude can read your open issues, summarize pull requests, search your repo, and take action — all from a chat prompt. No browser switching, no copy-pasting issue text.

This guide covers the setup from scratch: creating a GitHub token, running the install command, and three real examples so you can see what changes immediately.

What You Need Before Starting

  • Claude Code installed and working (Windows guide / Mac guide)
  • A GitHub account with at least one repository
  • 5 minutes

Claude Code requires a Pro subscription ($20/month) or API credits — MCP support is included with all Claude Code plans (Pro, Max, Team, Enterprise, and API). There is no separate fee to use MCPs once you have Claude Code access.

If you've never set up an MCP before, What Is MCP? gives you the 2-minute background. It's not required reading, but it'll help this make more sense.

Step 1 — Create a GitHub Personal Access Token

The GitHub MCP server talks to GitHub on your behalf using a Personal Access Token (PAT). Think of it as a password you create specifically for this connection — you can revoke it any time without touching your main GitHub login.

Go to github.com → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.

Fill in:

  • Token name: claude-code-mcp (or anything you'll recognize)
  • Expiration: 90 days is a reasonable default
  • Repository access: Select the repos you want Claude to access, or choose "All repositories"

Under Permissions, enable:

  • Contents — Read and write (lets Claude read files and commit changes)
  • Issues — Read and write (lets Claude read, create, and close issues)
  • Pull requests — Read and write (lets Claude read and comment on PRs)
  • Metadata — Read-only (required for all fine-grained tokens)

Click Generate token and copy it immediately. GitHub only shows it once.

Step 2 — Add the GitHub MCP Server to Claude Code

Open your terminal — the same one where you run claude. Run this command, replacing YOUR_TOKEN with the token you just copied:

claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_TOKEN"}}'

That's the HTTP transport approach — no Docker, no local server process to manage. The MCP server runs on GitHub's infrastructure and Claude talks to it over HTTPS. The server name (github) is what Claude Code will use to identify this connection.

After running it, verify the server registered correctly:

claude mcp list

You should see github in the output with a status of connected or active. If it shows an error, double-check that your token was copied without any extra spaces.

Step 3 — Test the Connection

Start a Claude Code session in any project directory:

claude

Try a simple prompt first to confirm the connection works:

List the open issues in my repo [owner/repo-name]

Replace [owner/repo-name] with your actual GitHub username and repository name (for example, your-username/my-project). Claude will call the GitHub MCP, fetch the issues, and return them in the chat. If you see your actual issues listed, everything is working.

What Claude Can Actually Do Now

Here are three things worth trying right away. These go from simple reads to taking real action.

Summarize open pull requests

Summarize all open PRs in [owner/repo]. Tell me which ones look ready to merge and which ones have unresolved review comments.

This is useful when you come back to a project after a break and need to orient yourself quickly. Claude reads every open PR, scans the comments, and gives you a status summary — faster than clicking through each one in the browser.

Close a resolved issue

The bug described in issue #42 in [owner/repo] is fixed. Close it and leave a comment saying "Fixed in the latest commit."

Claude will call the GitHub API to post the comment and close the issue. The write permissions you granted in the PAT are what make this work.

Search your codebase by topic

Search [owner/repo] for any files that handle authentication. List the file paths and give me a one-line summary of what each one does.

This uses GitHub's code search rather than a local file read, which means it works even on repos you haven't cloned locally. Useful for orienting yourself on a new codebase before you start making changes.

Troubleshooting

"Permission denied" or "Resource not accessible" — Your PAT is missing a required scope. Go back to GitHub → Settings → Developer settings, find the token, and check that Issues, Pull requests, and Contents are all enabled with read/write access.

"Server not found" after claude mcp list — The install command may not have saved. Re-run the claude mcp add-json command and check for typos in the URL.

Claude says it can't find the repo — Make sure you're using the format owner/repo-name, not just repo-name. For example, anthropics/claude-code not just claude-code.

Token expired — Fine-grained PATs have expiration dates. If the connection stops working after a few months, generate a new token and re-run the claude mcp add-json command with the updated token.

What to Try Next

The GitHub MCP is one of the most immediately useful MCPs for anyone already on GitHub. Once you're comfortable with it, the Figma MCP guide is a natural next step if you work with designs — it's the same pattern: one token, one command, and Claude gains access to a whole new surface.

If you want to see what other MCPs are worth installing, Best MCP Servers for Beginners has five picks with setup steps for each.

The StackBrief weekly

New reviews and the AI-coding-tool news worth knowing — with our take. One email a week, unsubscribe anytime.

Keep reading