
Compare Cli Mcp
io.github.DrBaher由 GitHub 账号 DrBaher 发布v0.1.4更新于 Oct 28, 2026
MCP server for compare-cli: contract version diff/redline and a drift gate as agent tools.
概览
本地 MCP 服务器,封装 compare-cli,让助手对比两份合同文档、生成红线并判断是否存在实质变更。
- 可以做什么
- 对比两份文档,每侧可用路径、base64 或纯文本提供,返回结构化差异、退出分类与警告
- 以 nda-review-cli 的 negotiation.json 作为基准与候选文本对比,并报告采用哪一级协商结果以便审计
- 运行无需参数的演示对比,使用内置样例确认服务器已正确接入
- 以结构化内容加文本块返回 compare --json 契约,可选附带人类可读报告
- 适用场景
- 适合需要判断合同或文档在不同版本间是否变化、生成红线,或在流水线中依据变更分类决定是否放行的场景。也可用演示工具快速验证连接是否正常。
- 运行要求
- 以 npm 包形式通过 stdio 在本机运行;compare-cli 是同级依赖,需一并安装,然后用 compare-mcp 命令启动。无需认证、API 密钥或环境变量,但可选设置 COMPARE_MCP_BASE_DIR 将文件访问限制在指定目录内。
安装
在 SourceWeft 中
- 打开 控制台中的 Compare Cli Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
compare-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:
Then run:
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):
With base-directory lockdown (recommended for unattended use)
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 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:
Codes are stable across v1.x of this package.
Running the test suite
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):
License
MIT. See ../LICENSE.
来源:mcp/README.md,提交 8b28632
工具
0版本历史
1- v0.1.4最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分