Selects minimal code context for an LLM to review a git diff using graph-based fragment selection under a token budget.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
We ran the install command below but it didn't respond within our test window โ this can mean a slow first-time install rather than a real problem.
uvx diffctxNo response to initialize.
This is an experimental automated check and can have false negatives โ missing environment variables, a slow cold install, etc. It doesnโt necessarily mean somethingโs wrong. Last checked 4d ago.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Diffctx.
diffctx selects the minimum code an LLM needs to review a git diff. Instead of pasting whole files, it walks the dependency graph outward from the changed lines and stops once more context stops paying for itself.
Formerly published as
treemapperโ every command, flag, and API call works unchanged.
Whole-repo packers (repomix and friends) seed on the repository and export everything; persistent code-graph servers answer structural queries against a maintained index. diffctx is diff-seeded: the input is a change, the output is the fragments needed to understand it, packed under a hard token budget โ local, deterministic, no index, no model calls. Measured results and when the other two families fit better: COMPARISON.md.
Without Python:
On Windows, via Scoop (this repository is the bucket):
Prebuilt binaries for Linux (x86_64/aarch64), macOS (arm64/x86_64) and Windows (x64/arm64)
are attached to every release.
On Windows on ARM, diffctx[mcp] builds cryptography from source, which needs
OpenSSL: that project publishes no wheel for the platform.
The native binary and Docker image cover diff mode with YAML/JSON output and
write to stdout (redirect to capture); tree mode, Markdown output, the graph
subcommand and the MCP server live in the Python package.

diffctx . --diff HEAD~1 selects only the fragments an LLM needs to review the
last commit, instead of dumping every changed file in full.
Finds the minimal set of fragments needed to understand a change โ imports,
callers, type definitions, config dependencies โ across 50+ file types. It
builds a code graph (imports, co-changes, type refs), propagates relevance
outward from the changed lines, and stops when relevance drops below --tau or
the --budget token cap is hit.
--diff takes a git range (HEAD~1..HEAD, main..feature) or a duration
window ending now โ 24h, 8d, 90min, 1h30m, 2w (units s, m/min,
h, d, w, composable). A window diffs the working tree against the last
commit before it, so it covers the commits made inside the window plus the
uncommitted and untracked work on top โ diffctx . --diff 24h is "everything I
touched today". A ref that happens to look like a duration (a branch 24h)
keeps its git meaning.
| Flag | Default | Description |
|---|---|---|
--scoring | ego | ego = bounded expansion around changed nodes (fast, predictable radius); ppr = Personalized PageRank (global, smoother decay, slower); bm25 = lexical retrieval against the diff hunks (baseline for sparse graphs); rrf = reciprocal-rank fusion of ego and bm25 (widest recall, no scale calibration between the two signals); pit = the same fusion on score percentiles |
--budget | auto | Cap in o200k_base tokens on the whole rendered artifact (see Token counting): every changed file gets one witness first, relevance fills the rest, and the renderer drops context from the tail until the document fits. A budget smaller than the summary yields the summary alone. N = fixed cap, -1 disables it, 0 is a strict-zero floor (no fragments; use --full for changed files only) |
--alpha | 0.60 | PPR continuation probability: higher = relevance travels further from the change, lower = tighter around it (--scoring ppr only) |
--tau | 0.05 | Relevance threshold for full fragment content; lower-scoring fragments are stubbed or dropped (lower = more context) |
--full | false | Only the changed files, every fragment, no related-code context |
--timeout | 300 | Wall-clock deadline in seconds; on expiry the run stops cooperatively and emits a partial artifact whose coverage block names the limit (exit 0). 124 is the watchdog behind it, 30 s later, for a phase that could not stop |
--with-raw-diff | false | Also embed git's raw unified diff ahead of the selected fragments โ additive (selection unchanged), not charged to --budget, lock/ignored/secret-like sections omitted. Python CLI only |
--mode | pack | locate emits the same ranked selection as compact diffctx.locate.v1 JSON โ path, lines, score, provenance reasons, a blast-radius summary and per-item impact group (test/type/config), NO source bodies. Adds a coverage block naming what the run could not see (unparsed_files, zero_edge_files, ppr_truncated, next_up, a heuristic confidence) and an overflow ranking of what the budget left behind โ omitted entirely when there is nothing to disclose. diffctx . --diff --mode locate = impact of your uncommitted change. The MCP tool takes it as mode="locate" |
Every JSON/YAML artifact opens with schema: diffctx.context.v1 and validates
against schemas/diffctx.context.v1.json,
generated from the engine's own type; it closes with a provenance block
(engine version, input object ids, the effective configuration and its hash,
the selection parameters, the tokenizer) and, when a limit stopped the run
short, a coverage block naming it.
graph subcommandExplore the underlying dependency graph directly, without a diff:
Every run reports token count and size on stderr โ 12,847 tokens (o200k_base), 52.3 KB. Counts are exact only for the GPT-4o family; Claude,
Gemini and others tokenize differently, so treat --budget as an upper bound
and leave headroom (details). Unreadable files
become placeholders like <binary file: N bytes>.
Factual signals from GitHub, npm, and our automated checks โ not a rating.
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/nikolay-e-diffctx)<a href="https://allmcps.com/mcp/nikolay-e-diffctx"><img src="https://allmcps.com/api/badge/nikolay-e-diffctx?style=directory" alt="Diffctx on AllMCPs" /></a>