Skip to content
MCP server

distil

Measures where an agent session's tokens and cost go, and trims context safely

Runs locallyStatus and history
Install
Pricing
Free
Platforms
CLI
Runs
Locally
Version
0.3.5
Listing updated
2 days ago

About distil

distil is a free MCP server for ai models and llm tooling. It runs locally on your machine and is started by your AI client.

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.

Install

Run in a terminal

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

Add to claude_desktop_config.json

{
  "mcpServers": {
    "distil": {
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "distil": {
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

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

Add to ~/.codeium/windsurf/mcp_config.json

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

Add to your client's MCP settings (most use this shape)

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

What it does

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

Pricing

Free

No account or API key needed

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 to distil

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Ouroboros

    MCP server

    Spec-first layer that pins requirements and verifies results of AI coding agent work

    Runs locally
    • Open source
    • 6.4K GitHub stars
    • Developer tools