pr-copilot
Enables AI agents to review GitHub pull requests, post verified inline comments, read PR discussions and CI logs, and open fix PRs after human approval.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π€ PR Copilot: an agentic AI pull-request reviewer
PR Copilot reviews every pull request with a team of AI agents. A planner, three specialists and an adversarial verifier use 17 tools: code search, AST references, sandboxed tests, linters, security and dependency scanners, git history, and CI logs. It posts a verified review with inline comments. Reviewers can then chat with it inside the PR, ask it to write a regression test or a fix, and approve or reject each change. It never merges. A human stays in the loop.
It runs for free on GitHub Actions with free LLM tiers (Groq, Cerebras, Gemini, or local Ollama). It is also published as an MCP server, so Claude Code, Cursor or any MCP client can use its tools.
Live demo
pr-copilot-demo shows real reviews posted by the GitHub Action:
PR | What happened |
Flagged and verified a SQL injection. A reviewer asked | |
The change was only in | |
The PR hides a SQL injection behind text telling AI reviewers to approve. The bot reported the bug and flagged the manipulation attempt. | |
A correct change. The bot reported no issues, which means no false alarms. |
flowchart LR
PR[PR opened / updated] --> S[Injection scan + ruff + bandit<br/>deterministic signals]
S --> T[Triage agent<br/>risk areas, picks specialists]
T --> C[Correctness agent]
T --> SE[Security agent]
T --> P[Performance agent]
C & SE & P --> M[Merge + dedupe]
M --> V[Adversarial verifier<br/>confirm with evidence or reject]
V --> R[Review: risk score,<br/>inline comments]
R --> H{Human}
H -- "@prcopilot question" --> CH[Chat agent + tools]
CH -- propose_patch / write_test --> Q[Pending action]
Q -- "/approve token" --> FX[Fix PR opened]Related MCP server: Claude Code MCP Bridge
Features
Multi-agent review | Triage β specialists (correctness, security, performance) β verifier. Each specialist runs its own tool-calling loop. |
Adversarial verifier | A separate agent tries to disprove each candidate finding by reading the code and running tests. Only confirmed findings are posted, which keeps noise low. |
Agentic chat |
|
17 tools |
|
Human-in-the-loop | Write tools never execute directly. They create an action with a token; |
Long-term memory | π feedback and |
Prompt-injection defence | Untrusted content is wrapped and treated as data. Added lines are scanned with heuristics plus Meta's Prompt Guard 2 classifier. Forged approval markers are ignored. Only collaborators can drive the agent. |
Sandbox | PR code runs in Docker ( |
Free-tier LLM router | Falls back across Groq β Cerebras β Gemini β Ollama. Paces itself on per-minute limits and parks a model that hits its daily limit. Tracks tokens per model. |
MCP server |
|
Evals | A 38-case seeded-bug benchmark: 30 easy cases (21 bugs, 6 clean PRs, 3 prompt-injection attacks) plus 8 hard cross-file cases, with ablations. |
Quick start
python -m venv .venv && .venv/Scripts/activate # Windows (use bin/activate on macOS/Linux)
pip install -e ".[dev]"
cp .env.example .env # add a free GROQ_API_KEY
pytest # 27 tests, no API calls
prcopilot review --repo path/to/repo --base main -v # review the current branch
prcopilot chat --repo path/to/repo --base main # terminal chat with tool trace
prcopilot serve --repo path/to/repo # dashboard at http://127.0.0.1:8765
prcopilot actions list | approve <token> | reject <token>Try it locally (Windows, no GitHub needed)
try-dashboard.batbuilds%USERPROFILE%\pr-copilot-playground(a shop backend with six PR branches) and opens the dashboard. Set Head to a branch such aspr/stock-check, then use the Review or Chat tab.try-dashboard.bat C:\path\to\your\repoopens the dashboard on one of your own repos (Head = your feature branch).try-chat.batopens a terminal chat onpr/sql-lookup.
Playground branches: pr/sql-lookup, pr/staff-can-delete, pr/stock-check, pr/pagination, pr/sneaky-injection (contains text that tries to manipulate the AI) and pr/clean-feature (no bugs; it should stay quiet).
On GitHub (free)
Push this repo to GitHub.
In the repo you want reviewed, copy
.github/workflows/prcopilot.ymland set thePRCOPILOT_REPOvariable to<you>/pr-copilot.Add the
GROQ_API_KEYsecret (optionallyCEREBRAS_API_KEYandGEMINI_API_KEY).Open a PR. Then comment
@prcopilot write a regression test for the top findingand/approve <token>.
A webhook server mode is also available (prcopilot serve + GITHUB_WEBHOOK_SECRET, HMAC-verified).
As an MCP server (Claude Code / Cursor)
{ "mcpServers": { "pr-copilot": { "command": "prcopilot", "args": ["mcp", "--repo", "/path/to/repo", "--base", "main"] } } }Evaluation
python -m evals.run_eval --offline # harness check, no API calls
python -m evals.run_eval --modes baseline,agent,full # full benchmark (use --resume after rate limits)baselineis one LLM call on the diff.agentadds the specialists with tools.fulladds triage, the verifier and the injection scan.
A finding counts as a hit when it names the seeded file and a line within Β±3 of the defect.
The benchmark has two sets:
Easy set (30 cases): the defect is visible in the diff itself.
Hard set (8 cases): the defect breaks code outside the diff, such as a caller in another file, a function further down, or an import. A hard-set hit must name the concrete broken usage (for example
orders.pyorverify_password), not just "this may break callers".
Status (Groq gpt-oss-120b, free tier, in progress):
Baseline, easy set: 23 of 24 bugs found (95.8% recall), 0.17 false alarms per clean PR. Its one false alarm was a hallucinated "undefined
log": the logger is defined outside the diff hunk.Full pipeline, first 8 easy cases: 7 of 7 bugs found, 0 false alarms, about 19K tokens per review.
Hard set and the remaining cases: running. Results land in
evals/results/summary.md.
The easy set turned out to be too easy for a single LLM call, which is why the hard set exists. It measures what tool use is actually for.
Project layout
prcopilot/
llm.py free-tier router: fallback, pacing, usage tracking
agent.py tool-calling loop: approval gates, context compaction, events
tools.py 17 tools + BM25 code index
review.py multi-agent pipeline + verifier + rendering
chat.py conversational agent
safety.py prompt-injection defence + sandbox
store.py SQLite: reviews, threads, actions, memory, feedback
github_handler.py stateless GitHub event handling (Actions/webhook)
server.py, web/ FastAPI dashboard with SSE streaming
mcp_server.py MCP server
evals/ 30 seeded-bug cases, sample project, runner + scorer
tests/ 27 offline tests (scripted FakeLLM)Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-native git hosting β repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Multi-brand AI code review for Claude: up to 12 reviewers and a judge, no install.
IaC, CI and dependency security review for coding agents: local scan CLI plus hosted OAuth MCP.
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceExposes the squad-dev workflow as deterministic MCP tools, enabling task classification, risk scoring, specialist reviewer selection, and advisory verdict consolidation for code changes.2763 npm4Apache 2.0
- FlicenseNot gradedqualityDmaintenanceExposes Claude Code's file editing, command execution, and test running capabilities as composable MCP tools for any MCP-compatible host, enabling code operations via a stateless bridge.-
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to run security and code review on pull requests and diffs, exposing review_pr and review_diff capabilities with local-first analyzers and LLM explanations.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query multi-repository code intelligence, retrieve ranked context packages, inspect symbols and call graphs, measure blast radius and affected tests, and audit index health through ten exposed MCP tools.1MIT