
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 分