Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

640 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PRDifferMCP

Python Version License PR Quality

A Model Context Protocol (MCP) server that provides comprehensive GitHub Pull Request diff analysis with full file context for AI assistants and code review tools.

Overview

PRDifferMCP is an MCP server that extracts and analyzes GitHub PR diffs, providing AI assistants with rich context for code review, analysis, and assistance. Unlike standard diff tools that only show changed hunks, PRDifferMCP provides full-file context, commit messages, and intelligent file filtering.

Key Features

  • Full-File Context Diffs: See entire files with changes, not just hunks
  • Commit Message Integration: Access PR commit history and messages
  • Intelligent File Filtering: Pattern-based filtering to focus on relevant files
  • Smart Caching: Commit-based cache invalidation ensures fresh data with optimal performance
  • Security First: Comprehensive input validation, rate limiting, and authentication support
  • Multiple Transport Modes: Support for stdio, HTTP, SSE, and streamable-HTTP
  • Async Architecture: Built with anyio for efficient concurrent processing
  • Clean Architecture: Domain-driven design with clear separation of concerns

Quick Start

Prerequisites

  • Python 3.14 or higher
  • uv package manager (recommended) or pip
  • GitHub Personal Access Token (for authenticated requests)

Installation

# Clone the repository
git clone https://github.com/OCWorkforces/PRDifferMCP.git
cd PRDifferMCP

# Install dependencies with uv (recommended)
uv install

# Or with pip
pip install -e .

Basic Usage

  1. Set your GitHub token:
export GITHUB_TOKEN=ghp_your_token_here
  1. Start the MCP server:
./start-prdiffer-mcp-server.sh

Accessing the MCP Server

Add to Claude Code

claude mcp add --transport http prdiffer http://127.0.0.1:9102/mcp

Add to OpenCode

File opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "prdiffer": {
      "type": "remote",
      "url": "http://127.0.0.1:9102/mcp",
      "enabled": true
    }
  }
}

AI Agent Skill

PRDifferMCP ships with an Agent Skill that teaches AI coding assistants how to use prdiffer__get_pr_diff, prdiffer__approve_pr, and prdiffer__describe_pr MCP tools effectively. The skill provides tool signatures, structured return type documentation, common workflows, error handling patterns, and constraints — so your AI agent can analyze PRs without guessing.

Install the Skill

npx skills add OCWorkforces/PRDifferMCP

This installs the skill to all detected AI coding agents. For specific agents:

# Claude Code only
npx skills add OCWorkforces/PRDifferMCP -a claude-code

# OpenCode only
npx skills add OCWorkforces/PRDifferMCP -a opencode

# Multiple agents
npx skills add OCWorkforces/PRDifferMCP -a claude-code -a opencode -a cursor

Supported Agents

The skill is compatible with 50+ AI coding agents including:

Agent Install Flag Skill Path
Claude Code claude-code .claude/skills/
OpenCode opencode .agents/skills/
Cursor cursor .agents/skills/
Windsurf windsurf .windsurf/skills/
GitHub Copilot github-copilot .agents/skills/
Cline cline .agents/skills/
Gemini CLI gemini-cli .agents/skills/
Codex codex .agents/skills/

For a complete list, see skills.sh.

What the Skill Teaches Your Agent

After installation, your AI agent will know:

  • When to use each tool — trigger phrases like "analyze this PR" or "approve this PR" activate the skill
  • Tool signatures — exact parameter names, types, and whether they're required
  • Return types — the structured PRDiffFileDiffResponseFileStats shape with field-level documentation
  • Error handling — error codes (E1001, E2002, E3001, E5002) and recovery strategies
  • Common workflows — analyze changes, review & approve, summarize & describe, extract statistics
  • Constraints — URL format requirements, authentication, rate limiting, caching behavior

How It Works

The skill's SKILL.md (located at skills/prdiffer/SKILL.md) activates automatically when your AI agent encounters trigger phrases like "get PR diff", "analyze pull request", or "approve this PR". The agent then uses the documented MCP tool signatures to call the PRDiffer server without guesswork.

The MCP server must still be running separately (./start-prdiffer-mcp-server.sh) — the skill only teaches the agent how to call the tools, not run them.

Learn More

Using the Skill with AI Coding Agents

Once the prdiffer skill is installed and the MCP server is running, you can prompt your AI coding agent naturally. The skill activates automatically and drives the right MCP tool calls. Below are ready-to-use prompts — one per tool.


prdiffer__get_pr_diff — Fetch & Analyze a PR

Strict full-context diffs: Successful responses include every selected file with generated full-context diff text and optional previous_path on renames. Incomplete inventories, oversize/binary content, or generation failures return E5020_FULL_DIFF_INCOMPLETE with a stable reason — never a partial files list.

Use this to retrieve the full structured diff and perform a thorough code review.

Prompt your agent:

Use the prdiffer skill to get the full diff from https://github.com/<owner>/<repository>/pull/<pull_number>, then analyze it thoroughly across multiple aspects — architecture, correctness, security, test coverage, and style — and produce a comprehensive PR review with specific inline observations and actionable recommendations.

The agent will call prdiffer__get_pr_diff, iterate over every FileDiffResponse in the result, and synthesize a structured review covering changed files, addition/deletion statistics, and full patch content.


prdiffer__approve_pr — Review and Approve a PR

Use this after analyzing a PR to submit a formal approval with a meaningful compliment.

Prompt your agent:

Use the prdiffer skill to fetch the diff for https://github.com/<owner>/<repository>/pull/<pull_number>, verify the changes look correct and safe, then approve the PR with a genuine, specific compliment that references what was done well.

The agent will call prdiffer__get_pr_diff to inspect the changes, then invoke prdiffer__approve_pr with a compliment derived from the actual diff content (e.g., praising a clean refactor or solid test coverage).


prdiffer__describe_pr — Auto-Generate a PR Description

Use this to write or update the PR body with an accurate summary generated from the actual diff.

Prompt your agent:

Use the prdiffer skill to fetch the diff for https://github.com/<owner>/<repository>/pull/<pull_number>, then generate a clear, structured PR description covering the motivation, a summary of changed files, and a testing checklist. Update the PR body with the generated description.

The agent will call prdiffer__get_pr_diff to understand what changed, compose a Markdown description (motivation, file-level summary, testing notes), and submit it via prdiffer__describe_pr.


Tip: You can combine all three in a single prompt:

"Fetch the diff for https://github.com/<owner>/<repo>/pull/<number>, write a comprehensive review, generate a structured description and update the PR body, then approve it if everything looks good."

About

Github PR Full Diff Generator MCP Server

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages