Selects the minimum code an LLM needs to review a git diff by identifying callers, tests, and contracts affected by a change.
Also known as nikolay-e/diffctx
- Stars
- 6
- Tools
- —
- Downloads, 30 days
- 3,869
- Latest version
- 1.20.0
- Last commit
- Nov 12, 2026
- License
- Apache-2.0
What is diffctx MCP?
diffctx selects the minimum code an LLM needs to review a git diff by identifying callers, tests, and contracts affected by a change.
Summary generated from the project's README
About diffctx MCP server
diffctx helps developers and AI agents understand the broader impact of code changes by identifying relevant context outside a git diff. Instead of providing an entire repository, it selects specific callers, tests, and contracts affected by a modification. This tool is designed to stay within a specific token budget, making it useful for LLM-based code reviews where context window limits are a concern.
The server runs locally and operates deterministically without requiring a maintained index or external model calls. It can be integrated into various MCP clients like Claude Desktop, Cursor, or Zed. Users can specify a git range, staged changes, or even a time duration such as 24h to define the scope of the analysis. It supports different modes like impact analysis or locating changes, and allows users to set a custom token budget using the --budget flag.
What you can do with it
- 1Analyze code change impactIdentify the callers and tests that are affected by a specific git diff to understand the scope of a change.
- 2Optimize LLM review contextProvide an AI agent with the minimum necessary code to review a branch while staying under a token limit.
- 3Locate recent workRetrieve a ranked JSON list of code changes made within a specific time window.
- 4Review specific symbolsFind the impact and surrounding context for a specific function or name without needing a code change.
Written from the project's README. Every use case is checked against a quote from it.
How to install diffctx MCP
Formats verified 10 Nov 2026Install diffctx MCP in Claude Code
$ claude mcp add diffctx -- uvx diffctxInstall diffctx MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Install diffctx MCP in VS Code
.vscode/mcp.json
{
"servers": {
"diffctx": {
"type": "stdio",
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Install diffctx MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Install diffctx MCP in Codex
~/.codex/config.toml
[mcp_servers.diffctx] command = "uvx" args = ["diffctx"]
Install diffctx MCP in Gemini CLI
~/.gemini/settings.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablenikolay-e/diffctx is public and reachablegithub.com/nikolay-e/diffctx ↗Pass
- Package names this repository as its sourcediffctx names nikolay-e/diffctx as sourcepypi.org/project/diffctx/ ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for diffctxpypi.org/project/diffctx/ ↗Pass
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-12github.com/nikolay-e/diffctx ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from diffctxPass
- No critical advisory in the package or its dependencies2 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubdiffctx — what a git change reaches, and the code to review it
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
uvx diffctx . --diff HEAD~1 # zero-install, run once via uv
pipx install diffctx # isolated CLI
pip install diffctx # into an active environment
cargo install diffctx # native binary from crates.io, no Python
npx diffctx . --diff HEAD~1 # npm wrapper over the native binary
docker run --rm -v "$PWD:/repo" ghcr.io/nikolay-e/diffctx . --diff HEAD~1
scoop bucket add diffctx https://github.com/nikolay-e/diffctx # Windows
scoop 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.
claude mcp add diffctx -- uvx --from 'diffctx[mcp]' diffctx-mcp
codex mcp add diffctx -- uvx --from 'diffctx[mcp]' diffctx-mcp
gemini 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.
claude plugin marketplace add nikolay-e/diffctx
claude plugin install diffctx@diffctx
CI
The GitHub Action hands a pull request's diff context to any review step.
Usage
diffctx . --diff --mode impact # uncommitted work: callers outside the diff, their tests, contracts
diffctx . --symbol parse_config # the same for a name, no change needed
diffctx . --diff main...feature # the code to review a branch, packed under the auto budget
diffctx . --diff HEAD~1 --budget 12000 # the last commit, capped at 12k o200k tokens
diffctx . --diff 24h --mode locate # today's work as ranked JSON, no source bodies
diffctx . # 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.

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
- Documentation site — the pipeline end to end
- Command-line reference — rendered from
diffctx --help - Integrations — install, MCP clients, Python API
- FAQ — heuristic or oracle, ignore rules, monorepos, secrets
- Token counting —
--budgetfor non-GPT models - Benchmarks and the paper
- Changelog · Security
- Parameter strategy
Apache 2.0
diffctx MCP questions
How do I add diffctx MCP to Claude Code?
Run claude mcp add diffctx -- uvx diffctx in your terminal. Add --scope user to make it available in every project.
How do I add diffctx MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How does diffctx differ from whole-repo packers or code-graph servers?
Unlike whole-repo packers that export everything or code-graph servers that use a maintained index, diffctx is diff-seeded, meaning the input is a specific change and the output is what that change touches.
Does diffctx require an index or model calls to work?
No, it operates locally and deterministically without requiring an index or making model calls.
Can I limit the amount of code sent to the LLM?
Yes, you can use the --budget flag to cap the output at a specific token count.