# llmtrim

Local proxy and MCP server that compresses context before sending it to LLMs. Trims noisy logs and tool schemas to lower API bills.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 256
- Author: fkiene
- License: MPL-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/fkiene/llmtrim
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/mcp/llmtrim

## What it does

llmtrim intercepts agent requests locally to strip out filler data like repeated terminal logs and duplicated tool schemas. Your model receives a significantly leaner payload while original error messages and answers stay intact.

Processing happens entirely on your machine without third-party servers. The daemon provisions a private certificate in `~/.llmtrim/` restricted solely to LLM hostnames and wires into your shell via `HTTPS_PROXY`. Auth credentials pass directly through without being stored locally.

GitHub Copilot rejects this proxy because of certificate pinning. You inspect session compression metrics directly in your terminal using `llmtrim status`. When Claude Code is installed, the setup also hooks the `/sub` command to manage upstream accounts.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add llmtrim -- npx -y @llmtrim/cli
```

### Codex

**Platform CLI**
```bash
codex mcp add llmtrim -- npx -y @llmtrim/cli
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "llmtrim": {
            "command": "npx",
            "args": [
                "-y",
                "@llmtrim/cli"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "llmtrim": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@llmtrim/cli"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add llmtrim npx -y @llmtrim/cli
```

## When to use it
- cut API token costs by reducing prompt payload size
- filter noisy terminal output before forwarding to the model
- monitor local context compression metrics across coding sessions

## Example prompts
- Inspect compression gains using `llmtrim status`
- Repair local proxy configurations with `llmtrim doctor --fix`
- Run an isolated session through the proxy using `llmtrim wrap claude`

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
