GitHub Code Reviewer
This server enables AI-powered code review on GitHub Pull Requests by fetching diffs and posting inline comments.
Fetch PR diffs: Retrieve raw code changes from any GitHub PR using
get_pull_request_diff(providing owner, repo name, and PR number).Post inline review comments: Add Markdown-formatted comments to specific lines of changed files using
post_pr_review_comment.Draft or publish comments: Save comments as pending drafts (
PENDING) for manual approval on GitHub, or publish them immediately (PUBLIC).Guided reviews: Use the
review_prprompt for a structured, step-by-step review covering bugs, security vulnerabilities, performance, code style, and error handling.Autonomous reviews: Use
review_pr_autoto let the AI freely analyze the diff using its own judgment, without a fixed checklist.
Fetches pull request diffs and posts inline review comments on GitHub, supporting both draft and published comments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub Code Reviewer Review PR #42 in octocat/hello-world and post pending comments"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP GitHub Code Reviewer
An MCP (Model Context Protocol) server that gives Claude the ability to fetch Pull Request diffs from GitHub and post inline code review comments directly on the PR — either as a pending draft for you to approve, or published immediately.
How it works
You (Claude Code) ──► MCP Server (src/index.ts) ──► GitHub API
│
Two tools + two prompts exposed:
• get_pull_request_diff
• post_pr_review_comment
• review_pr (prompt — guided)
• review_pr_auto (prompt — autonomous)When running as an MCP server, Claude can call these tools in response to natural language prompts. You describe which PR to review, and Claude fetches the diff, analyzes the code, and posts structured inline comments.
You can also use the built-in review_pr prompt to give Claude step-by-step instructions automatically — no need to describe the process manually each time.
Related MCP server: GitHub PR Reviewer MCP
Prompts available
There are two prompts, each with a different review style:
review_pr — guided review
Instructs Claude to follow a fixed step-by-step process: fetch the diff, analyze it across specific categories, and post inline comments.
Parameter | Type | Required | Description |
| string | yes | GitHub username or organization |
| string | yes | Repository name |
| number | yes | PR number |
| string | no |
|
The prompt instructs Claude to focus on:
Bugs and logic errors
Security vulnerabilities
Performance issues
Code style and readability
Missing error handling
review_pr_auto — autonomous review
Just fetches the diff and lets the LLM review freely using its own judgment — no rigid checklist.
Parameter | Type | Required | Description |
| string | yes | GitHub username or organization |
| string | yes | Repository name |
| number | yes | PR number |
| string | no |
|
Tools available
get_pull_request_diff
Fetches the raw diff of a Pull Request from GitHub.
Parameter | Type | Description |
| string | GitHub username or organization |
| string | Repository name |
| number | PR number |
post_pr_review_comment
Posts an inline review comment on a specific line of a changed file.
Parameter | Type | Description |
| string | GitHub username or organization |
| string | Repository name |
| number | PR number |
| string | File path (e.g. |
| number | Line number where the comment will appear |
| string | Comment text in Markdown |
| string |
|
Prerequisites
Node.js 18+
A GitHub Personal Access Token with
reposcopeClaude Code (to use as an MCP server)
Installation
npm installConfiguration
Create a .env file in the project root:
GITHUB_TOKEN=ghp_YourGitHubTokenHereRunning as an MCP server (Claude Code)
Add this server to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json or via claude mcp add):
{
"mcpServers": {
"github-code-reviewer": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-github-reviewer/src/index.ts"],
"env": {
"GITHUB_TOKEN": "ghp_YourGitHubTokenHere"
}
}
}
}Or start the server manually:
npx -y @modelcontextprotocol/inspector@latest --mode cli npx tsx src/index.tsExample usage
Guided review (step-by-step):
Use the prompt review_pr with owner="seu-usuario", repo="seu-repo", pull_number=42Autonomous review (LLM decides):
Use the prompt review_pr_auto with owner="seu-usuario", repo="seu-repo", pull_number=42Publish comments immediately:
Use the prompt review_pr with owner="seu-usuario", repo="seu-repo", pull_number=42, status="PUBLIC"Manual prompt (without using any built-in prompt):
Review the PR 360 in seu-usuario/seu-repositorio and use post_pr_review_comment with status: "PENDING" so I can double-check everything on GitHub before publishing.
Project structure
mcp-github-reviewer/
├── src/
│ └── index.ts # MCP server — exposes tools to Claude
├── package.json
├── tsconfig.json
└── .env # GITHUB_TOKEN goes hereDependencies
Package | Role |
| MCP server framework |
| GitHub API client |
| Loads |
| Runs TypeScript directly without a build step |
Available Tools
2 toolsget_pull_request_diffA
Fetches the code changes (diff) of a specific Pull Request for analysis.
Inputs: repo (required), owner (required), pull_number (required).
post_pr_review_commentA
Posts a code review comment on a specific line of a file changed in the PR. All comments must be written in English.
Inputs: body (required), line (required), path (required), repo (required), +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one fetches the diff of a PR, the other posts a review comment. There is no overlap or ambiguity.
Both tools follow a consistent verb_noun pattern in snake_case: 'get_pull_request_diff' and 'post_pr_review_comment'. No inconsistencies.
With only 2 tools, the server feels thin for a code reviewer. While the tools are focused, a typical code review workflow would benefit from additional tools like listing PRs or getting PR details.
The tool surface is incomplete for a code reviewer: it lacks CRUD operations for PRs, file listing, approval/request changes, and other common actions. Agents would face dead ends without these.
Maintenance
Related MCP Connectors
Work your users' feedback queue from your editor: triage, approve fixes, ship draft PRs.
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Code review for diffs: rule-based checks for leaked secrets, unsafe migrations and more.
Assess pull requests and read verdicts, findings, evidence and suggested fixes from coding agents.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables retrieval of pull request metadata and diffs from Bitbucket Cloud and Server/Data Center, with optional comment creation.31MIT
- FlicenseAqualityDmaintenanceEnables analysis of GitHub Pull Requests, including details, diff, file lists, and review tracking.3-
- AlicenseNot gradedqualityDmaintenanceEnables reviewing GitHub pull requests via ChatGPT, including listing PRs, viewing diffs, posting comments, approving, and requesting changes.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to autonomously review GitHub Pull Requests by listing PRs, retrieving diffs, and submitting structured reviews.ISC