# distil [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/munhq/distil  
**GitHub Stars:** 1  
**npm Downloads (last month):** 183  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/distil

## Description
Context optimization for LLM agents: tool registry, result masking, budgeting, compaction.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "distil": {
    "command": "npx",
    "args": ["-y","@munhq/distil"]
  }
}
```

## Documentation

## 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:

```bash
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.

_Full upstream README: https://allmcps.com/mcp/distil/readme_

