Command Palette

Search for a command to run...

0

Your MCP Tool Schemas Are Eating 86% of Your Context — Fix It with One Proxy

mcp-slim-guard is a free open-source proxy that compresses MCP tool schemas by up to 86%, saving thousands of tokens per call — while adding SSRF protection, injection detection, rate limiting, and audit logging.

Your MCP Tool Schemas Are Eating 86% of Your Context — Fix It with One Proxy

When you connect 10-15 MCP tools to your AI agent, you're silently burning $40-50/month on tool schema tokens alone. Here's a one-command fix.


The Silent Context Killer

If you use Claude Code, Cursor, Codex, or any AI coding agent with MCP servers, you've probably noticed something: the more tools you add, the dumber your agent gets.

That's not your imagination. Every MCP server exposes a tools/list response with JSON schemas for each tool — parameter names, types, descriptions, required fields. With 10-15 tools, that's 1,700+ tokens of pure schema metadata, loaded on every conversation turn.

At DeepSeek V4 Flash pricing ($0.15/M tokens), 10,000 tool calls/month without compression:

SetupTokens/callMonthly cost
14 tools, full schema1,736~$52
With mcp-slim-guard (light)300~$9

That's an 83% savings — $43/month — just from schema compression.

But compression alone isn't enough. You also need security.


Introducing mcp-slim-guard

mcp-slim-guard is a free open-source MCP proxy that sits between your AI agent and your MCP servers, adding two superpowers in one CLI:

🗜️ Schema Compression — 5 Levels

LevelStrategySavingsBest for
light3 wrapper tools, on-demand schema-83%Default. Best balance
normal2 wrapper tools-86%30+ tools, strong LLMs
extremeStrip descriptions in-place-22%Few tools with complex schemas
maximumSignature only-25%Very large individual schemas
lazyBudget preload + on-demand-5%30+ tools, rarely used

The key insight: light/normal replace all tools with 2-3 wrapper tools. The LLM fetches the actual schema on demand only when it needs to call a specific tool. Most LLMs never use all tools in a single conversation, so this saves context on every turn.

🛡️ Security Pipeline — Defense in Depth

Every tool call runs through a serial pipeline:

Agent Request → 1. Allow/Deny → 2. SSRF Shield → 3. Injection Detection → 4. Rate Limit → 5. Audit Log → Upstream
  • Allow/Deny: Glob-based pattern matching. Fail-closed by default.
  • SSRF Shield: Blocks 10., 192.168., 169.254.* — prevents internal network attacks
  • Injection Detection: 17 heuristic patterns for Shell/SQL/NoSQL/Prompt injection
  • Rate Limiting: Token bucket, per-tool configurable (default 60 req/min)
  • Audit Logging: Structured JSON with rotation + gzip compression

Bonus Features

FeatureWhy it matters
Request cacheTTL+LRU for read-only tools — 0.01ms cache hits
Hot reloadkill -HUP <pid> — zero-downtime config changes
Multi-server routingOne proxy, multiple upstream servers
STDIO + HTTPWorks with any MCP client

Quick Start

$ pnpm add -g mcp-slim-guard

# Auto-discover your MCP servers
cd your-project/
mcp-slim-guard init

# Dry-run to check for false positives
mcp-slim-guard validate

# Start the proxy (STDIO mode)
mcp-slim-guard start

Then update your AI agent's config to point to mcp-slim-guard instead of individual servers. That's it — you're now saving 83% on tool schema tokens with full security coverage.

Compare for Yourself

Featuremcp-slim-guardslim-mcpmcp-compressormcp-guardian
Schema compression✅ 5 levels, -86%✅ 5 levels, -77%
Accuracy validated✅ 180 API calls✅ 120
Request cache✅ TTL+LRU
Tool allow/deny✅ Glob-based
SSRF protection✅ IP + domain
Injection detection✅ 17 patterns
Rate limiting✅ Token bucket
Audit log✅ JSON, rotation
Hot reload✅ SIGHUP
Multi-server routing✅ Prefix auto-route
HTTP transport✅ Streamable HTTP
Compression + Security✅ One proxy❌ Compression only❌ Compression only❌ Security only

The Bottom Line

mcp-slim-guard is the only MCP proxy that combines schema compression with security. You don't need to choose between saving tokens and staying safe — you get both in one npm install.