AI-assisted code review tool for developers/AQA engineers
PR Review MCP Server
AI-assisted code review tool for developers/AQA engineers
A Python MCP (Model Context Protocol) server that connects Claude Desktop to GitHub Pull Requests. It fetches PR diffs, filters out binary and asset files (Unity .meta, images, audio, shaders, etc.), and gives Claude only the actual code to review.
Built as a QA automation tool to speed up pull request reviews using AI.
Requirements
- Python 3.11+
- Claude Desktop
Installation
git clone https://github.com/<your-username>/pr-review-mcp.git
cd pr-review-mcp
pip install -r requirements.txt
Authentication
The server looks for credentials in this order:
- Environment variables (
GITHUB_TOKEN,GITHUB_REPO) — for Claude Desktop - OS keychain (via
keyring) — for Claude Code and local development - Interactive prompt — fallback from the terminal
Option A — Keychain (recommended for Claude Code)
Run the server once manually to store your credentials in the OS keychain:
python server.py
You will be prompted for:
- GITHUB_TOKEN — A GitHub Personal Access Token (classic) with
reposcope. Generate one at github.com/settings/tokens. - GITHUB_REPO — The repository in
owner/repoformat (e.g.octocat/Hello-World).
Both values are stored securely in your OS keychain and will not be prompted again.
Option B — Environment variables (recommended for Claude Desktop)
Pass credentials directly in the MCP config (see examples below). This avoids the interactive prompt, which does not work in Claude Desktop's background processes.
Claude Desktop Configuration
Add the following to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"pr-review": {
"command": "python",
"args": ["C:\\path\\to\\pr-review-mcp\\server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_REPO": "owner/repo"
}
}
}
}
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"pr-review": {
"command": "python",
"args": ["/path/to/pr-review-mcp/server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_REPO": "owner/repo"
}
}
}
}
Note: If you already stored credentials in the keychain (Option A), you can omit the
envblock — the server will find them automatically.
After editing the config, restart Claude Desktop.
Claude Code Configuration
Option A — CLI command:
claude mcp add pr-review -- python /path/to/pr-review-mcp/server.py
Option B — create .mcp.json in your project root:
{
"mcpServers": {
"pr-review": {
"command": "python",
"args": ["/path/to/pr-review-mcp/server.py"]
}
}
}
Then restart Claude Code.
Usage
Once configured, Claude Desktop will have two new tools:
- list_open_prs — Lists open PRs in the configured repository.
- get_pr_diff — Fetches the code diff for a specific PR number, filtering out binary/asset files.
Example prompts in Claude Desktop:
- "List open PRs"
- "Review PR #42"
- "What changed in PR #15?"
Reset Tokens
To clear stored credentials and re-enter them:
python server.py --reset
Then run python server.py again to enter new values.
Troubleshooting
Errors are automatically logged to error_report.log in the project directory.
To enable verbose debug logging, add MCP_DEBUG to your config:
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_REPO": "owner/repo",
"MCP_DEBUG": "1"
}
Or set it in your terminal before running manually:
MCP_DEBUG=1 python server.py
Common issues:
latin-1codec error — YourGITHUB_TOKENcontains non-ASCII characters. Make sure you copied the real token, not a placeholder.- Server hangs on startup — Credentials are missing and the server is waiting for interactive input. Use environment variables (Option B) or run
python server.pymanually first to save them to keychain. - 401 Unauthorized — Token is invalid or expired. Run
python server.py --resetand enter a new token.
Architecture
Claude Desktop ──MCP──▶ server.py ──REST API──▶ GitHub
│
keyring (OS)
secure token storage
Описание
MCP-сервер для автоматизации код-ревью пулл-реквестов с помощью Claude AI.
Что это?
Это инструмент для QA-инженеров, который подключает Claude Desktop к GitHub и позволяет ИИ анализировать изменения в пулл-реквестах. Сервер автоматически фильтрует бинарные файлы и ассеты (Unity .meta, текстуры, аудио, шейдеры и т.д.), передавая Claude только код для ревью.
Что умеет?
- list_open_prs — показать список открытых PR в репозитории
- get_pr_diff — получить diff конкретного
Tools (2)
list_open_prsLists open PRs in the configured repository.get_pr_diffFetches the code diff for a specific PR number, filtering out binary/asset files.Environment Variables
GITHUB_TOKENrequiredGitHub Personal Access Token (classic) with repo scopeGITHUB_REPOrequiredThe repository in owner/repo formatMCP_DEBUGEnables verbose debug loggingConfiguration
{"mcpServers": {"pr-review": {"command": "python", "args": ["/path/to/pr-review-mcp/server.py"], "env": {"GITHUB_TOKEN": "ghp_your_token_here", "GITHUB_REPO": "owner/repo"}}}}