Skip to content
Headroom

HeadroomMCP Server

Released
v0.37.0
Apache-2.0

Summary

Context-compression MCP server that shrinks tool outputs, logs, files and RAG chunks before they reach the model, cutting 60-95% of tokens on JSON payloads.

Features

  • headroom_compress, headroom_retrieve and headroom_stats exposed over MCP
  • Reversible compress-cache-retrieve store so originals stay recoverable
  • Content-type aware compression for JSON, source code, logs, git diffs and prose
  • Statistical error preservation keeps anomalies and out-of-range values intact
  • Also runs as a transparent proxy, a Python or TypeScript function, or a framework adapter
  • Adapters for LangChain, Agno, Strands, LiteLLM and the Vercel AI SDK

Installation

Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it.
  3. Restart the agent — the "Headroom" tools will be available.
{
  "mcpServers": {
    "headroom-mcp": {
      "command": "headroom",
      "args": [
        "mcp",
        "serve"
      ]
    }
  }
}

Description

What it does

Headroom attacks the most wasteful part of an agent loop: the raw text an agent reads. Tool responses, database rows, log tails, file reads and RAG chunks are mostly boilerplate the model never needs, and every one of those tokens is paid for on each turn. Headroom compresses that payload before it reaches the model, and the project reports 60-95% fewer tokens on JSON and roughly 20% fewer across a typical coding-agent session, with answers unchanged.

As an MCP server it exposes three tools to any MCP-compatible host:

  • headroom_compress — compress content on demand, returning a hash key plus the token savings it measured
  • headroom_retrieve — recover the original, uncompressed content from that hash key
  • headroom_stats — session totals for tokens saved and estimated cost saved
Why the retrieve step matters

Most context trimming is lossy and irreversible: once a summariser has thrown away a stack trace, the agent cannot get it back. Headroom's compression is reversible through a compress-cache-retrieve store, so the model sees a compact form by default and can pull the full original when it actually needs the detail. Compression is content-type aware — JSON arrays, source code, logs, git diffs and prose each get a different strategy — and error preservation uses field-variance statistics to keep anomalies and out-of-range values rather than a fixed keyword list.

Deployment

The MCP server is one of four ways to run it; Headroom also ships as a transparent proxy that needs no code changes, a Python function, a TypeScript function, and adapters for LangChain, Agno, Strands, LiteLLM and the Vercel AI SDK. Running the proxy alongside the MCP server compresses all traffic automatically instead of only what the agent explicitly compresses.

Practical notes

Apache 2.0, from Headroom Labs (founded by former Netflix engineer Tejas Chopra). The CLI is published as headroom-ai on both PyPI and npm; uv tool install "headroom-ai[mcp]" is the recommended install so the binary lands on PATH. Some clients need the absolute path from command -v headroom rather than the bare command. The full [all] extra pins to Python 3.13 because one dependency will not build on 3.14+, though token savings still track correctly on 3.14.

Related MCP Servers

MCP: Engram

by Gentleman Programming

New

Persistent memory for coding agents as a single Go binary — SQLite and FTS5 behind MCP, an HTTP API, a CLI and a TUI, with no Node, Python or Docker required.

MCP: agent-device

by Callstack

New

Give a coding agent a live feedback loop on real mobile, TV and desktop apps — inspect, tap, type and capture evidence on iOS, Android and HarmonyOS over MCP or a CLI.

New

The official W&B MCP server: query experiment runs, Weave LLM traces, artifacts and registries in natural language, and write findings back as a W&B report.

Featured

Replicate's official MCP server: search thousands of hosted models, read their schemas, and run predictions on image, video, audio and language models from inside an agent.

Browse all MCP servers →