MCP GitHub Server: PR Reviews and Code Navigation in 2026

Connect Claude or Cursor to GitHub via MCP to review PRs, navigate code, and automate issues — no API wrappers needed. Setup guide with real examples.

Problem: Your AI Assistant Can't See Your GitHub Repos

You ask Claude or Cursor to review a PR. It asks you to paste the diff. You paste it. It loses thread context halfway through. You try again with a different file. This is the workflow in 2025.

The MCP GitHub server fixes this. It gives your AI assistant direct read/write access to your repos — PRs, issues, file trees, commits, branches — without copy-pasting anything.

You'll learn:

  • How to configure the MCP GitHub server in Claude Desktop and Cursor
  • How to use it for PR reviews, code navigation, and issue triage
  • Which permissions to grant and which to skip

Time: 20 min | Difficulty: Intermediate


Why This Happens

AI assistants have no persistent connection to external services unless you wire one up. MCP (Model Context Protocol) is the standard that lets host apps like Claude Desktop or Cursor expose tool calls to the model — including tools that hit the GitHub API.

The official @modelcontextprotocol/server-github package implements those tool calls. Once configured, the model can call get_pull_request, list_issues, search_code, and 20+ other GitHub operations directly in a conversation.

What you need:

  • A GitHub Personal Access Token (classic or fine-grained)
  • Claude Desktop ≥ 0.10 or Cursor ≥ 0.43
  • Node.js ≥ 20 (for npx execution)

Solution

Step 1: Create a GitHub Personal Access Token

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

Set the following repository permissions:

PermissionAccessWhy
ContentsReadFile tree, file contents
Pull requestsRead and writeReview, comment, merge
IssuesRead and writeTriage, label, close
MetadataReadRepo info, branches

For personal repos, set Resource owner to your account. For org repos, select the org — it may require org owner approval.

Copy the token. You won't see it again.

# Test the token before wiring it up
curl -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user

Expected output: JSON with your GitHub username.


Step 2: Install the MCP GitHub Server

The server runs via npx — no global install needed. But confirm Node.js is available:

node --version   # must be 20+
npx --version    # ships with npm 7+

Run it once manually to confirm the package resolves:

npx -y @modelcontextprotocol/server-github --help

Expected output:

MCP GitHub Server
Usage: server-github [options]

If you see ERR_MODULE_NOT_FOUND, your Node version is below 20. Use nvm install 20 && nvm use 20.


Step 3: Configure Claude Desktop

Open your Claude Desktop config file:

# macOS
open ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Windows
notepad %APPDATA%\Claude\claude_desktop_config.json

Add the GitHub server block:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_TOKEN_HERE"
      }
    }
  }
}

Save and fully quit Claude Desktop (Cmd+Q / Alt+F4 — closing the window is not enough). Relaunch it.

You should see a hammer icon in the chat input bar. Click it — github should appear in the tools list.

If it fails:

  • No hammer icon → Check JSON syntax with cat claude_desktop_config.json | python3 -m json.tool
  • spawn npx ENOENT → Claude can't find npx. Use the full path: "command": "/usr/local/bin/npx" (find it with which npx)
  • 401 Unauthorized → Token is wrong or expired. Regenerate it.

Step 4: Configure Cursor

In Cursor, open Settings → Cursor Settings → MCP → Add new MCP server.

Fill in:

  • Name: github
  • Type: command
  • Command: npx -y @modelcontextprotocol/server-github
  • Environment variables: GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_TOKEN_HERE

Save. Cursor will show a green dot next to the server name when it connects. If it stays red, check the Cursor output panel (View → Output → MCP) for the error.


Step 5: Run a PR Review

Open a new Claude conversation and try this prompt:

Review the open PRs in [owner/repo]. For the most recent one,
summarize the changes and flag any potential bugs or missing tests.

Claude will call list_pull_requests, then get_pull_request for the diff, then respond with a structured review. No copy-pasting.

For a specific PR by number:

Review PR #42 in [owner/repo]. Check for:
- Type safety issues in the TypeScript files
- Missing error handling in async functions
- Any changes to public API surface that need docs updates

Step 6: Navigate Code

The server's search_code and get_file_contents tools make repo navigation fast.

Find all usages of a function:

Search [owner/repo] for all usages of the `processWebhook` function.
Show me which files call it and with what arguments.

Understand an unfamiliar file:

Read the file src/lib/auth/session.ts in [owner/repo] and explain
what it does. What are the edge cases in the token refresh logic?

Compare a branch to main:

List the commits on the feature/payments branch in [owner/repo]
that aren't on main. Summarize what the branch adds.

Verification

Confirm the server is working end-to-end:

List the last 5 open issues in [owner/repo] and group them by label.

You should get a structured list pulled live from GitHub. If you see Claude making up issue titles instead of fetching them, the MCP server isn't connecting — check the tool list in the hammer menu.


What You Learned

  • MCP gives AI assistants live GitHub access without API wrappers or copy-paste
  • Fine-grained tokens are safer than classic tokens — scope to only the repos you need
  • npx -y keeps the server up to date automatically on each launch
  • The server has 20+ tools; PR review and code search are the highest-value ones for daily use

Limitation: The MCP GitHub server can read and write, so treat the token like a password. Store it in a secrets manager for team setups rather than hardcoding it in config files.

Tested on @modelcontextprotocol/server-github 0.6.2, Claude Desktop 0.10.x, Cursor 0.43, Node.js 20.11, macOS 15 and Ubuntu 24.04