Toon MCP
MCP server for TOON format - token-efficient JSON alternative for LLM prompts
Ask AI about Toon MCP
Powered by Claude · Grounded in docs
I know everything about Toon MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
TOON MCP Server
MCP server exposing TOON format for LLM cost optimization. 18-40% token savings over JSON.
Repository: github.com/copyleftdev/toon-mcp
Demo

Installation
cargo build --release
Usage
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"toon": {
"command": "/path/to/toon-mcp"
}
}
}
Claude Code CLI
Add to ~/.claude/settings.json:
{
"mcpServers": {
"toon": {
"command": "/path/to/toon-mcp"
}
}
}
Or for project-specific configuration, create .mcp.json in your project root:
{
"mcpServers": {
"toon": {
"command": "/path/to/toon-mcp"
}
}
}
Cursor IDE
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"toon": {
"command": "/path/to/toon-mcp"
}
}
}
Generic MCP Client
The server uses stdio transport. Connect by spawning the process and communicating via stdin/stdout:
# Start server and send initialize request
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"my-client","version":"1.0"}}}' | ./toon-mcp
Example in Node.js:
const { spawn } = require('child_process');
const server = spawn('./toon-mcp');
server.stdout.on('data', (data) => {
console.log('Response:', JSON.parse(data));
});
server.stdin.write(JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "initialize",
params: {
protocolVersion: "2024-11-05",
capabilities: {},
clientInfo: { name: "my-client", version: "1.0" }
}
}) + '\n');
Tools
toon_encode
Convert JSON to TOON format.
{"json": {"users": [{"id": 1, "name": "Alice"}]}}
Options:
delimiter- "comma" (default), "tab", or "pipe"indent- Spaces for indentation (0-8, default: 2)fold_keys- Enable v1.5 key foldingflatten_depth- Max depth for key folding
toon_decode
Convert TOON back to JSON.
{"toon": "name: Alice\nage: 30"}
Options:
strict- Strict validation (default: true)coerce_types- Type coercion (default: true)expand_paths- Path expansion (default: false)output_format- "json" or "json_pretty" (default: "json")
toon_validate
Check TOON syntax without full decoding.
{"toon": "x: 1"}
Returns: {"valid": true} or {"valid": false, "error": {...}}
toon_stats
Compare token and byte counts between JSON and TOON.
{"json": {"data": [1, 2, 3]}}
Returns savings percentages for bytes and tokens.
toon_ping
Verify server connectivity.
Returns: "pong - toon-mcp server is running"
Development
cargo check # Type check
cargo build # Debug build
cargo build --release # Release build
cargo test # Run all tests
cargo clippy # Lint
cargo fmt # Format
Contributing
Contributions are welcome! Please open an issue or submit a PR at github.com/copyleftdev/toon-mcp.
License
MIT - See LICENSE for details.
