diffchunk
Enables LLMs to efficiently navigate and analyze large diff files by providing pattern-based chunk navigation, allowing direct access to relevant changes without loading entire diffs into context.
README
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.
Solution
MCP server with 4 navigation tools:
load_diff- Parse diff file with custom settings (optional)list_chunks- Show chunk overview with file mappings (auto-loads)get_chunk- Retrieve specific chunk content (auto-loads)find_chunks_for_files- Locate chunks by file patterns (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 question - Uses
list_chunksto get an overview of the diff structure and total scope - Uses
find_chunks_for_filesto locate relevant sections when you ask about specific file types - Uses
get_chunkto examine specific sections without loading the entire diff into context - Tracks 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
Target 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 chunk
Systematic analysis:
# Process each chunk in sequence
get_chunk("/tmp/changes.diff", 1)
get_chunk("/tmp/changes.diff", 2)
# ... continue through all chunks
Configuration
Path Requirements
- Absolute paths only:
/home/user/project/changes.diff - Cross-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*"
)
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 - Development setup and workflows
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。