Diff Anything

io.github.MartinGryner由 GitHub 账号 MartinGryner 发布v0.1.0更新于 Oct 29, 2026

Compare local files, folders and API schemas through the installed Diff Anything CLI.

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

封装本机已安装的 Diff Anything 命令行工具,让助手比较本地文件、文件夹和 API schema,并读取差异报告。

可以做什么
  • 查看已安装 CLI 的版本、支持的参数、已配置的根目录和封装层限制
  • 按绝对路径比较两个文件,返回 CLI 自动识别的差异报告
  • 比较两个文件夹,返回默认的文件夹比较报告
  • 比较两个 API schema 文件,检查兼容性并标出破坏性变更
适用场景
适合希望让助手检查本地文档、JSON 文件、目录树或 API schema 之间的差异、又不想把内容复制进对话的场景,前提是已在使用 Diff Anything 桌面应用。
运行要求
macOS 或 Windows 上的 Node.js 22 或更高版本,以及已安装并带命令行的 Diff Anything 应用(macOS 需另装命令行助手,Windows 需启用商店应用执行别名)。必须设置 DIFF_ANYTHING_ROOTS:一个由已存在的绝对目录组成的 JSON 数组,作为允许比较的范围。文件夹与 API schema 比较需要 Diff Anything Pro。可用 DIFF_ANYTHING_CLI 指定可执行文件路径。安装 npm 包需要访问软件源。
安装前请注意
比较结果可能包含文件名、路径、文档内容和变更值,MCP 客户端可能把这些输出发送给模型提供方或加以存储;现有脱敏并非通用的密钥扫描。文件夹和 API 比较需要付费的 Pro 授权。工具不会修改被比较的文件,但 CLI 会更新本地用量记录并读取缓存的授权信息。根目录校验只是应用层防护,并非操作系统沙箱,网络挂载或云端占位文件可能表现异常。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Diff Anything,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Diff Anything MCP

Use the installed Diff Anything command line from an MCP client to compare local files, folders, and API schemas. The optional npm package runs over stdio as a child process of your client.

Requirements and setup

  • Node.js 22 or newer on macOS or Windows.
  • An installed Diff Anything app with its command line. Install the app from the product page. On Windows, the Microsoft Store version provides the command line through its diff-anything.exe app execution alias. On a Mac, the Mac App Store version is sandboxed and cannot read files named on a command line, so install the free Diff Anything command-line helper, which installs /usr/local/bin/diff-anything.
  • Folder and API schema comparisons require Diff Anything Pro. The CLI checks the app's locally cached entitlement; open the desktop app to purchase or restore Pro. The Free CLI permits plain-text and JSON comparisons, subject to its daily and file-size limits.
  • check_api_compatibility requires a CLI whose help includes --fail-on breaking. Discovery checks the installed binary; an older app returns update_required for this tool.

Your MCP client starts the server with npx, which downloads the pinned version on first use; nothing else needs installing. In Claude Code:

sh
claude mcp add diff-anything -e DIFF_ANYTHING_ROOTS='["/Users/you/Comparisons"]' -- npx -y @grunersoftware/[email protected]

In clients configured with JSON, the server entry is:

json
{  "mcpServers": {    "diff-anything": {      "command": "npx",      "args": ["-y", "@grunersoftware/[email protected]"],      "env": { "DIFF_ANYTHING_ROOTS": "[\"/Users/you/Comparisons\"]" }    }  }}

To run without fetching from npm at startup, install a pinned version globally and use the diff-anything-mcp command instead:

sh
npm install --global @grunersoftware/[email protected]

Set DIFF_ANYTHING_ROOTS in your client's server configuration to a JSON array of existing absolute directories that the server may compare. Until this is configured, only discovery works. Start with a dedicated directory containing files you intend to share with your client.

macOS discovery checks the command-line helper at /usr/local/bin/diff-anything, then /Applications/Diff Anything.app/Contents/MacOS/diff-anything, the same bundle in ~/Applications, and absolute entries on PATH. A Mac App Store copy of the app is skipped, because its own executable cannot read the files; without the helper, tools return helper_required with the helper's download page. Windows discovery checks %LOCALAPPDATA%\Microsoft\WindowsApps\diff-anything.exe and PATH. The Microsoft Store package declares that app execution alias; enable it in Windows settings if it is disabled. For a direct install or another location, set DIFF_ANYTHING_CLI to the absolute executable path. Never use a shell command or arguments in that variable.

