# diffctx

> diffctx is a free MCP server for developer tools. Picks the minimum code an LLM needs to review a git diff, locally and deterministically. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, Windows, macOS, Linux
- **Website:** https://diffctx.com
- **Repository:** https://github.com/nikolay-e/diffctx
- **MCP Registry name:** io.github.nikolay-e/diffctx
- **Categories:** developer tools, AI models and LLM tooling
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
claude mcp add diffctx -- uvx diffctx
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "diffctx": {
      "command": "uvx",
      "args": [
        "diffctx"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "diffctx": {
      "command": "uvx",
      "args": [
        "diffctx"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "diffctx": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "diffctx"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "diffctx": {
      "command": "uvx",
      "args": [
        "diffctx"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "diffctx": {
      "command": "uvx",
      "args": [
        "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

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/diffctx
