Skip to main content
Glama

Toonify MCP

English | 繁體中文 | 日本語 | Español | Français | Deutsch | 한국어 | Русский | Português | Tiếng Việt | Bahasa Indonesia

Toonify MCP — context compression for Claude Code

Context compression plugin for Claude Code. Automatically trims large tool output—JSON, YAML, stack traces, and logs—before it enters the context window.

Works as a Claude Code plugin (automatic, zero-config) or as an MCP server (on-demand).

Features

  • Compresses large JSON, YAML, and API responses

  • Reduces long test failures and stack traces

  • Runs automatically in the background—no change to your Claude Code workflow required

Related MCP server: token-optimizer-mcp

Limitations

Skipped for short text, very small files, and content where exact original formatting must be preserved.

Installation

git clone https://github.com/PCIRCLE-AI/toonify-mcp.git
cd toonify-mcp
npm install
npm run build
npm install -g .
toonify-mcp setup
toonify-mcp doctor

toonify-mcp setup adds the local marketplace and installs, updates, or re-enables the plugin automatically.

Check status

toonify-mcp status

MCP mode (optional)

toonify-mcp setup mcp
claude mcp list

claude mcp list should show toonify: toonify-mcp - ✓ Connected.

Pipe filter (any agent CLI)

toonify-mcp compress reads stdin, compresses what's safe to compress (JSON/YAML → TOON, repetitive logs collapsed; source code, prose, and precision-sensitive numbers pass through untouched), and writes to stdout. It never breaks a pipe — when compression doesn't apply, the input comes out byte-for-byte.

curl -s https://api.example.com/users | toonify-mcp compress

This works with any agent CLI, because output is compressed before it enters the model's context. To have an agent adopt it, add a rule to your project's agent instructions (e.g. AGENTS.md):

When a command is likely to print large JSON/YAML or long logs,
pipe it through `toonify-mcp compress` (e.g. `curl ... | toonify-mcp compress`).
It only rewrites output it can compress losslessly; everything else passes through.

OpenAI Codex CLI (on-demand)

toonify-mcp setup codex

Registers toonify as an MCP server in ~/.codex/config.toml (a timestamped backup of the file is made first). Codex can then call the optimize_content tool on demand.

Note: on Codex this is on-demand, not automatic — Codex's hooks cannot yet replace tool output the way Claude Code's updatedToolOutput does, and appending a compressed copy would grow context instead of shrinking it. For automatic compression on Codex, use the pipe filter above.

Docs

Available Tools

5 tools
cleanup_expired_cacheB

Clean up expired cache entries and return the number of entries removed

Inputs: no named parameters.

clear_cacheB

Clear the optimization result cache

Inputs: no named parameters.

get_cache_statsA

Get detailed cache statistics (LRU cache + Prompt cache)

Inputs: no named parameters.

get_statsB

Get token optimization statistics

Inputs: no named parameters.

optimize_contentB

Optimize structured data content for token efficiency using TOON format

Inputs: content (required), toolName.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool has a distinct role—optimize, stats, and cache maintenance—but get_stats vs get_cache_stats and clear_cache vs cleanup_expired_cache could be confused without careful reading. The descriptions generally clarify the boundaries.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern: optimize_content, get_stats, clear_cache, get_cache_stats, cleanup_expired_cache. The naming is predictable and readable.

    Tool Count5/5

    Five tools is a well-scoped set for a token optimization utility: one core operation, one statistics endpoint, and three cache-management tools. Each tool has a clear place and none feel like filler.

    Completeness5/5

    The tool surface covers the main optimize operation, general statistics, and comprehensive cache lifecycle management (view, clear, cleanup expired). This is a complete and practical set for the server's stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Automatically reduces token usage in Claude Code sessions using algorithmic optimizations like code compression, smart file reading, output summarization, and prompt rewriting, with no extra API calls or cost.
      62 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Reduces context window usage by 60-90% through intelligent caching, compression, and smart tool replacements for Claude Code and Claude Desktop.
      3,899 npm
      580
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides code compression and analysis tools for Claude Code, reducing token usage while preserving code structure.
      102 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Compresses tool outputs, manages token budgets, deduplicates content, and filters by relevance to optimize context window usage for AI agents.
      MIT