GitHub PR Review MCP

December 17, 2024 ยท View on GitHub

A Model Context Protocol (MCP) server for reviewing GitHub pull requests.

Setup

  1. Clone the repository
  2. Create virtual environment:
uv venv
source .venv/bin/activate
  1. Install dependencies:
uv pip install -e .
  1. Copy .env.example to .env and add your GitHub token:
cp .env.example .env
# Edit .env with your GitHub token

Connect to Claude Desktop

  1. Install Claude Desktop

  2. Configure Claude Desktop to use this MCP server. Edit the configuration file:

MacOS:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows:

code %AppData%\Claude\claude_desktop_config.json
  1. Add the server configuration:
# Start of Selection
{
    "mcpServers": {
        "github-review": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/github-review-mcp",  # Replace with your project's absolute path
                "run",
                "github-review"
            ],
            "env": {
                "GITHUB_TOKEN": "your_github_token_here"  # Replace with your GitHub token
            }
        }
    }
}
# End of Selection
  1. Restart Claude Desktop

Development and Testing

Use MCP Inspector for development and testing:

# Test the server using Inspector
npx @modelcontextprotocol/inspector uv run github-review

The Inspector provides:

  • Interactive testing of tools and prompts
  • Real-time logs and debugging information
  • Request/response inspection
  • Server connection status

Features

  • Review GitHub pull requests
  • Get PR summaries
  • View PR comments and review history
  • Analyze code changes

Usage

In Claude Desktop:

  1. Using tools:
Could you help me review this pull request: https://github.com/owner/repo/pull/123
  1. Using prompts:
/code-review https://github.com/owner/repo/pull/123
/summarize-pr https://github.com/owner/repo/pull/123