# diffctx

Selects related callers, tests, and interfaces outside a git diff. It bundles the context needed for code review within a token limit.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6
- Author: nikolay-e
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/nikolay-e/diffctx
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/mcp/diffctx

## What it does

diffctx examines git revisions and pulls in relevant code outside the raw patch. It locates upstream callers, connected tests, and crossed contracts without querying external AI APIs or maintaining a persistent code index.

Caller detection relies on static analysis tailored per language. When relationships cannot be resolved cleanly, the tool reports that directly rather than returning an empty count. You can pass git ranges, staged files, or time windows such as `24h` and restrict payload size with `--budget`.

Running the MCP server requires the Python package, meaning native binaries from cargo, npm, or release archives are not enough on their own. It feeds the agent only the source files necessary to understand the diff.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add diffctx -- uvx diffctx
```
uvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>

### Codex

**Platform CLI**
```bash
codex mcp add diffctx -- uvx diffctx
```
uvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "diffctx": {
            "command": "uvx",
            "args": [
                "diffctx"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "diffctx": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "diffctx"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add diffctx uvx diffctx
```
uvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>

## When to use it
- extract callers and tests affected by a git change
- fit diff review context into an exact token budget
- inspect contract impact for uncommitted code
- trace code dependencies across revisions without a background index

## Example prompts
- Review the changes in main...feature capped at 12000 tokens using diffctx
- Find all callers and tests outside the diff for HEAD~1
- Inspect uncommitted files in impact mode to see touched contracts

## Similar
- [Front-End Checklist](https://affpapa.org/en/nevibecode/mcp/front-end-checklist.md) — MCP server · ★ 74569
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [Serena MCP: the IDE for your agent](https://affpapa.org/en/nevibecode/mcp/serena-mcp-the-ide-for-your-agent.md) — MCP server · ★ 30739
- [Repomix](https://affpapa.org/en/nevibecode/mcp/repomix.md) — MCP server · ★ 29037
- [Repowise](https://affpapa.org/en/nevibecode/mcp/repowise.md) — MCP server · ★ 7925
- [sem](https://affpapa.org/en/nevibecode/mcp/sem.md) — MCP server · ★ 3427

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
