Skip to main content
MCP server CX Codex

chunk-invariance — Claude Code MCP server: setup and checks

Tests streaming filters for secrets split across chunks and can create a pytest regression test when a split breaks the result.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add chunk-invariance -- uvx chunk-invariance
Open on GitHub

What chunk-invariance does

chunk-invariance compares a filter’s whole-input result with the output produced after feeding the same text in chunks. It tries the requested splits, reports the first mismatch, and shows the input, chunk list, expected output, and streamed output. The API handles str, bytes, and async generator filters.

Its MCP server exposes check_stream_filter, write_regression_test, and explain. It imports a function from your module, runs it in a separate process with a timeout, and can return a pytest file built around assert_chunk_invariant. The server makes no network calls and writes no files by itself. Use invented samples only: leaked values and test samples are included in tool results and generated tests, then sent with the conversation to the model provider.

What it helps with

  • detect secrets split between streamed chunks
  • compare whole-input and streaming filter output
  • catch short carryover buffers and missing end flushes
  • generate a regression test for CI

Example prompts for the agent

  • Check whether redact_stream in myapp/filters.py leaks values across chunk boundaries, then create a regression test.
  • Run the check on made-up API-key samples for redact_stream.
  • Explain why filtering each chunk independently can expose a secret.

How to install chunk-invariance

Platform CLI

claude mcp add chunk-invariance -- uvx chunk-invariance

uvx runs the command named after the package; if the README names another one, use uvx --from chunk-invariance <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 chunk-invariance

How do I install chunk-invariance in Claude Code?

Run claude mcp add chunk-invariance -- uvx chunk-invariance.

What does chunk-invariance do?

It tests a streaming filter against different input splits and compares the joined stream with whole-input processing. A failure includes the split that caused the mismatch.

Does it test a running gateway?

No. The server calls an in-process function and does not exercise an upstream model, network path, or SSE parser.

Similar MCP servers

All MCP servers for Testing and QA →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor