Skip to main content
Glama

pr-review-mcp

MCP server for multi-track PR reviews from local git diffs.

npm package: aggrowal-pr-review-mcp

Documentation

Related MCP server: IRIS Regression Memory

Quickstart

  1. Run via npx:

npx -y aggrowal-pr-review-mcp
  1. Attach in your MCP client (Cursor/Claude-style example):

{
  "mcpServers": {
    "pr-review": {
      "command": "npx",
      "args": ["-y", "aggrowal-pr-review-mcp"],
      "env": {}
    }
  }
}

This server is keyless by default. No Anthropic/OpenAI keys are required.

  1. Configure project once:

configure_project
  name: your-repo-folder
  repoUrl: https://github.com/org/repo
  mainBranch: main
  1. Run review:

@pr_review branch: feature/my-branch
@pr_review branch: feature/my-branch format: markdown

pr_review now uses a strict staged loop:

  • Stage prepare: server returns sessionId, assembled prompt, coverage contract, and nextAction.callTemplate.

  • Stage validate: host sends a draft report back; server validates schema + contract.

  • Stage repair (if needed): server returns exact gaps and a correction prompt.

  • Stage final: server returns validated review JSON (and optional markdown summary).

Most IDE agents can chain this automatically after the initial @pr_review branch: ... call.
If your host does not auto-chain, call pr_review again with sessionId + draftReport.

Troubleshooting: checks do not kick in

Common bypass symptoms:

  • Host returns free-form findings directly, but you do not see staged JSON envelopes with ok, stage, and meta.

  • Response lacks nextAction.callTemplate from prepare or repair.

  • MCP logs do not show pr_review: prepare stage starting and pr_review: validate stage starting.

Manual recovery flow:

  1. Run @pr_review branch: <branch-name>.

  2. Copy nextAction.callTemplate from the returned prepare payload.

  3. Fill draftReport with your generated JSON report.

  4. Call pr_review again with that payload.

  5. Repeat with the returned repair call template until stage final.

Debug checklist:

  • Set PR_REVIEW_LOG=debug in the MCP server environment.

  • Re-run @pr_review branch: <branch-name>.

  • Confirm stage logs appear in order: prepare start -> validate start -> (repair or final).

  • If no stage logs appear, your host likely bypassed the MCP tool call.

Review contract enforcement

Detailed reference: docs/architecture.md#review-contract-enforcement.

Core guarantees:

  • Server builds a per-track execution contract from matched skill checklists.

  • Final model output must satisfy schema and contract coverage checks.

  • Missing/extra track, heading, or subpoint coverage causes correction retry and then structured error if unresolved.

  • Status taxonomy remains: blocker | needs_improvement | nudge | looks_good.

Token efficiency strategy

Detailed reference: docs/architecture.md#token-efficiency-strategy.

Current strategy:

  • Keep a single pr_review call from IDE.

  • Inject shared changed-files payload once for all tracks.

  • Remove repeated per-track prompt boilerplate while preserving checklist semantics.

  • Emit prompt telemetry (static, payload, tracks, total) for visibility.

  • Retry through explicit staged validation when output fails schema/contract checks.

Skill prompt format contract (must keep)

Each skill prompt must keep this shape so parser and coverage validation remain stable:

  • ## What to check

  • heading lines in ### <Letter>. <Title> format

  • numbered checks (1., 2., ...)

  • ## Rules

If you change this format, update parser logic in src/prompt/assemble.ts and related tests.

Prompt-injection hardening

Detailed reference: docs/architecture.md#prompt-injection-hardening.

Hardening model:

  • Treat diff and file payloads as untrusted data.

  • Wrap untrusted content in sentinel boundaries.

  • Escape sentinel collisions in payload.

  • Keep reviewer reviewInstructions in trusted section only.

Future change checklist

Before finalizing behavior changes:

  1. Keep coverage-contract integrity for track/heading/subpoint accounting.

  2. Keep skill parseability (### Letter. Heading + numbered checks).

  3. Preserve token discipline via dedupe and concise wording.

  4. Preserve trusted/untrusted boundary model and path sanitization.

  5. Run npm test and npm run build.

Development

npm run build
npm run dev
npm test
npm start
npm run smoke:mcp

Available Tools

3 tools
configure_projectA

Register or update a project in the PR review config. Run this once per project.

Inputs: name (required), repoUrl (required), mainBranch.

list_projectsB

List all configured projects.

Inputs: no named parameters.

pr_reviewB

Run staged keyless PR review. Host must chain prepare -> validate/repair using nextAction.callTemplate.

Inputs: cwd, model, branch, format, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 3 tools

    Disambiguation4/5

    The three tools target clearly different operations: project registration, project listing, and running a review. The only mild ambiguity is that pr_review bundles a multi-stage prepare/validate/repair workflow into one tool, making its exact behavior less obvious from the surface, but it does not overlap with the config tools.

    Naming Consistency4/5

    configure_project and list_projects follow a clean verb_noun pattern, while pr_review deviates to a noun-style name. The deviation is minor and still readable, so the set is mostly consistent.

    Tool Count4/5

    Three tools is on the lean side but each serves a distinct role in a narrow domain (configure, list, review). It is well-scoped for a focused PR review server, though slightly thin.

    Completeness3/5

    The surface covers project setup and running a review, but there is no way to remove/update a project explicitly, inspect past review results, or check status outside the chained pr_review flow. These are notable gaps that could force agents into awkward workarounds.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables deterministic behavioral regression review of pull-request diffs by checking changed code against approved incident-derived contracts. It exposes read-only tools to assess diffs and pull requests, list and fetch contracts, and report outcomes over stdio without mutating repositories.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables an MCP-capable assistant to review GitLab merge requests, GitHub pull requests, and pre-push local branches against ticket requirements, domain rubrics, compiler/lint pre-passes, blast-radius analysis, and SonarQube findings, and to draft inline comments or follow-up tasks in the user's chosen language. Nothing reaches a remote host until a human approves the exact content in an interactive terminal.
      3
      MIT