PR-Reviewer-Claude-MCP-Server

shaktimaan00/PR-Reviewer-Claude-MCP-Server

3.2

If you are the rightful owner of PR-Reviewer-Claude-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server facilitates seamless communication between various platforms and language models, enabling efficient code analysis and documentation workflows.

PR Reviewer (MCP Demo Project)

A Model Context Protocol (MCP)–powered server that connects Claude Desktop, GitHub, and Notion to automate pull-request reviews.
It fetches PR diffs from GitHub, uses Claude to analyze code changes, and publishes review summaries to Notion.


Table of Contents


Features

  • Standardized AI integration via Anthropic’s Model Context Protocol
  • GitHub PR fetching: retrieves PR metadata and file diffs
  • Automated code analysis: uses Claude Desktop as the LLM client
  • Notion publishing: creates a Notion page for each review
  • Modular & transport-flexible: works over stdio, WebSockets, HTTP-SSE, UNIX sockets

Prerequisites

  • Python 3.10+
  • uv package manager (recommended)
  • A GitHub account with a Personal Access Token
  • A Notion workspace with an Internal Integration

Installation

  1. Install uv (Mac/Linux):
    curl -LsSf https://astral.sh/uv/install.sh | sh
    

Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. Initialize your project:

    uv init pr_reviewer
    cd pr_reviewer
    
  2. Create & activate a virtual environment:

    • macOS/Linux:

      uv venv
      source .venv/bin/activate
      
    • Windows:

      .venv\Scripts\activate
      
  3. Install dependencies:

    uv add "mcp[cli]" requests python-dotenv notion-client
    # or, if you prefer pip:
    pip install mcp[cli] requests python-dotenv notion-client
    
  4. (Optional) pin dependency versions in requirements.txt and install:

    requests>=2.31.0
    python-dotenv>=1.0.0
    mcp[cli]>=1.4.0
    notion-client>=2.3.0
    
    pip install -r requirements.txt
    

Configuration

Create a .env file in the project root with the following keys:

GITHUB_TOKEN=your_github_token
NOTION_API_KEY=your_notion_api_key
NOTION_PAGE_ID=your_notion_page_id
  • GITHUB_TOKEN: a classic Personal Access Token with repo and repo_hook scopes.
  • NOTION_API_KEY & NOTION_PAGE_ID: from your Notion internal integration.

Project Structure

pr_reviewer/
├── .env
├── github_integration.py     # Fetches PR metadata & diffs
├── pr_analyzer.py            # MCP server: tools & run loop
├── requirements.txt          # (optional) pinned deps
├── README.md                 # ← this file
└── .venv/                    # virtual environment

Usage

Once configured:

# Activate your venv if not already active
source .venv/bin/activate

# Start the MCP server
python pr_analyzer.py

Then, from Claude Desktop (or any MCP client), invoke the registered tools:

  1. Fetch a PR

    { "tool": "fetch_pr", "args": ["owner", "repo", 42] }
    
  2. Create a Notion page

    { "tool": "create_notion_page", "args": ["PR-42 Review", "Here’s the summary…"] }
    

The server will stream results over stdio (or your chosen transport) back to the LLM client.


Environment Variables

VariableDescription
GITHUB_TOKENGitHub Personal Access Token (repo, repo_hook)
NOTION_API_KEYNotion integration secret
NOTION_PAGE_IDID of the page or database where reviews are posted

Extending & Contributing

  • Add new MCP tools by decorating methods with @self.mcp.tool() in pr_analyzer.py.
  • Support other transports (WebSockets, HTTP-SSE) via self.mcp.run(transport="…").
  • Pull requests are welcome! Please follow standard Python coding conventions and update this README as needed.

License

This project is released under the MIT License. See for details.