Reversible context compression for AI agents: cut token usage up to 94%, originals retrievable
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Zero-dependency, fully-reversible context compression for AI agents.
slimctx compresses what your agent reads β tool outputs, logs, JSON, source files, prose β before it reaches the LLM. Same answers, fraction of the tokens. Pure Python stdlib: no ML models, no downloads, no network calls, ever. Auditable end to end in ~1,600 lines.
Live output of python3 benchmarks/demo.py β run it yourself, nothing is staged.
| Workload | Before | After | Savings | Key facts kept |
|---|---|---|---|---|
| Code search (100 results) | 5,557 | 916 | 84% | β |
| SRE incident debugging | 61,699 | 298 | 100% | β |
| GitHub issue triage | 12,836 | 975 | 92% | β |
| Codebase exploration | 5,734 | 2,760 | 52% | β |
Every run also verifies that each planted "needle" (the FIXME, the OOMKill,
the outlier) survives compression, and that every lossy transform is
byte-exact reversible. Reproduce with python3 benchmarks/bench.py.
[slimctx-ref <hash> ...] marker. The
model β or you β can always get the byte-exact original back.Headroom is the established project in this space and is more featureful today (provider proxy with SSE streaming, agent wrappers, cross-agent memory, an ML compression model). slimctx makes a different set of trade-offs, aimed at locked-down / client-site deployments:
| Headroom | slimctx | |
|---|---|---|
| Reversibility | JSON only (CCR); dropped text is gone | every lossy transform |
| Log handling | generic text scoring | template mining ([x1432] collapse) |
| Code handling | AST skeleton | AST skeleton + query-relevant bodies kept |
| Dependencies | Rust core, ONNX runtime, 261MB HF model | stdlib only |
| Network egress | HuggingFace pull on first run | none, ever |
| Store encryption | none (plaintext SQLite) | cipher hook (bring your own) |
| Determinism | cache-aligner component | by construction (pure functions + memo) |
| Audit surface | ~10s of KLOC across 3 languages | ~1,200 lines of Python |
If you need the proxy/wrap ecosystem, use Headroom. If you need something you can read in an afternoon, run air-gapped, and certify for a client environment, use slimctx.
As a library (any framework): call pipe.compress(messages) right
before your provider SDK call; expose pipe.retrieve as a tool named
retrieve so the model can pull originals.
As an MCP server (GitHub Copilot, Claude Code, Cursor, ...): ships built in, stdlib-only:
See USAGE.md for the GitHub Copilot (.vscode/mcp.json) setup
and a security deployment checklist.
Encrypted store:
Apache-2.0. Original implementation β no code derived from Headroom.
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/token-optimizer)<a href="https://allmcps.com/mcp/token-optimizer"><img src="https://allmcps.com/api/badge/token-optimizer?style=directory" alt="Token Optimizer on AllMCPs" /></a>