diffchunk
diffchunk is an MCP server that enables LLMs to efficiently navigate and analyze large diff files by splitting them into manageable chunks instead of loading entire diffs at once.
Load a diff file (
load_diff): Parse a diff file with custom settings such as chunk size, include/exclude glob patterns, and options to skip trivial (whitespace-only) or generated files (lock files, build artifacts).List all chunks (
list_chunks): Get a structured overview of all chunks, including file mappings and per-file line counts — useful as a first step to understand the scope of a large changeset.Retrieve a specific chunk (
get_chunk): Fetch the content of a numbered chunk, enabling systematic chunk-by-chunk analysis without exceeding LLM context limits.Find chunks by file pattern (
find_chunks_for_files): Search for chunks containing files matching a glob pattern (e.g.,*.py,*test*,src/*), allowing targeted navigation to relevant changes.Extract complete diffs for single files (
get_file_diff): Obtain the entire diff for a specific file regardless of chunk boundaries.Auto-loading: Tools except
load_diffautomatically load the diff with optimal defaults (max_chunk_lines: 1000,skip_trivial: true,skip_generated: true) if not explicitly loaded.Handle massive diffs: Efficiently processes 100k+ line diffs via memory-efficient streaming, supporting Git diff and unified diff formats — making large changesets usable in tools like Cline, Cursor, or Roocode.
Cross-platform path support: Works with absolute paths on Windows and Unix, including
~/home directory expansion.
Enables efficient navigation and analysis of large Git diff files through pattern-based chunk navigation, allowing LLMs to review massive changesets, branch comparisons, and code changes without exceeding context limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@diffchunk analyze the diff at /tmp/feature.diff and find any breaking changes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
diffchunk
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.
Problem
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.
Related MCP server: Large File MCP Server
Solution
MCP server with 5 navigation tools:
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)
Setup
Prerequisite: Install uv (an extremely fast Python package manager) which provides the uvx command.
Add to your MCP client configuration:
{
"mcpServers": {
"diffchunk": {
"command": "uvx",
"args": ["--from", "diffchunk", "diffchunk-mcp"]
}
}
}Usage
Your AI assistant can now handle massive changesets that previously caused failures in Cline, Roocode, Cursor, and other tools.
Using with AI Assistant
Once configured, your AI assistant can analyze large commits, branches, or diffs using diffchunk.
Here are some example use cases:
Branch comparisons:
"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"
Code review:
"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"
Change analysis:
"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"
Direct file analysis:
"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"
Tip: AI Assistant Rules
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.How It Works
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 questionUses
list_chunksto get an overview of the diff structure and total scope, including per-file line counts viafile_detailsUses
find_chunks_for_filesto locate relevant sections when you ask about specific file typesUses
get_file_diffto fetch the complete diff for one specific file without loading an entire chunkUses
get_chunkto examine specific sections without loading the entire diff into contextTracks progress systematically through large changesets, analyzing chunk by chunk
Cleans up temporary files after completing the analysis
This lets your AI assistant handle massive diffs that would normally crash other tools, while providing thorough analysis without losing context.
Tool Usage Patterns
Overview first:
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 planningTarget specific files:
find_chunks_for_files("/tmp/changes.diff", "*.py")
# → [1, 3, 5] - Python file chunks
get_chunk("/tmp/changes.diff", 1)
# → Content of first Python chunkSingle-file diff:
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 fileSystematic analysis:
# Process each chunk in sequence
get_chunk("/tmp/changes.diff", 1)
get_chunk("/tmp/changes.diff", 2)
# ... continue through all chunksConfiguration
Path Requirements
Absolute paths only:
/home/user/project/changes.diffCross-platform: Windows (
C:\path) and Unix (/path)Home expansion:
~/project/changes.diff
Auto-Loading Defaults
Tools auto-load with optimized settings:
max_chunk_lines: 1000skip_trivial: true (whitespace-only)skip_generated: true (lock files, build artifacts)
Custom Settings
Use load_diff for non-default behavior:
load_diff(
"/tmp/large.diff",
max_chunk_lines=2000,
include_patterns="*.py,*.js",
exclude_patterns="*test*",
context_lines=2
)Format Options
Use the format parameter on get_chunk to 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 format adds ## File: headers, __new hunk__/__old hunk__ sections with new-file line numbers, and function context from @@ headers.
Compact format shows only what was added or kept, omitting removed lines and __old hunk__ sections entirely. Useful when you only need to see the final state.
Context Reduction
Use context_lines on load_diff to 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 with format - context is reduced at load time, then formatting is applied at display time.
Supported Formats
Git diff output (
git diff,git show)Unified diff format (
diff -u)Multiple files in single diff
Binary file change indicators
Performance
Efficiently handles 100k+ line diffs
Memory efficient streaming
Auto-reload on file changes
Documentation
Design - Architecture and implementation details
Contributing - Contributing guidelines and development setup
License
Available Tools
5 toolsfind_chunks_for_filesARead-only
Locate chunks containing files that match a specific glob pattern. Auto-loads the diff file if not already loaded. Essential for targeted analysis when you need to focus on specific file types, directories, or naming patterns (e.g., '.py' for Python files, 'test' for test files, 'src/' for source directory). Returns chunk numbers which you then examine using get_chunk. CRITICAL: You must use an absolute directory path - relative paths will fail. DO NOT attempt direct file reading. Use this for efficient navigation to relevant changes instead of processing entire large diffs sequentially.
Inputs: pattern (required), absolute_file_path (required).
get_chunkARead-only
Retrieve the actual content of a specific numbered chunk from a diff file. Auto-loads the diff file if not already loaded. Use this for systematic analysis of changes chunk-by-chunk, or to examine specific chunks identified via list_chunks or find_chunks_for_files. CRITICAL: You must use an absolute directory path - relative paths will fail. DO NOT read diff files directly - they exceed LLM context windows. This tool provides manageable portions of large diffs. Track your progress through chunks when doing comprehensive analysis and clean up tracking documents before final results.
Inputs: chunk_number (required), absolute_file_path (required), format, include_context.
get_file_diffARead-only
Extract the complete diff for a single file from a loaded diff. Returns the diff --git header and all hunks for that file. Use this when you need changes for one specific file without fetching the entire chunk. Auto-loads the diff file if not already loaded. Supports exact file paths or glob patterns that match exactly one file. Use list_chunks with file_details to see per-file line counts and decide whether to use this tool or get_chunk. CRITICAL: You must use an absolute directory path - relative paths will fail.
Inputs: file_path (required), absolute_file_path (required).
list_chunksARead-only
Get an overview of all chunks in a diff file with file mappings and summaries. Auto-loads the diff file with optimal defaults if not already loaded. Use this as your first step to understand the scope and structure of changes before diving into specific chunks. CRITICAL: You must use an absolute directory path - relative paths will fail. DO NOT attempt to read the diff file directly as it will exceed context limits. This tool provides the roadmap for systematic chunk-by-chunk analysis. If using tracking documents to resume analysis, use this to orient yourself to remaining work. Each chunk includes a token_count estimate, and the response includes total_token_count for context-budget planning.
Inputs: absolute_file_path (required).
load_diffARead-only
Parse and load a diff file with custom chunking settings. Use this tool ONLY when you need non-default settings (custom chunk sizes, filtering patterns). Otherwise, use list_chunks, get_chunk, or find_chunks_for_files which auto-load with optimal defaults. CRITICAL: You must use an absolute directory path - relative paths will fail. The diff file will be too large for direct reading, so you MUST use diffchunk tools for navigation. When using tracking documents for analysis, remember to clean up tracking state before presenting final results. The response includes a files_excluded count showing how many files were removed by exclude_patterns.
Inputs: absolute_file_path (required), skip_trivial, context_lines, skip_generated, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: loading, listing, chunk retrieval, file-pattern search, and full file diff. No overlap or ambiguity.
All tool names follow the consistent snake_case verb_noun pattern (e.g., load_diff, list_chunks). Predictable and clear.
5 tools is well-scoped for a diff chunking server. Each tool serves a necessary function without being superfluous.
The toolset covers loading, listing, searching, and retrieving diff content. No obvious missing operations for the domain.
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Code-map tools for AI agents: see a repo's structure first, then edit only what matters.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables pattern-based file editing operations using copy/paste functionality with text landmarks instead of exact string matching. Allows AI agents to efficiently manipulate file content by identifying code patterns and insertion points without consuming large amounts of context tokens.1MIT
- AlicenseAqualityCmaintenanceEnables intelligent handling of large files through smart chunking, search with regex support, line navigation, and streaming capabilities without loading entire files into memory.630 npm18MIT
- AlicenseAqualityBmaintenanceMCP file cache for AI coding agents. Re-reading an unchanged file costs ~40 tokens instead of the whole file; a changed file comes back as a diff. Adds grep, BM25 search and glob over cached files, atomic edits with dry_run, and token-budgeted batch reads. One local daemon serves every client. No API keys, no GPU. Works with Claude Code, Cursor, VS Code, Codex and OpenCode.1479 PyPI3MIT
- AlicenseNot gradedqualityDmaintenanceProvides file caching and diff tracking for AI coding agents, reducing token usage by returning changes or confirming no changes instead of full file contents on repeated reads.46 npm220MIT