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.
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.
- 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
- Python 3.14 or higher
uvpackage manager (recommended) or pip- GitHub Personal Access Token (for authenticated requests)
# 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 .- Set your GitHub token:
export GITHUB_TOKEN=ghp_your_token_here- Start the MCP server:
./start-prdiffer-mcp-server.shclaude mcp add --transport http prdiffer http://127.0.0.1:9102/mcpFile opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"prdiffer": {
"type": "remote",
"url": "http://127.0.0.1:9102/mcp",
"enabled": true
}
}
}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.
npx skills add OCWorkforces/PRDifferMCPThis 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 cursorThe 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.
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
PRDiff→FileDiffResponse→FileStatsshape 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
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.
- skills.sh — Discover more agent skills
- skills/prdiffer/SKILL.md — Read the full skill definition
- Agent Skills Specification — How skills work across 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.
Strict full-context diffs: Successful responses include every selected file with generated full-context
difftext and optionalprevious_pathon renames. Incomplete inventories, oversize/binary content, or generation failures returnE5020_FULL_DIFF_INCOMPLETEwith a stablereason— never a partialfileslist.
Use this to retrieve the full structured diff and perform a thorough code review.
Prompt your agent:
Use the
prdifferskill to get the full diff fromhttps://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.
Use this after analyzing a PR to submit a formal approval with a meaningful compliment.
Prompt your agent:
Use the
prdifferskill to fetch the diff forhttps://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).
Use this to write or update the PR body with an accurate summary generated from the actual diff.
Prompt your agent:
Use the
prdifferskill to fetch the diff forhttps://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."