diffctx

io.github.nikolay-e由 GitHub 账号 nikolay-e 发布v1.20.0更新于 Oct 24, 2026

Selects the minimum code an LLM needs to review a git diff

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

本地 MCP 服务器,分析 git 差异或符号,在 token 预算内挑选审阅所需的最少代码。

可以做什么
  • 分析 git 变更(提交范围、暂存区或时间窗口),找出差异之外的调用方、触及它们的测试以及跨越的契约
  • 无需变更即可分析指定符号
  • 在 token 预算内打包审阅分支或提交所需的代码
  • 以排序 JSON 返回近期工作的位置,不含源码正文
  • 将整棵代码树导出为 Markdown
适用场景
适合助手审阅拉取请求或提交时,需要差异之外的上下文(调用方、受影响的测试、跨模块契约),或需要把上下文控制在 token 预算内的情况。
运行要求
以本地进程通过 stdio 运行,用 uvx 从 diffctx 包(含 mcp 附加组件)启动,需要 Python。MCP 服务器依赖 Python 包,仅原生二进制不提供。未声明认证、环境变量或请求头。需要本地 git 仓库作为分析对象。
安装前请注意
它会读取仓库源码并把选中的代码交给所连接的助手,需留意哪些内容离开本机。调用方解析是静态的、按语言进行,无法解析时会明确说明而非给出零值。README 的常见问题提到密钥处理,指向敏感仓库前应先查看。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

diffctx — what a git change reaches, and the code to review it

[CI] [PyPI] [crates.io] [npm] [MCP Registry]

diffctx tells an agent or a reviewer what a change reaches outside its diff — the callers, the tests that reach them, the contracts it crosses — and selects the code needed to understand it under a token budget. Local, deterministic, no index, no model calls. Caller resolution is static and per language; where it cannot resolve, the answer says so instead of printing a zero.

Formerly published as treemapper — every command, flag, and API call works unchanged.

Install

diffctx is a command-line tool; the MCP server, the Claude Code plugin and the GitHub Action run the same engine.

CLI

bash
uvx diffctx . --diff HEAD~1             # zero-install, run once via uvpipx install diffctx                    # isolated CLIpip install diffctx                     # into an active environmentcargo install diffctx                   # native binary from crates.io, no Pythonnpx diffctx . --diff HEAD~1             # npm wrapper over the native binarydocker run --rm -v "$PWD:/repo" ghcr.io/nikolay-e/diffctx . --diff HEAD~1
powershell
scoop bucket add diffctx https://github.com/nikolay-e/diffctx   # Windowsscoop install diffctx/diffctx

The native binary — cargo, npm, Docker, Scoop and the release archives for Linux, macOS and Windows on x64 and ARM — answers --diff and --symbol in every mode; whole-tree export, Markdown packs, diffctx graph and the MCP server need the Python package.

Any MCP client

Registered as io.github.nikolay-e/diffctx.

bash
claude mcp add diffctx -- uvx --from 'diffctx[mcp]' diffctx-mcpcodex mcp add diffctx -- uvx --from 'diffctx[mcp]' diffctx-mcpgemini mcp add diffctx uvx -- --from 'diffctx[mcp]' diffctx-mcp

Cursor, VS Code, Claude Desktop, Windsurf, Zed, Continue and the Python API: integrations.

Claude Code plugin

The MCP server plus /diffctx:impact and hooks that run it on each commit and push.

bash
claude plugin marketplace add nikolay-e/diffctxclaude plugin install diffctx@diffctx

CI

The GitHub Action hands a pull request's diff context to any review step.

Usage

bash
diffctx . --diff --mode impact          # uncommitted work: callers outside the diff, their tests, contractsdiffctx . --symbol parse_config         # the same for a name, no change neededdiffctx . --diff main...feature         # the code to review a branch, packed under the auto budgetdiffctx . --diff HEAD~1 --budget 12000  # the last commit, capped at 12k o200k tokensdiffctx . --diff 24h --mode locate      # today's work as ranked JSON, no source bodiesdiffctx .                               # whole-tree export, Markdown

--diff takes a git range, staged, or a duration window ending now (24h, 90min, 2w). Every flag, default and exit code: command-line reference.

[diffctx demo]

How it compares

Whole-repo packers export everything; code-graph servers answer queries against a maintained index. diffctx is diff-seeded: the input is a change, the output is what it touches and what explains it. Measured results, and when the other two fit better: COMPARISON.md.

More

Apache 2.0

来源:README.md,提交 745f593

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:服务器未能启动。

版本历史

11
  1. v1.20.0最新Oct 22, 2026
  2. v1.19.1Oct 14, 2026
  3. v1.19.0Oct 14, 2026
  4. v1.18.4Oct 7, 2026
  5. v1.18.3Oct 4, 2026
  6. v1.18.2Oct 2, 2026
  7. v1.18.1Sep 30, 2026
  8. v1.18.0Sep 30, 2026
  9. v1.17.0Sep 23, 2026
  10. v1.16.0Sep 16, 2026
  11. v1.15.0Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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