文件差异比较服务

compare-mcp 是一个基于 Model Context Protocol 的只读文件与文本差异比较服务,为 AI 代理和编辑器提供结构化 JSON 形式的 unified diff、解析后的 hunks、目录差异及分类结果。

  • by ipolyzos
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 ipolyzos/diff-mcp

使用说明

compare-mcp

compare-mcp is a stdio Model Context Protocol server written in Go. It offers a read-only, typed layer over the host diff(1): clients get structured JSON—unified diff text, parsed hunks, directory deltas, and classifications—instead of scraping a shell session. Subprocess invocation uses a fixed argv (no shell), with bounded stdout, per-run timeouts, and optional workspace path containment.

The server targets agents and editors that need dependable compares without passing arbitrary flags or commands through to the host.

Tools

Each link goes to the tools reference (arguments, examples, limits, and error semantics):

  • compare_text — Diff two in-memory strings via short-lived private temp files.
  • diff_files — Unified diff for two existing regular files.
  • diff_directories — Brief directory tree report (-q / -qr style buckets).
  • summarize_diff — Digest unified text or a directory-brief snapshot without spawning diff again.

For when to use which tool and typical workflows, see the user guide. For a stable JSON contract across versions, see the client contract.

Documentation

All setup, usage, design, and policy detail lives under docs/—the root file stays descriptive only.

Full index: Documentation hub

License

Apache License 2.0 · Copyright © Ioannis Polyzos