mcp-crush
v0.1.0
Published
MCP token auditor and stdio proxy that compresses tool schemas and prunes bloated JSON responses
Maintainers
Readme
mcp-crush
One line: npx mcp-crush wrap -- <your-mcp-cmd> (or bunx mcp-crush wrap -- <your-mcp-cmd>): stdio proxy that shrinks MCP tool catalogs and prunes oversized JSON responses by 60-85%.
Why
Large MCP servers (GitHub, Cloudflare, Notion) dump thousands of tokens into tools/list before your agent does any work. Local 8k models cannot fit them, and cloud APIs bill you for that handshake on every session.
mcp-crush sits in the middle using the same JSON-RPC wire protocol while emitting smaller payloads.
Install
bunx mcp-crush audit
npx mcp-crush audit
# or install in your project / globally
bun add -d mcp-crush
npm i -D mcp-crushJSR:
bunx jsr add @kanchingyg/mcp-crush
npx jsr add @kanchingyg/mcp-crushQuick start
# Inspect token overhead from your MCP config
npx mcp-crush audit
bunx mcp-crush audit
# Wrap any stdio MCP server
npx mcp-crush wrap -- npx -y @modelcontextprotocol/server-github
# Ollama-friendly schema pack (~600 token budget)
npx mcp-crush wrap --ollama-pack -- npx -y @modelcontextprotocol/server-github
# Expose audit/compress/prune as MCP tools
npx mcp-crush --mcpOllama / LM Studio
Set OLLAMA_HOST (default http://127.0.0.1:11434). With --mcp, mcp-crush probes n_ctx and tunes truncation automatically. Use --ollama-pack on wrap to cap tools/list schemas around 600 tokens.
Production guards
Built into src/bridge.ts:
- Read-only default,
--dry-run, and loop breaker on repeated identical tool calls n_ctxprobe + head/tail truncation + recency-friendly output budgets- Embedding batch normalizer (empty string filter, MRL slice, L2 norm)
- MCP stdio stdout guard + Windows/WSL path normalization
- Reasoning-model quirks (
reasoning_content, strip thinking blocks, omittemperatureon reasoners)
