This guide walks through how to connect Claude to GitHub via an MCP (Model Context Protocol) server, enabling Claude to review PRs, comment on issues, and assist with testing workflows.
-
Claude Desktop (v0.7.0 or later) or Anthropic workspace supporting MCP.
-
A valid GitHub Personal Access Token (PAT) with the required scopes.
-
Access to the Claude configuration file:
~/.config/claude/claude.json
Before connecting Claude to GitHub, create a Personal Access Token that Claude can use for API authentication.
-
Go to your GitHub settings: https://github.com/settings/tokens
-
Click “Fine-grained personal access tokens” (recommended). Then click “Generate new token” → “Fine-grained token”
-
Configure the token:
-
Name:
Claude MCP Access -
Expiration: Choose a suitable duration (e.g., 90 days)
-
Repository access: Select either
- All repositories (if Claude will access multiple repos), or
- Only selected repositories (recommended for security)
-
Permissions: Grant Read-only access for:
ContentsPull requestsMetadata- (Optional)
Issuesif you want Claude to comment on or view issues.
-
-
Click Generate token and copy the value. It will look like this:
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
⚠️ Important: Store this token securely. Once you leave the page, you won’t be able to view it again.
Now that you have your PAT, configure Claude to connect to GitHub.
Run the following command (or manually edit your config file):
claude mcp add github \
--type http \
--url https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer <YOUR_GITHUB_PAT>"This adds a new entry under the "mcpServers" section in your claude.json:
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer github_pat_xxxxxxxxx"
}
}
}✅ Tip: Verify the MCP server was added correctly with:
claude mcp list
Once the MCP server is configured, Claude can directly access GitHub content.
For example, ask:
“Review the pull request #15874 in the
Katello/katellorepository.”
Claude will:
- Retrieve PR details from GitHub via MCP
- Analyze diffs, comments, and files
- Provide a structured review (feedback, suggestions, and test coverage insights)
You can extend Claude’s capabilities with custom agents specialized in tasks such as edge case testing.
-
Open Agents in Claude.
-
Click “Add Agent” → “Custom”
-
Configure it with:
-
Name:
PR Edge Tester -
Purpose:
Analyze PRs for edge cases, untested scenarios, and hidden regressions. -
Skills:
GitHub MCP integration, testing mindset, code review best practices.
-
-
Save and run it with:
“Run edge case testing on the PR I just reviewed.”
Claude will use the MCP connection to analyze the PR for potential edge cases.
Confirm that the MCP server is connected:
claude mcp status githubExpected output:
Connected: true
Endpoint: https://api.githubcopilot.com/mcp/
If you encounter an error:
- Ensure the token is valid and has not expired.
- Check that the header starts with
Bearer. - Make sure there are no extra spaces or line breaks in the token.
To rotate your PAT or remove the GitHub MCP server:
claude mcp remove github
claude mcp add github \
--type http \
--url https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer <NEW_PAT>"-
Add GitHub MCP connection
-
Ask Claude:
“Review PR #1234 in my repository.”
-
Create and run an Edge Tester agent
-
Get a structured summary and testing recommendations
| Issue | Possible Fix |
|---|---|
401 Unauthorized |
Check token validity and scopes. |
| Claude doesn’t access PRs | Ensure repository visibility and proper PAT permissions. |
| MCP not listed | Re-run claude mcp add github and confirm config path. |
Author: Samir Jha Last updated: October 2025