diffctx — Claude Code MCP server: what it does, how to install
Selects related callers, tests, and interfaces outside a git diff. It bundles the context needed for code review within a token limit.
claude mcp add diffctx -- uvx diffctxWhat diffctx 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.
What it helps with
- 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 for the agent
- 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
How to install diffctx
Platform CLI
claude mcp add diffctx -- uvx diffctxuvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>
Platform CLI
codex mcp add diffctx -- uvx diffctxuvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>
Config file
{
"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>
Config file
{
"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>
Platform CLI
gemini mcp add diffctx uvx diffctxuvx runs the command named after the package; if the README names another one, use uvx --from diffctx <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about diffctx
How do I install diffctx in Claude Code?
Run claude mcp add diffctx -- uvx diffctx in your terminal. This registers the server using uvx.
What does diffctx do?
It inspects your git modifications to find external code that touches the change, including callers and test suites. It then packs that context under a defined token limit for code review.
Can I run the MCP server with the native binary alone?
No, native builds from crates.io, npm, or Docker only support the --diff and --symbol commands. The MCP server mode requires the Python package installation.