VS Code

For a workspace configuration, create .vscode/mcp.json:

json
{  "servers": {    "diff-anything": {      "type": "stdio",      "command": "diff-anything-mcp",      "env": {        "DIFF_ANYTHING_ROOTS": "[\"/Users/you/Comparisons\"]"      }    }  }}

If your client cannot find the global command, use the absolute path to Node as command and the absolute path to the installed package's src/index.mjs as the single entry in args. This also avoids Windows clients that cannot directly launch npm's .cmd shim. npm root --global identifies the global package directory.

Clients using mcpServers

For a client such as Claude Code that accepts a project .mcp.json, use the same server entry under mcpServers. This Windows example launches Node directly:

json
{  "mcpServers": {    "diff-anything": {      "command": "C:\\Program Files\\nodejs\\node.exe",      "args": ["C:\\Users\\you\\AppData\\Roaming\\npm\\node_modules\\@grunersoftware\\diff-anything-mcp\\src\\index.mjs"],      "env": {        "DIFF_ANYTHING_ROOTS": "[\"C:\\\\Users\\\\you\\\\Comparisons\"]"      }    }  }}

Replace example paths with your actual installation and comparison directories. Restart or reload the server in your client, then call discover_capabilities first. Setup references: VS Code MCP configuration and MCP SDK host setup.

Tools

ToolInputResult
discover_capabilities{}Installed CLI version, flag support, configured roots and wrapper limits. It does not probe Pro ownership.
compare_filesAbsolute left and right pathsThe CLI's auto-detected comparison report.
compare_foldersAbsolute left and right directory pathsThe CLI's default folder comparison report (Pro).
check_api_compatibilityAbsolute left and right schema pathsAPI comparison with --fail-on breaking (Pro and a supporting CLI).

Example input:

json
{"left":"/Users/you/Comparisons/before.json","right":"/Users/you/Comparisons/after.json"}

Exit 1 is a completed comparison result, not a server failure. For file and folder comparisons it sets countedDifferences; for API checks it makes compatibilityCheckPassed false. Review the CLI report and its warnings: a failed compatibility check can mean a breaking or unclassified change. A comparison is not proof that a backup is complete or an API is compatible in every respect.

The wrapper returns the CLI report without rewriting its values or removing its masking. There are no tool arguments for raw CLI flags, disabling masking, overriding Pro, merging, batch manifests or writing report files. Errors use isError with a code such as missing_app, helper_required, pro_required, update_required, outside_roots, timeout or output_limit and the CLI's explanation where available.

Local processing and permissions

Diff Anything performs its comparisons locally and sends none of your data to an AI model. The npm wrapper has no hosted runtime, account, API key, HTTP listener or required network connection at runtime. Installing packages requires registry access; launching the installed package directly avoids an npm fetch at startup.

Your MCP client controls what happens to returned tool output. Comparison results can include filenames, paths, document content and changed values. A client may send that output to its model provider or store it. Configure that client's data handling and tool approvals before comparing sensitive files. Existing CLI masking is not a universal secret scanner.

Tools leave compared files unchanged. The CLI can update its local free-comparison usage ledger and read its cached Pro entitlement. The server inherits your process permissions and environment. Allowed roots validate resolved input paths, including symlinks. Folder inputs are scanned before comparison and reject nested symbolic links, junctions and special files, because the CLI can follow links. This validation is capped at 100,000 entries and 60 seconds per tree. These are application-level guards, not an OS sandbox or protection against another process changing files during a comparison. Use local, stable directories; network mounts or cloud placeholders may perform I/O through the operating system.

Each CLI invocation has a 60-second timeout and a combined stdout/stderr limit of 1 MiB. Output beyond the limit is discarded and the process is stopped; a partial report is never presented as complete. One tool request runs at a time; overlapping requests return busy. Client cancellation stops the active CLI child. Large comparisons should be narrowed into smaller pairs.

Development

sh
npm cinpm testnpm pack

Tests exercise the actual MCP stdio transport with a fixture CLI, argument validation, platform discovery paths, allowed roots, symlink escape rejection, Pro errors, cancellation and output limits. A real installed app is needed to verify platform packaging and entitlement behavior end to end.

来源:README.md,提交 8d1a4e8

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Oct 29, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分