diffctx
Picks the minimum code an LLM needs to review a git diff, locally and deterministically
- Pricing
- Free
- Platforms
- CLI, Windows, macOS
- Runs
- Locally
- Version
- 1.20.0
- Listing updated
- 1 day ago
About diffctx
diffctx is a free MCP server for developer tools. It runs locally on your machine and is started by your AI client.
Rather than pasting whole files, diffctx starts at the changed lines and walks a code graph outward, stopping when extra context stops paying for itself. Its measured example on home-assistant/core, a 66-file change, produced a selection smaller than the patch that still included callers, types and config, and is 17.6 times smaller than pasting the changed files whole. The author notes that the ratio varies: small fixes can come out larger because callers are added.
Six edge families link code, and five scoring modes (ego-network, Personalized PageRank, bm25, and rrf and pit fusions) feed one greedy selector with a hard token budget. It is local, offline, needs no index and makes no model calls. The README describes impact mode, which lists callers outside the diff, their tests and contracts, and a --symbol query.
Install through uvx, pipx, pip, cargo, npm, Docker or Scoop; the MCP server and Claude Code plugin need the Python package, and a GitHub Action is included. It was formerly named treemapper.
Install
Run in a terminal
claude mcp add diffctx -- uvx diffctxAdd to claude_desktop_config.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"diffctx": {
"type": "stdio",
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"diffctx": {
"command": "uvx",
"args": [
"diffctx"
]
}
}
}What it does
- Diff-seeded selection
- Starts from changed lines and expands through the code graph.
- Token budget
- A hard budget caps the selection; the default is automatic.
- Impact mode
- Shows callers outside the diff, their tests and contracts.
- Scoring modes
- ego, ppr, bm25, rrf and pit.
- Many install paths
- pip, pipx, uvx, cargo, npm, Docker and Scoop.
- Local and deterministic
- No index, no model calls, works offline.
Good for
- Give an LLM reviewer only the relevant code
- Find what a change reaches outside the diff
- Pack context for a branch under a token budget
- Add review context to CI
Pricing
Free
Free, local and offline
Prices change. Check diffctx.com before you buy.
diffctx FAQ
Does it call a model?
No. It is local and deterministic.
How do I add the MCP server?
For example claude mcp add diffctx -- uvx --from 'diffctx[mcp]' diffctx-mcp.
Was it called something else?
Yes, treemapper.
Does it always shrink the context?
No; for small fixes it may add tokens by including callers and types.
Is diffctx free?
Yes. diffctx is free to use.
How do I add diffctx to Claude Code?
Run this command in your terminal: claude mcp add diffctx -- uvx diffctx
What are the best alternatives to diffctx?
The closest alternatives to diffctx are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.
Alternatives to diffctx

REA
MCP serverCLI and MCP server that lets coding agents reverse engineer apps and binaries
Runs locally- Open source
- 464K GitHub stars
- Developer tools

Codebase Memory
MCP serverLocal MCP server that builds a code knowledge graph for AI coding agents
Runs locally- Open source
- 48.7K GitHub stars
- Knowledge and memory

GitHub
MCP serverOfficial MCP server connecting AI assistants to GitHub repos, issues and workflows
Not checked yet- Remote
- Open source
- 34.5K GitHub stars
- Developer tools

Serena MCP: the IDE for your agent
MCP serverMCP toolkit giving coding agents symbol-level code retrieval and editing
Runs locally- Open source
- 31.5K GitHub stars
- Developer tools

XERJ
MCP serverLocal search engine for AI agents with cited answers over your code and docs
Runs locally- Open source
- 19.2K GitHub stars
- Knowledge and memory

Ouroboros
MCP serverSpec-first layer that pins requirements and verifies results of AI coding agent work
Runs locally- Open source
- 6.4K GitHub stars
- Developer tools