# distil

> distil is a free MCP server for ai models and llm tooling. Measures where an agent session's tokens and cost go, and trims context safely. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI
- **Repository:** https://github.com/munhq/distil
- **MCP Registry name:** io.github.munhq/distil
- **Categories:** AI models and LLM tooling, developer tools
- **Listing updated:** 2026-11-15

## About

The README opens with a measurement: across 13,814 local Claude Code transcripts, cache writes were 2% of tokens but 28% of cost. Its argument is that rewriting history usually costs more than it saves, so the useful move is to decline to admit tokens in the first place. It credits Anthropic's context-editing documentation for the break-even rule and presents its own numbers as a way to calibrate settings against your own workload.

The project is a Rust library of composable layers, including CacheAlign, Scratchpad, Budget, Masking, Summarization, Compaction, Registry and CodeMode, each reporting tokens before and after. A distil-bench tool analyses a folder of transcripts and prints a break-even table, and a probe tool grades whether a compressed context still answers questions.

The MCP server is the distil-mcp feature, installed with npx -y @munhq/distil. It needs no account or API key. The author recommends provider-native features such as clear_tool_uses where they exist.

## Features

- **Transcript benchmarking:** distil-bench shows where tokens sit and what they cost with cache pricing applied.
- **Break-even table:** Shows how large a clear must be to pay off for a given number of remaining turns.
- **Composable layers:** Cache alignment, scratchpad, budget, masking, summarization and compaction layers.
- **Retention probes:** Checks whether compressed context can still answer recall and decision questions.
- **No account needed:** Installs through npx with no API key.

## Good for

- Find out what share of your agent sessions is tool output
- Choose a clear_at_least value for context editing
- Keep a long-running agent under its context limit
- Compare context compressors on real session traffic

## Install

### Claude Code (Terminal)

```sh
claude mcp add distil -- npx -y @munhq/distil
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## FAQ

### Does it need an API key?

No. The README says there is no account, no key and nothing to configure.

### How do I install it?

Run claude mcp add distil -- npx -y @munhq/distil, or use the Cursor and VS Code install links.

### Should I always compress history?

The README argues against it: editing history invalidates the cached prefix, so it recommends rewriting only at context overflow.

### What language is it written in?

Rust, with a small npm wrapper that fetches a checksum-verified binary.

### Is distil free?

Yes. distil is free to use.

### How do I add distil to Claude Code?

Run this command in your terminal: claude mcp add distil -- npx -y @munhq/distil

### What are the best alternatives to distil?

The closest alternatives to distil are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/distil-2
