MCP Setup

The @diffpulse/mcp package exposes DiffPulse as a Model Context Protocol (MCP) server. Your editor's AI can call DiffPulse tools during code review — without DiffPulse calling OpenAI, Anthropic, or any other hosted AI provider.

How it works

DiffPulse runs deterministic checks and returns structured JSON. Your editor's model reads that output and decides what to tell you. DiffPulse never sends your code or diffs to external AI services.

Install

No global install required — use npx in your MCP config:

npx -y @diffpulse/mcp

Or add as a dev dependency if you prefer a pinned local install:

npm install -D @diffpulse/mcp

Cursor configuration

Add a server entry to .cursor/mcp.json in your project (or global Cursor MCP settings):

{
  "mcpServers": {
    "diffpulse": {
      "command": "npx",
      "args": ["-y", "@diffpulse/mcp"]
    }
  }
}

Set cwd to your repository root if the MCP server should evaluate a specific project:

{
  "mcpServers": {
    "diffpulse": {
      "command": "npx",
      "args": ["-y", "@diffpulse/mcp"],
      "cwd": "/path/to/your/repo"
    }
  }
}

Restart Cursor or reload MCP servers after saving the config. Run diffpulse init first if your repo does not yet have a policy file.

Tools

diffpulse_check

Run deterministic PR risk evaluation for the current repository. Returns the full EvaluationReport JSON — verdict, risk score, merge readiness, checks, and findings.

InputDescription
repoRootGit repository root (defaults to server working directory)
baseBase git ref (defaults to policy or remote default branch)
policyPath to policy YAML (default: .diffpulse/policy.yaml)
failOnExit semantics threshold: pass, warn, or block

diffpulse_policy_summary

Load and summarize your DiffPulse policy — enabled checks, thresholds, pattern counts, and validation status. Useful before tuning policy or explaining why a check fired.

InputDescription
repoRootGit repository root (optional)
policyPath to policy YAML (optional)

diffpulse_explain_report

Produce a deterministic natural-language explanation of an evaluation report. Includes verdict summary, triggered checks, dimension notes, and remediation hints — all template-based, with no external AI calls.

InputDescription
reportInline EvaluationReport JSON object
reportPathPath to a diffpulse-report.json file
formatsummary, markdown, or findings_detail

Provide either report or reportPath, not both.

Example workflow

  1. Run npx @diffpulse/cli init to scaffold policy and CI.
  2. Add the MCP config above to Cursor.
  3. Ask your assistant: "Run diffpulse_check on this branch."
  4. Follow up with diffpulse_explain_report for remediation guidance.

CLI equivalent

The MCP tools wrap the same engine as the CLI:

# diffpulse_check ≈
npx @diffpulse/cli check --format json

# diffpulse_policy_summary ≈
npx @diffpulse/cli config validate

# diffpulse_explain_report ≈
# (deterministic explain layer — MCP-only structured narrative)

Troubleshooting

  • Policy not found — run npx @diffpulse/cli init in the repository root.
  • Not a git repository — ensure cwd points to a git repo with commits.
  • Verify the binarynpx @diffpulse/mcp --help