context-slim
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
context-slim
Universal, zero-dependency token-saving compressor (CLI + Ultra-Lean stdio MCP Server + Portable SKILL.md) designed for Codex, Gemini CLI, Claude Code / Desktop, Cursor, OpenBot, and web AI chats (--copy).
Compresses files, project directories, JSON payloads, logs, CSVs, and Markdown before sending them to an LLM — cutting context bloat while preserving structural fidelity and enforcing maxTokens budgets.
Why context-slim?
Built-in Zero-Dependency Engine (
standalone): Compresses code, JSON/JSONL, terminal logs, CSVs, Markdown, and directories anywhere Node.js>= 18runs.Hybrid Acceleration (
auto/hybrid): Automatically leveragesrepomix(Tree-sitter AST compression for directories) andrtk(rtk json --keys-only) when installed locally, with deterministic built-in fallbacks.Zero MCP Schema Bloat: Exposes only 3 compact MCP tools (
slim_audit,slim_file,slim_text) under ~300 schema tokens so the server saves tokens instead of adding overhead.Ready for Web & Terminal Workflows: Pipe from stdin (
--stdin), copy straight to the system clipboard (--copy), or inspect savings first (inspect) before sending a single line to an AI model.
Related MCP server: distil
Compression Strategies by Format
Format |
|
|
Code ( | Strips comments while preserving string literals; collapses redundant blank lines | Extracts structural exports, classes, functions & imports skeleton |
JSON / JSONL | Compacts whitespace, replaces huge base64/data blobs, caps long arrays ( | Tighter depth/array caps or delegates to |
Logs & Stacktraces | Strips ANSI codes, collapses consecutive repeats ( | Tighter head/tail + ±1 context around errors/warnings |
CSV / TSV | Keeps header + sample head/tail rows with omitted row count | Compact head/tail preview |
Directories | Uses | Enforces |
Quick Start
1. Audit & Compress via CLI
# Dry-run token audit before sending anything to an AI
node bin/context-slim.cjs inspect ./src
# Compress a file or directory and copy straight to clipboard for any AI chat
node bin/context-slim.cjs pack ./src --level balanced --max-tokens 2500 --copy
# Compress piped terminal logs or JSON from stdin
cat app.log | node bin/context-slim.cjs text --format log --copy
# Check detected hybrid engines (built-in + rtk / repomix)
node bin/context-slim.cjs engines2. Install Across AI Clients (Codex, Gemini CLI, Claude, Cursor)
node bin/context-slim.cjs install --client all
node bin/context-slim.cjs statusThis atomically registers the ultra-lean context-slim MCP server and copies skill/SKILL.md into your local AI clients.
Ultra-Lean MCP Tools (bin/mcp-server.cjs)
Tool | Purpose | Required Input |
| Estimate token count & potential savings before reading |
|
| Compress a file or directory ( |
|
| Compress raw text, logs, JSON, or code snippets |
|
Verification
npm run check
npm testLicense
MIT — Built by Emerson Almeida (@deusbr).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Free no-LLM token savers: URL→Markdown, outline, JSON trim, log compress, token count; x402 extras
Token counting, RAG chunking, truncation, HTML to Markdown and JSON repair
Count tokens (o200k/cl100k), truncate to a budget, chunk text for RAG and estimate LLM cost.
List compression profiles, estimate gains, and compress images, PDFs, and Office files.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables local-first context compression for AI agents, offering tools to compress text, retrieve original content, and get compression statistics.MIT
- AlicenseAqualityAmaintenanceReversibly compress a large tool output to a recoverable 8-hex handle over stdio, expand it back to the exact original bytes on demand, and report a local token/dollar savings ledger. Zero runtime dependencies; content never leaves the machine.3626 PyPI21Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI coding agents to reduce token usage by condensing source code into AST skeletons, extracting specific symbols, compressing logs, and estimating token budgets.4MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to compress terminal output and file context in real time, preserving full error tracebacks while reducing token consumption by 60-85%.43MIT