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 分