Free & Open Source
Token Optimization for Claude Code

GitHub stars GitHub forks License Version npm downloads

Automatically reduce Claude API token usage by 30-65% (typically 50-55%) for JSON, CSV, and YAML data through transparent TOON format conversion.

MIT Licensed • Free Forever • Community Driven
30-65%
Token Reduction
50-500x
Cache Performance
15+
Languages Supported
100%
Automatic

Key Features

Built for developers who care about efficiency

🎯

Automatic Optimization

PostToolUse hook intercepts tool results and applies TOON format conversion transparently. No manual calls needed.

claude plugin add toonify-mcp

Enhanced Caching

LRU cache with TTL expiration achieves 50-500x performance improvement on cache hits (~0.1ms vs 5-50ms).

🌍

Multilingual Support

Accurate token counting for 15+ languages with language-aware multipliers (2x Chinese, 2.5x Japanese, 3x Arabic).

🔧

Zero Configuration

Works out of the box with sensible defaults. Optional configuration file for advanced customization.

🔄

Dual Mode

Works as Plugin (automatic) or MCP Server (manual). Choose the mode that fits your workflow.

📊

Built-in Metrics

Track token savings locally with comprehensive statistics. Monitor cache hit rates and performance.

How It Works

Transparent optimization in Plugin mode

1

User reads large JSON file

Claude Code calls Read tool to fetch file contents

2

PostToolUse hook intercepts result

Hook automatically checks if content should be optimized

3

TOON format conversion

JSON/CSV/YAML converted to compact TOON representation

4

Optimized content sent to Claude API

50-55% typical token reduction achieved ✨

Installation

Get started in minutes

Option A: Download from GitHub

# Download the repository git clone https://github.com/PCIRCLE-AI/toonify-mcp.git cd toonify-mcp # Install deps and build npm install npm run build # Install globally from local source npm install -g . # Add as plugin (automatic mode) claude plugin add toonify-mcp # 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 B: MCP Server Mode

# Prerequisite: complete Option A to install toonify-mcp # Register as MCP server claude mcp add toonify -- toonify-mcp # Verify claude mcp list # Should show: toonify: toonify-mcp - ✓ Connected

For explicit control or non-Claude Code MCP clients. Call tools manually when needed.

Examples

See the token reduction in action

Before Optimization (142 tokens)

{ "products": [ {"id": 101, "name": "Laptop Pro", "price": 1299}, {"id": 102, "name": "Magic Mouse", "price": 79} ] }

After Optimization (57 tokens, -60%)

[TOON-JSON] products[2]{id,name,price}: 101,Laptop Pro,1299 102,Magic Mouse,79
Automatically applied in Plugin mode - no manual calls needed!

Ready to Optimize Your Token Usage?

Join developers who are saving 30-65% on Claude API token costs