LabscoMCP early access ↗
fkieneMCP SERVER

llmtrim

Compress LLM requests before they leave your machine — as a local proxy, a CLI, a library, or three MCP tools the agent calls on purpose.

by fkiene ↗Codebase Context Packing & CompressionCommunity

LABSCO SUMMARY

Three tools if you want the engine, a proxy if you want it automatic.

The MCP surface is the small door into a larger product: three tools that compress on request, with none of the CA-and-proxy setup the automatic path asks for. Two things hold either way — the default preset is quality-gated rather than lossless, so reach for safe when you need a byte-faithful round trip, and Anthropic and Gemini token counts are a BPE approximation flagged in status, because neither ships an exact public tokenizer.

What it is

A local proxy that trims LLM API traffic and forwards a smaller request, plus the same engine as a CLI, a library in six languages, and an MCP server. Compression runs on your machine and in-process, with no extra model call and nothing sent to the project. As an MCP server it is three tools — llmtrim_compress, llmtrim_compress_text and llmtrim_stats, the last reading the same ledger llmtrim status shows. Written in Rust (1.88+), MPL-2.0.

What you get

  • llmtrim_compress and llmtrim_compress_text — run a request or a block of text through the same engine the proxy uses, with no proxy involved
  • llmtrim_stats — the savings ledger, the same one llmtrim status reads
  • Client setup in one command: llmtrim mcp install for Claude Code, llmtrim mcp install --print to paste into anything else; the entry is the llmtrim command with the argument mcp
  • A proxy path for anything that honours HTTPS_PROXY — Claude Code, Codex CLI, Gemini CLI, Cursor, Cline, Roo, Aider and others. GitHub Copilot is out, because of certificate pinning
  • Presets chosen by traffic shape: auto (default, decides per request), safe (lossless input only), aggressive (max squeeze, quality-gated), plus agent, code, rag, cache, reasoning and frugal — set through LLMTRIM_PRESET or preset in $XDG_CONFIG_HOME/llmtrim/config.toml
  • The same engine as a library — cargo add llmtrim-core, pip install llmtrim, gem install llmtrim, @llmtrim/js over WASM, plus Kotlin and Swift packages
  • A savings view in the terminal — llmtrim status, with --daily, --weekly, --monthly, --json and --csv — and a menu-bar tray showing the same numbers
  • Published A/B numbers rather than claims: across 112 live cases, input tokens 71,031 → 49,062, output 25,843 → 6,628, round-trip cost $0.0365 → $0.0126, answer quality 78.9% → 82.2%

Requirements

For the MCP tools, the llmtrim binary on your PATH and nothing else — npm install -g @llmtrim/cli@latest, or Homebrew, Scoop, Cargo, the install script or the Docker image; the registry entry runs the npm package @llmtrim/cli as llmtrim mcp over stdio. Compression happens in-process, so there is no proxy to stand up and no API key stored. The proxy is a separate decision with a bigger footprint: llmtrim setup changes three things and llmtrim uninstall reverses all three — a name-constrained private CA in ~/.llmtrim/, HTTPS_PROXY plus CA trust in your shell environment, and a login service. Prompts never touch disk; recoverable tool results stay in bounded daemon RAM for five hours by default and disappear on restart.

Setup effort

One command — llmtrim mcp install