Learn Claude Code: Tool Integrations GitHub: Code Reviews and Issue-Driven Development

GitHub: Code Reviews and Issue-Driven Development

Intermediate 🕐 14 min Lesson 2 of 11
What you'll learn
  • Create a fine-grained GitHub personal access token with the right repository scopes for Claude Code
  • Connect the GitHub MCP server using a Bearer token header and verify it at user scope
  • Use the GitHub MCP to review pull requests, implement features from issues, and create linked PRs

The PR review that requires three tab switches before you can ask a question

Pull request review is one of the most common tasks where developers switch between Claude and a browser tab. You open the PR on GitHub, read the diff, copy the relevant sections, switch to Claude, paste them in, and ask for feedback. If the PR references an issue, you open that too, copy the description, and add it to the prompt. By the time you have the context assembled, several minutes have passed and you've barely started the actual review.

The GitHub MCP server makes Claude a direct participant in your GitHub workflow. Instead of copying diffs and issue descriptions, you ask Claude to read them. Claude calls the server, retrieves the data, and responds — no tab switching required.

How the GitHub MCP server authenticates

GitHub's remote MCP server uses a personal access token passed as a Bearer token header. This is simpler than OAuth: you create a token once, pass it when you add the server, and Claude Code includes it in every request automatically.

The server is hosted at https://api.githubcopilot.com/mcp/ — note the trailing slash, which is required. The token needs to have access to the repositories you want Claude to work with.

Creating a fine-grained personal access token

Fine-grained tokens scope their permissions to specific repositories rather than your entire account, which makes them a better choice than classic tokens for MCP use.

To create one, go to github.com/settings/personal-access-tokens and generate a new fine-grained token. Choose the repositories you want Claude to access, then grant these permissions under Repository permissions:

  • Contents: Read-only (lets Claude read files and diffs)
  • Pull requests: Read and write (lets Claude review and create PRs)
  • Issues: Read and write (lets Claude read issue descriptions and create new issues)

Copy the token immediately — GitHub shows it only once. Store it in your password manager before proceeding.

Adding the server

Run this command, replacing YOUR_PAT with the token you just created:

claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_PAT"

To make the server available across all your projects rather than just the current one, add --scope user:

claude mcp add --scope user --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_PAT"

Verify with claude mcp list. You should see ✓ Connected next to github. If you see ✗ Failed to connect with an authentication error, check that the token is correct and has not expired.

Key workflows

Once connected, these prompts work without any copying or tab switching:

Review a pull request:

Review PR #456 in owner/repo and suggest improvements. Focus on error handling and test coverage.

Claude reads the diff, the PR description, and any linked issues, then responds with specific, line-referenced suggestions.

Implement from an issue:

Read issue #89 in owner/repo and implement the feature it describes in the current codebase.

Claude reads the issue body, acceptance criteria, and any comments, then writes the implementation directly in your local files.

Create a linked pull request:

Create a PR for the changes I just made. Link it to issue #89. Write a description that summarizes what changed and why.

Claude creates the PR on GitHub with your local branch, writes the description, and links the issue so it closes automatically on merge.

Search code:

Search for all places in owner/repo where we call the payments API and list the files.

Claude searches the repository and returns file paths with relevant context — useful when you are exploring an unfamiliar codebase.

What the GitHub MCP actually sends Claude

When Claude calls a GitHub MCP tool, it receives the content of the specific resource it requested: a PR diff, an issue body, a list of comments. It does not receive a full clone of your repository. The server acts as a structured API to GitHub's data, not a filesystem mirror.

This matters for prompting: if you want Claude to review a PR in the context of the surrounding code, combine the GitHub MCP (for the PR diff and issue context) with the files already in your local working directory (which Claude can read directly). The combination gives Claude both the change and the code it fits into.

Key takeaways
  • A fine-grained personal access token scoped to specific repositories is the right credential for GitHub MCP — it limits blast radius compared to a classic token with full account access.
  • Adding the server at user scope with <code>--scope user</code> makes it available across all your projects without re-adding it each time.
  • The GitHub MCP server reads PRs, issues, and code directly — eliminating the copy-paste loop that makes PR review slow when done through chat.
  • Combining GitHub MCP context (PR diff, issue body) with local files (the surrounding code) gives Claude the most useful review context.
  • Claude can create PRs and issues through the server — the full review-and-create loop happens in one session without leaving your terminal.