Distil logo

Distil

Optimizes agent context with tool registration, result masking, token budgets, compaction, and cache-aware pipeline layers.

Install Distil

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "distil": {
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

The distil MCP server helps optimize LLM agent context by applying tool registry, result masking, budgeting, and compaction capabilities. It is distributed as an npm package that downloads and verifies a platform-specific binary, with an MCP feature available in the Rust project. Reach for it when an agent needs measurable context handling or needs to respond to context overflow. Its benchmark utilities can analyze local Claude Code transcripts and compare token distribution, cost, and retention.

Use cases

  • Optimize agent context before requests
  • Measure token distribution across Claude Code sessions
  • Apply budgets during context overflow
  • Evaluate retention after compression
  • Compare context transformations on exported sessions

Key features

  • Tool registry and code-mode layers
  • Result masking, summarization, and compaction
  • Token budgeting and cache alignment
  • Transcript benchmarking and token accounting
  • Artifact and model-graded retention probes
  • Rust library and MCP server builds

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

8/8 checks healthy over the last 41d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 14d ago via OSV.dev · @munhq/distil (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads183Package downloads in the last 30 days.
Last commit15d agoMost recent push to the default branch.

How Distil works

What distil does

The distil MCP server provides context-management components for LLM agent pipelines. Its documented capabilities include tool registration, masking tool results, enforcing token budgets, and compacting context. The project also includes layers for cache-aware ordering and external scratchpad state, which can reduce unnecessary changes to the stable prompt prefix or keep working data outside the active context window.

The repository is also a Rust library. Pipelines accept messages, tools, and turn information, then report token counts before and after optimization along with a detail line for each layer. The MCP build is exposed through the mcp feature and produces the distil-mcp server.

How it works

A pipeline combines a token counter with one or more layers. The documented example uses EstimateCounter and CacheAlignLayer, then optimizes a mutable context. Available layer categories include registry, masking, summarization, compaction, budgeting, cache alignment, scratchpad state, and code mode.

The project emphasizes measuring changes against real transcripts rather than relying only on fixture-based savings percentages. distil-bench can inspect a Claude Code transcript directory, calculate where tokens are used, estimate cache-related costs, split sessions by tool usage, and export sessions for comparison with other compressors. Retention checks are available through artifact-based tests and optional model-graded probes.

The README advises treating history-rewriting layers as an option for context overflow rather than a default optimization. It also recommends provider-native context editing for clearing old tool results when that behavior is available, and notes that native tool search and programmatic tool calling should be preferred over the project's older registry and code-mode layers where applicable.

Setup and configuration

The standard installation uses npm and requires no account, API key, or configuration values. A compatible client can launch the package with:

Terminal
npx -y @munhq/distil

Claude Code can register it with claude mcp add distil -- npx -y @munhq/distil. Install links are provided for Cursor and VS Code. The npm wrapper retrieves the binary for the current platform and verifies it against published checksums. An install.sh script and prebuilt binary are also available for environments without Node.

For library and benchmarking workflows, build with Cargo. The bench feature provides distil-bench; probe adds distil-probe; tiktoken enables accurate BPE counts; proxy provides an HTTP server; metrics adds a Prometheus endpoint; and mcp builds the MCP server.

Tools and capabilities

The distil MCP server is suited to workflows that need:

  • Tool registration and context-aware tool handling
  • Masking or compacting results when context limits are reached
  • Budget-based control of context size
  • Cache-aligned content ordering
  • Scratchpad state kept outside the active window
  • Transcript analysis, token accounting, and retention checks

The benchmark commands can emit JSON, filter sessions by a selected tool, and export session data. Each pipeline layer reports its own before-and-after token counts, making individual transformations measurable.

Limitations and notes

The package is therefore best understood from its documented context pipeline and benchmarking features rather than from a fixed catalog of MCP operations.

Results depend on the agent workload and transcript corpus. The project warns that rewriting history can invalidate cached prefixes and increase input cost, so masking, summarization, and compaction should be evaluated against the actual number of remaining turns and the required retention level. Native provider features may be preferable for tool-result clearing, tool search, and programmatic tool calling.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Distil

distil is an MCP server that connects an LLM agent to context-optimization capabilities, including tool registration, result masking, token budgeting, and compaction. It runs locally through the distil package, requires no account or API key, and is also available as a Rust library with measurable pipeline layers.

Install it with `npx -y @munhq/distil`, or register it in Claude Code with `claude mcp add distil -- npx -y @munhq/distil`. Cursor and VS Code installation links are provided. The package downloads and verifies the binary for the current platform.

Yes, distil provides a Cursor installation link and can run through its standard npm command. The README also provides an installation link for VS Code and a direct registration command for Claude Code.

Yes, the `distil-bench` binary analyzes local Claude Code transcripts for token distribution, cache-related cost estimates, and break-even data. It can output JSON, split sessions by tool, and export sessions for evaluation with other compressors.

No, the standard package requires no account, API key, or configuration. It runs locally after the npm wrapper fetches and verifies the platform-specific binary.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDistil AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/distil?style=directory)](https://allmcps.com/mcp/distil)
HTML Embed
<a href="https://allmcps.com/mcp/distil"><img src="https://allmcps.com/api/badge/distil?style=directory" alt="Distil on AllMCPs" /></a>