🎯 Toonify MCP
English | 繁體中文 | 日本語 | Español | Français | Deutsch | 한국어 | Русский | Português | Tiếng Việt | Bahasa Indonesia
Toonify MCP is an MCP server and Claude Code plugin for automatic token optimization in structured data and source-code workflows.
It is designed for teams that regularly send large JSON / CSV / YAML payloads or TypeScript / Python / Go source files into model context and want lower token usage without changing day-to-day workflow.
- Structured data: 25-66% token reduction (typically ~48%)
- Source code: 20-48% reduction on TypeScript / Python / Go
- Docs and setup guides: https://toonify.pcircle.ai/
What's New in v0.6.0
✨ Pipeline Architecture + Code Compression!
- ✅ Pipeline engine — modular Detector → Router → Compressor → Evaluator architecture
- ✅ Code compression — TypeScript (37%), Python (48%), Go (32%) savings via heuristic-based comment/whitespace removal
- ✅ 6 compression layers — from safe (blank lines, inline comments) to aggressive (import summarization, repetitive pattern collapse)
- ✅ Hook upgraded — PostToolUse hook now compresses source code in addition to structured data
- ✅ Extensible design — add new formats by implementing a single
Compressor interface
- ✅ Full backwards compatibility — all external APIs unchanged
- ✅ 196 tests (up from 157), comprehensive code review passed
Features
- 25-66% Token Reduction (typically ~48%) for JSON, CSV, YAML data
- 20-48% Code Compression for TypeScript, Python, Go source code
- Pipeline Architecture - Extensible Detector → Compressor → Evaluator engine
- Multilingual Support - Accurate token counting for 15+ languages
- Enhanced Caching - LRU cache with TTL expiration and optional disk persistence
- Fully Automatic - PostToolUse hook intercepts tool results
- Zero Configuration - Works out of the box with sensible defaults
- Dual Mode - Works as Plugin (auto) or MCP Server (manual)
- Built-in Metrics - Track token savings locally
- Silent Fallback - Never breaks your workflow
- Security Hardened - Input size limits, path validation, safe regex, atomic writes
Installation
Option A: Download from GitHub (Recommended) 🌟
Install directly from the GitHub repository (no npm publish required):
# 1. Download the repository
git clone https://github.com/PCIRCLE-AI/toonify-mcp.git
cd toonify-mcp
# 2. Install deps and build
npm install
npm run build
# 3. Install globally from local source
npm install -g .
Option B: Install from Claude Marketplaces (if available) 🌟
One-click installation through Claude Marketplaces:
Browse to Claude Marketplaces in Claude Code and install toonify-mcp with one click when marketplace distribution is available for your environment.
Option C: Claude Code Plugin (Recommended) ⭐
Automatic token optimization with zero manual calls:
Prerequisite: complete Option A or Option B so the toonify-mcp binary is available.
# 1. Add as plugin (automatic mode)
claude plugin add toonify-mcp
# 2. Verify installation
claude plugin list
# Should show: toonify-mcp ✓
That's it! The PostToolUse hook will now automatically intercept and optimize structured data from Read, Grep, and other file tools.
Option D: MCP Server (Manual mode)
For explicit control or non-Claude Code MCP clients:
Prerequisite: complete Option A or Option B so the toonify-mcp binary is available.
# 1. Register as MCP server
claude mcp add toonify -- toonify-mcp
# 2. Verify
claude mcp list
# Should show: toonify: toonify-mcp - ✓ Connected
Then call tools explicitly:
claude mcp call toonify optimize_content '{"content": "..."}'
claude mcp call toonify get_stats '{}'
How It Works
Plugin Mode (Automatic)
User: Read large JSON file
↓
Claude Code calls Read tool
↓
PostToolUse hook intercepts result
↓
Pipeline: Detect → Route → Compress → Evaluate
↓
JSON/CSV/YAML → TOON format (25-66% savings)
Source code → comment/whitespace removal (20-48% savings)
↓
Optimized content sent to Claude API ✨
MCP Server Mode (Manual)
User: explicitly calls mcp__toonify__optimize_content
↓
Content converted to TOON format
↓
Returns optimized result
Configuration
Create ~/.claude/toonify-config.json (optional):
{
"enabled": true,
"minTokensThreshold": 50,
"minSavingsThreshold": 30,
"skipToolPatterns": ["Bash", "Write", "Edit"]
}
Options