Diffchunk
About
Navigate large diff files with intelligent chunking and navigation tools.
Details
- Author
- peteretelej
- Categories
- Developer Tools
Jump to
Setup
Install Diffchunk in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/peteretelej/diffchunk
Follow the installation instructions in the repository README, then restart your MCP client.
MCP server that enables LLMs to navigate large diff files efficiently. Instead of reading entire diffs sequentially, LLMs can jump directly to relevant changes using pattern-based navigation.
Large diffs exceed LLM context limits and waste tokens on irrelevant changes. A 50k+ line diff can't be processed directly and manual splitting loses file relationships.
- load_diff- Parse diff file with custom settings (optional)
- list_chunks- Show chunk overview with file mappings and per-file line counts (auto-loads)
- get_chunk- Retrieve specific chunk content (auto-loads)
- find_chunks_for_files- Locate chunks by file patterns (auto-loads)
- get_file_diff- Extract the complete diff for a single file (auto-loads)
Prerequisite:Installuv(an extremely fast Python package manager) which provides theuvxcommand.
{ "mcpServers": { "diffchunk": { "command": "uvx", "args": ["--from", "diffchunk", "diffchunk-mcp"] } } }
Your AI assistant can now handle massive changesets that previously caused failures in Cline, Roocode, Cursor, and other tools.
Once configured, your AI assistant can analyze large commits, branches, or diffs using diffchunk.
- "Review all changes in develop not in the main branch for any bugs"
- "Tell me about all the changes I have yet to merge"
- "What new features were added to the staging branch?"
- "Summarize all changes to this repo in the last 2 weeks"
- "Use diffchunk to check my feature branch for security vulnerabilities"
- "Use diffchunk to find any breaking changes before I merge to production"
- "Use diffchunk to review this large refactor for potential issues"
- "Use diffchunk to show me all database migrations that need to be run"
- "Use diffchunk to find what API changes might affect our mobile app"
- "Use diffchunk to analyze all new dependencies added recently"
- "Use diffchunk to analyze the diff at /tmp/changes.diff and find any bugs"
- "Create a diff of my uncommitted changes and review it"
- "Compare my local branch with origin and highlight conflicts"
Add to your AI assistant's custom instructions for automatic usage:
When reviewing large changesets or git commits, use diffchunk to handle large diff files. Create temporary diff files and tracking files as needed and clean up after analysis.
When you ask your AI assistant to analyze changes, it uses diffchunk's tools strategically:
- Creates the diff file(e.g.,git diff main..develop > /tmp/changes.diff) based on your question
- Useslist_chunksto get an overview of the diff structure and total scope, including per-file line counts viafile_details
- Usesfind_chunks_for_filesto locate relevant sections when you ask about specific file types
- Usesget_file_diffto fetch the complete diff for one specific file without loading an entire chunk
- Usesget_chunkto examine specific sections without loading the entire diff into context
- Tracks progress systematicallythrough large changesets, analyzing chunk by chunk
- Cleans up temporary filesafter completing the analysis
This lets your AI assistant handle massive diffs that would normally crash other tools, while providing thorough analysis without losing context.
list_chunks("/tmp/changes.diff") # -> 5 chunks across 12 files, 3,847 total lines, ~15,420 tokens # Each chunk includes token_count and file_details with per-file line counts # Response includes total_token_count for context-budget planning
find_chunks_for_files("/tmp/changes.diff", ".py") # → [1, 3, 5] - Python file chunks get_chunk("/tmp/changes.diff", 1) # → Content of first Python chunk
get_file_diff("/tmp/changes.diff", "src/main.py") # → Complete diff for src/main.py (header + all hunks) # Glob patterns work when they match exactly one file get_file_diff("/tmp/changes.diff", ".config") # → Complete diff for the single matching config file
# Process each chunk in sequence get_chunk("/tmp/changes.diff", 1) get_chunk("/tmp/changes.diff", 2) # ... continue through all chunks
- Absolute paths only:/home/user/project/changes.diff
- Cross-platform: Windows (C:\path) and Unix (/path)
- Home expansion:~/project/changes.diff
Tools auto-load with optimized settings:
- max_chunk_lines: 1000
- skip_trivial: true (whitespace-only)
- skip_generated: true (lock files, build artifacts)
load_diff( "/tmp/large.diff", max_chunk_lines=2000, include_patterns=".py,.js", exclude_patterns="test", context_lines=2 )
Use theformatparameter onget_chunkto transform output for LLM consumption:
# Default - raw diff output get_chunk("/tmp/changes.diff", 1, format="raw") # Annotated - structured with line numbers, file headers, hunk separation get_chunk("/tmp/changes.diff", 1, format="annotated") # Compact - token-efficient, only new hunks (context + added lines) get_chunk("/tmp/changes.diff", 1, format="compact")
Annotated formatadds## File:headers,__new hunk__/__old hunk__sections with new-file line numbers, and function context from@@headers.
Compact formatshows only what was added or kept, omitting removed lines and__old hunk__sections entirely. Useful when you only need to see the final state.
Usecontext_linesonload_diffto reduce context lines per hunk at load time:
# Keep only 2 lines of context around each change load_diff("/tmp/large.diff", context_lines=2) # Keep only changes, no context load_diff("/tmp/large.diff", context_lines=0)
This composes withformat- context is reduced at load time, then formatting is applied at display time.
- Git diff output (git diff,git show)
- Unified diff format (diff -u)
- Multiple files in single diff
- Binary file change indicators
- Efficiently handles 100k+ line diffs
- Memory efficient streaming
- Auto-reload on file changes
- Design- Architecture and implementation details
- Contributing- Contributing guidelines and development setup
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Prevents regression by providing Blast Radius data to AI based on your git history
Automate Google Jules, the AI coding assistant, for tasks like code reviews, repository management, and AI-powered development workflows.
Code intelligence MCP server - PageRank, blast radius, co-change, hotspots, clone detection across 34 languages in a single Rust binary.
Reverse-engineer architecture from source code (Go, TypeScript, Python) or markdown. 19 tools for architecture graphs, drift detection between git refs, and validation rules.
Refactor TypeScript and JavaScript codebases using ts-morph. Supports renaming symbols and files, moving symbols, and searching for references.
See how OSS libs in your stack are really used: source, tests, callers. C#, Java, TS, Python, Rust, PHP+.
Cross-language code graph extraction and visualization — symbols, call graphs, and cross-repo relationships across 34+ languages with incremental caching and federation support.
Integrates with the Gerrit code review system to review code changes and details.
Browse GitHub repositories, explore directories, and view file contents.
Token-efficient MCP server for GitHub source code exploration via tree-sitter AST parsing
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





