compare-cli MCP server
✓ VerifiedEnables AI agents to perform contract version diffing, redlining, and drift detection using structured document comparison tools.
Also known as DrBaher/compare-cli
- Stars
- 1
- Tools
- 3
- Downloads, 30 days
- —
- Latest version
- 0.1.4
- Last commit
- Aug 3, 2026
- License
- MIT
What is compare-cli MCP?
compare-cli enables AI agents to perform contract version diffing, redlining, and drift detection using structured document comparison tools. It exposes 3 tools, such as compare_files, compare_with_negotiation, compare_demo.
Summary generated from the project's README
About compare-cli MCP server
Performing contract version diffing and drift detection from within an AI agent is what this server enables. It wraps the compare-cli tool to provide structured document comparison capabilities specifically for agentic pipelines. Developers can use it to identify substantive changes between legal or technical documents by providing file paths, base64 content, or raw text.
Users set up the server via stdio transport, making it compatible with clients like Claude Desktop or Claude Code. For unattended use, you can implement a base-directory lockdown by setting the COMPARE_MCP_BASE_DIR environment variable, which prevents the agent from accessing files outside a specific folder. The server provides three primary tools: compare_files for standard two-document comparisons, compare_with_negotiation for auditing negotiated text against a negotiation.json file, and compare_demo for testing the connection with synthetic fixtures.
Results are returned as JSON-first structured content, including exit classes and difference summaries. This allows an agent to programmatically distinguish between a successful identification of substantive drift and actual I/O errors like malformed PDFs or missing files.
What you can do with it
- 1Auditing negotiated agreement textUse the negotiation tool to verify which resolution tier produced the agreed text in a legal negotiation.
Written from the project's README. Every use case is checked against a quote from it.
How to install compare-cli MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall compare-cli MCP in Claude Code
$ claude mcp add compare-cli-mcp -- npx -y compare-cli-mcpInstall compare-cli MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"compare-cli-mcp": {
"command": "npx",
"args": [
"-y",
"compare-cli-mcp"
]
}
}
}Install compare-cli MCP in VS Code
.vscode/mcp.json
{
"servers": {
"compare-cli-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"compare-cli-mcp"
]
}
}
}Install compare-cli MCP in VS Code CLI
$ code --add-mcp '{"name":"compare-cli-mcp","type":"stdio","command":"npx","args":["-y","compare-cli-mcp"]}'Install compare-cli MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"compare-cli-mcp": {
"command": "npx",
"args": [
"-y",
"compare-cli-mcp"
]
}
}
}Install compare-cli MCP in Codex
$ codex mcp add compare-cli-mcp -- npx -y compare-cli-mcpInstall compare-cli MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.compare-cli-mcp] command = "npx" args = ["-y", "compare-cli-mcp"]
Install compare-cli MCP in Gemini CLI
$ gemini mcp add -s user compare-cli-mcp npx -- -y compare-cli-mcpInstall compare-cli MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"compare-cli-mcp": {
"command": "npx",
"args": [
"-y",
"compare-cli-mcp"
]
}
}
}compare-cli MCP tools 3
Detected from the READMEcompare_filescompare_with_negotiationcompare_demo
| compare_files | — | |
| compare_with_negotiation | — | |
| compare_demo | — |
Configuration
COMPARE_MCP_BASE_DIR
| Name | Description | |
|---|---|---|
| COMPARE_MCP_BASE_DIR | — |
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachabledrbaher/compare-cli is public and reachablegithub.com/drbaher/compare-cli ↗Pass
- Package names this repository as its sourcecompare-cli-mcp names drbaher/compare-cli as sourcenpmjs.com/package/compare-cli-mcp ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for compare-cli-mcpnpmjs.com/package/compare-cli-mcp/v/0.1.4#provenance ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-08-03github.com/drbaher/compare-cli ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from compare-cli-mcpPass
- No critical advisory in the package or its dependencies99 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model3 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubcompare-cli-mcp
MCP (Model Context Protocol) server wrapping compare-cli for agent pipelines. Three tools, stdio transport, JSON-first responses with optional human report.
Design contract:
../docs/mcp.md. This package ships the implementation; behavior and schemas track the design version.
Part of the contract-ops suite.
Install
compare-cli-mcp has compare-cli as a peer dependency, so install both:
npm install -g compare-cli@^0.3.0 compare-cli-mcp@^0.1.1
Then run:
compare-mcp # spawns the MCP server on stdio
Wire into an MCP client
Claude Desktop / Claude Code
Add to your MCP-client config (e.g. ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"compare-cli": {
"command": "compare-mcp"
}
}
}
With base-directory lockdown (recommended for unattended use)
{
"mcpServers": {
"compare-cli": {
"command": "compare-mcp",
"env": {
"COMPARE_MCP_BASE_DIR": "/path/to/contract/documents"
}
}
}
}
Every path argument the agent supplies is then resolved against COMPARE_MCP_BASE_DIR and rejected if it escapes the directory (symlinks collapsed). Without the env var the server reads any file the process can read — see the security note in ../docs/mcp.md §3.2.
Tools
| Tool | Purpose |
|---|---|
compare_files |
Two-document comparison. Each side accepts path, content_base64, or content_text. |
compare_with_negotiation |
Base is read from nda-review-cli's negotiation.json. Returns base.negotiation_resolution so the agent can audit which signal produced the agreed text. |
compare_demo |
Zero-arg synthetic comparison against bundled fixtures. Deterministically returns exit_class: "substantive". Use to confirm the server is wired up. |
Tool descriptions, input schemas, and output schemas are advertised on tools/list. The schemas are stable across v1.x of this package; any change is fenced by the snapshot golden in tests/fixtures/tools-list.json.
Output shape
Every successful tool call returns:
structuredContent— the exactcompare --jsonshape (top-levelok,exit_class,exit_code,base,candidate,summary,differences,warnings). Stable across compare-cli v1.x per its AGENTS.md. This is the contract the agent reads.content[0]— the same JSON serialized as a text block, for MCP clients that don't yet readstructuredContent.content[1](optional, when caller passesinclude_human_report: true) — the human-readable report.
compare_with_negotiation adds structuredContent.base.negotiation_resolution ∈ {"status", "per_round_agreed", "clause_status"} indicating which of the three resolution tiers produced the agreed base text.
Errors vs drift
Substantive drift is a successful tool call. The agent asked what's different and the server answered. Routing on exit_class is the contract — error envelopes (isError: true) are reserved for I/O / argument failures plus one explicit precondition exception:
| Code | Trigger |
|---|---|
INPUT_NOT_FOUND |
Path not found / unreadable. |
INPUT_MALFORMED |
Malformed .docx / .pdf. |
PDF_NO_TEXT_LAYER |
Scanned PDF; pdfjs extracted zero characters. |
INVALID_ARGS |
Schema-validation failure (missing args, oneOf violation, etc.). |
PATH_OUTSIDE_BASE_DIR |
COMPARE_MCP_BASE_DIR is set and the path escapes it. |
NO_AGREED_ROUND |
compare_with_negotiation precondition: no agreed round found. The CLI returns exit 2 here; the MCP server promotes it to an error because no comparison ran. |
NOT_SIGNED_OFF |
require_signoffs: true and signoffs.a / signoffs.b is missing. |
INTERNAL_ERROR |
Unexpected; surfaces underlying message so the agent isn't blind. |
Codes are stable across v1.x of this package.
Running the test suite
# From the repo root:
npm install # workspaces resolve compare-cli + compare-cli-mcp
cd mcp && npm test # 22 tests, ~100 ms
The conformance + snapshot suite is in tests/test_protocol.mjs. The tools/list golden lives at tests/fixtures/tools-list.json. To regenerate the golden after an intentional schema change (also bump the minor version):
node -e 'import("./compare-cli-mcp.mjs").then(m => process.stdout.write(JSON.stringify(JSON.parse(JSON.stringify(m.TOOLS)), null, 2)))' > tests/fixtures/tools-list.json
License
MIT. See ../LICENSE.
compare-cli MCP questions
How do I add compare-cli MCP to Claude Code?
Run claude mcp add compare-cli-mcp -- npx -y compare-cli-mcp in your terminal. Add --scope user to make it available in every project.
How do I add compare-cli MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does compare-cli MCP provide?
It exposes 3 tools, including compare_files, compare_with_negotiation, compare_demo.
Can I restrict the files the agent can access?
Yes, you can use the COMPARE_MCP_BASE_DIR environment variable to set a base directory. Any path provided by the agent that escapes this directory will be rejected.
Is a substantive difference considered an error?
No, substantive drift is treated as a successful tool call because the agent's request to identify differences was fulfilled.