Labsco
MCP SERVER

Diffchunk

by peteretelej

Turns a diff too large to read into something navigable — an overview with token counts, then only the chunks or files you actually need.

Codebase Context Packing & CompressionVerified
Summary
The overview comes with a token count per chunk, which is what makes a large review plannable rather than hopeful.

Start with list_chunks and read the per-file line counts before deciding where to spend context. When you already know which file matters, get_file_diff pulls just that one, and the compact format drops removed lines entirely when only the final state is interesting.

What it is

A navigation layer over a diff file on disk. Instead of streaming a 50,000-line diff into the context window, the agent gets a map of it and pulls the parts that matter.

What you get
  • list_chunks as the first move: how many chunks, which files are in each, per-file line counts, a token count per chunk and a total, so the rest of the pass can be budgeted
  • get_chunk for one numbered chunk in raw diff, annotated (file headers, new-file line numbers, hunk separation and function context lifted from the @@ headers), or compact (context and added lines only)
  • find_chunks_for_files to locate the chunks holding files that match a glob — *.py, *test*, src/*
  • get_file_diff to extract one file's complete diff, header and all hunks, without pulling the chunk it sits in
  • load_diff when the defaults are wrong: a different chunk size, include and exclude patterns, and fewer context lines per hunk
  • Defaults applied automatically on first use: 1000 lines per chunk, whitespace-only changes skipped, and generated files such as lock files and build artefacts skipped
  • Handles git diff and git show output, unified diff -u format, many files in one diff, and binary-change indicators
Requirements

Uv installed, which provides uvx; run it over stdio as uvx --from diffchunk diffchunk-mcp. Python 3.10 or later. Nothing to authorize. Every tool takes an absolute path to the diff file — Windows and Unix paths both work and ~ expands — so create the diff first, for example git diff main..develop > /tmp/changes.diff. The file is auto-loaded with the default settings on the first call, which is why load_diff is only needed when you want different ones.