Cut Claude Code / Cursor token usage on the outputs other tools can't touch.
RTK compresses bash command output (git status, npm test, cat). That's great — but it can't see two of the biggest token drains in modern agent workflows:
- MCP tool responses — database dumps, API JSON, browser tools, search results
- Bloated / pretty-printed JSON that ships indented straight into your context
mcpslim is a transparent MCP proxy that sits between your agent and your MCP servers and compresses tool results on the way back. It complements RTK — run both.
| Payload | Safe mode (default, lossless-leaning) | Aggressive mode (browse/list tools) |
|---|---|---|
A real 52 KB video-API list response |
−12% | −90% |
| A 516 KB pretty-printed JSON file | −59% | −99.8% |
We do not claim "90% on everything." That's only achievable by truncating data — which silently breaks any workflow that needs the full payload (e.g. "download all 50 results"). Here's the real model:
- Safe mode (default): minify JSON, drop empty/null fields, strip base64 blobs, truncate giant strings. Fully reversible-aware, never drops list items. Typical 12–60% with zero risk.
- Aggressive mode (opt-in per tool): also truncates long arrays. Up to 90% — only enable it on list/search/browse tools where you're scanning, not consuming.
You pick per-tool with a one-line profile. Safe is the default precisely so it never breaks you.
Claude Code ──JSON-RPC──▶ mcpslim-proxy ──JSON-RPC──▶ real MCP server
◀─compressed── ◀──full────────
- Forwards every request byte-for-byte (requests are tiny — we never touch them).
- On
tools/callresults, compressescontent[].text. - Fail-open: anything it can't parse is forwarded verbatim. It never makes a payload bigger.
initialize,tools/list, errors, notifications — all pass through untouched.- Newline-delimited JSON-RPC stdio transport.
git clone https://github.com/suncal/mcpslim.git
cd mcpslim
npm link # exposes `mcpslim-proxy` and `mcpslim` on your PATHNot yet on the npm registry — install from source for now.
npm i -g mcpslimis coming once it's published.
Quick sanity check (compress a captured payload):
mcpslim compress some-tool-output.json # safe mode
mcpslim compress some-tool-output.json --aggressiveIn your .mcp.json / Claude Code MCP config, change the server's launch command to go through the proxy:
That's it. The server behaves identically; outputs are just smaller.
{
"tools": {
"show_generations": "aggressive",
"default": "safe"
}
}list/browse tools → aggressive; everything else stays safe.
| Mode | Strategies | Use for |
|---|---|---|
safe (default) |
minify, drop empties, strip blobs, truncate huge strings | everything — zero risk |
aggressive |
+ truncate long arrays to first N | list/search/browse tools only |
off |
passthrough | debugging |
- It can't compress images/screenshots as text (those are vision tokens). Screenshot downscaling is on the roadmap as a separate pass.
- It can't touch your agent's native
Read/file tool (not an MCP call). Use RTK'scatwrapper for that. - It won't recover tokens already spent earlier in the conversation.
- Screenshot/image downscaling pass for browser & computer-use MCP tools
- Auto-profiling: learn per-tool safe truncation from observed usage
- Savings dashboard (tokens saved per server/tool/day)
- Hosted proxy + team config sync (paid tier)
Apache-2.0. Independent project; concept inspired by RTK (also Apache-2.0). No RTK code is used.
{ "mcpServers": { "higgsfield": { "command": "mcpslim-proxy", "args": [ "--mode", "safe", "--profile", "profiles/higgsfield.json", "--", "node", "/path/to/original-server.js" // original command + args ] } } }