JSON2TOON MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@JSON2TOON MCP Server compress this JSON with extreme level and show savings"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
JSON2TOON v2.0 π
Advanced Token-Optimized Object Notation - The most powerful JSON compression system for AI context management.
JSON2TOON is a next-generation MCP server that revolutionizes JSON compression with AI-powered pattern detection, achieving 75-85% token reduction while maintaining perfect data integrity.
β¨ Key Features
π― 4 Compression Levels
MINIMAL (30-40% savings): Lightning-fast key abbreviations
STANDARD (40-60% savings): Balanced performance + compression
AGGRESSIVE (60-75% savings): Advanced pattern optimization
EXTREME (75-85% savings): Maximum compression with zlib
π€ AI-Powered Pattern Detection
17+ Pattern Types: API responses, databases, time series, graphs, trees, and more
Smart Strategy Selection: Automatic optimization based on data structure
Confidence Scoring: Each pattern comes with accuracy metrics
Compression Potential: Estimates savings before conversion
π§ 12 Advanced MCP Tools
convert_to_toon- Multi-level JSON compressionconvert_to_json- Lossless decompressionanalyze_patterns- Deep pattern analysis with AIget_optimal_strategy- AI-recommended compression plancalculate_metrics- Detailed compression statisticsbatch_convert- High-performance batch processingsmart_optimize- Auto-detect and apply best compressioncompare_levels- Side-by-side level comparisonvalidate_toon- Format validation + round-trip testingsuggest_abbreviations- Custom abbreviation generationestimate_savings- Pre-conversion savings estimationget_server_stats- Real-time performance metrics
π‘ Advanced Capabilities
150+ Key Abbreviations (vs 68 in TOON v1.0)
String Dictionary: De-duplication for repeated values
Partial Schema Compression: Works with inconsistent data
Value Pattern Compression: Optimizes timestamps, UUIDs, URLs, emails
Reference System: Eliminates duplicate structures
zlib Integration: Optional extreme compression
Related MCP server: everything-slim
π Performance Benchmarks
Data Type | Compression | Speed | Round-Trip |
API Responses | 50-65% | 0.3ms/KB | β Perfect |
Database Results | 60-70% | 0.3ms/KB | β Perfect |
Time Series | 65-75% | 0.5ms/KB | β Perfect |
User Profiles | 45-55% | 0.3ms/KB | β Perfect |
Config Files | 40-55% | 0.1ms/KB | β Perfect |
π Quick Start
Installation
# Clone repository
git clone https://github.com/muhammedehab35/JSON2TOON-MCP.git
cd json2toon
# Install with pip
pip install -e .
# Or use Docker
docker-compose up -dMCP Configuration
Add to your Claude Desktop config (~/.config/Claude/claude_desktop_config.json):
{
"mcpServers": {
"json2toon": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/path/to/json2toon"
}
}
}Docker Configuration:
{
"mcpServers": {
"json2toon": {
"command": "docker",
"args": ["run", "-i", "json2toon:2.0.0"]
}
}
}π» Usage Examples
Basic Conversion
from src.advanced_converter import convert_json_to_toon, convert_toon_to_json, CompressionLevel
# Simple conversion with STANDARD level
data = {
"id": 12345,
"name": "John Doe",
"email": "john@example.com",
"created_at": "2025-01-01T00:00:00Z"
}
# Convert to TOON
toon = convert_json_to_toon(data, level=CompressionLevel.STANDARD)
print(f"Compressed: {toon}")
# Convert back to JSON
original = convert_toon_to_json(toon)
print(f"Restored: {original}")Advanced Pattern Analysis
from src.pattern_analyzer import AdvancedPatternAnalyzer
analyzer = AdvancedPatternAnalyzer()
# Analyze your data
patterns = analyzer.analyze(large_json_data)
# Get compression strategy
strategy = analyzer.get_compression_strategy(large_json_data)
print(f"Detected {len(patterns)} patterns")
print(f"Expected savings: {strategy.expected_savings * 100:.1f}%")
print(f"Recommended level: {strategy.recommended_level}")
print(f"Reasoning: {strategy.reasoning}")Smart Optimization
from src.optimizer import SmartOptimizer
optimizer = SmartOptimizer()
# Automatic optimization with profile
result = optimizer.optimize(data, profile="balanced")
# Profiles: "speed", "balanced", "size"
print(f"Used profile: {result['profile_used']}")
print(f"Selected level: {result['level_selected']}")
print(f"Savings: {result['metrics']['savings_percent']:.1f}%")Batch Processing
from src.advanced_converter import AdvancedTOONConverter, CompressionLevel
converter = AdvancedTOONConverter(level=CompressionLevel.AGGRESSIVE)
# Process multiple items
items = [
{"id": i, "data": f"Item {i}"}
for i in range(1000)
]
for item in items:
toon = converter.json_to_toon(item)
# Process compressed data㪠MCP Tools Examples
In Claude Code
1. Convert with Custom Level
Use the convert_to_toon tool with:
- json_data: <your JSON>
- level: 3 (AGGRESSIVE)2. Analyze Patterns
Use the analyze_patterns tool to detect:
- Pattern types
- Compression potential
- Optimization recommendations3. Compare All Levels
Use the compare_levels tool to see:
- Side-by-side comparison
- Savings per level
- Best recommendation4. Smart Auto-Optimize
Use the smart_optimize tool with:
- json_data: <your JSON>
- profile: "size" (for maximum compression)π Format Specification
TOON v2.0 Structure
{
"_toon": "2.0", // Version identifier
"_lvl": 2, // Compression level used
"d": {...}, // Compressed data
"_refs": {...}, // Optional: structure references
"_dict": {...} // Optional: string dictionary
}Key Abbreviations (Sample)
Original | TOON | Original | TOON | Original | TOON |
id | i | eml | status | s | |
name | n | phone | ph | created_at | ca |
type | t | address | addr | updated_at | ua |
value | v | username | unm | timestamp | ts |
150+ abbreviations covering common API, database, and application fields.
Value Optimizations
nullβ~trueβT,falseβFTimestamps:
$ts:2025-01-01T00:00:00ZUUIDs:
$uid:550e8400-e29b-41d4-a716-446655440000String refs:
@s0,@s1(from dictionary)
Schema Compression
Before:
[
{"id": 1, "name": "Alice", "email": "alice@test.com"},
{"id": 2, "name": "Bob", "email": "bob@test.com"},
{"id": 3, "name": "Carol", "email": "carol@test.com"}
]After (TOON):
{
"_sch": ["i", "n", "eml"],
"_dat": [
[1, "Alice", "alice@test.com"],
[2, "Bob", "bob@test.com"],
[3, "Carol", "carol@test.com"]
]
}Savings: ~55-60% for arrays with consistent schemas
π§ͺ Testing
# Run all tests
pytest tests/ -v
# With coverage
pytest tests/ --cov=src --cov-report=html
# Specific test file
pytest tests/test_converter.py -v
# Run tests in Docker
docker-compose run json2toon-server pytest tests/ -vTest Coverage
β Converter: 100+ test cases covering all compression levels
β Pattern Analyzer: 30+ tests for all 17 pattern types
β Round-trip: Perfect data integrity verification
β Edge cases: Unicode, large numbers, special characters
β Performance: Benchmarks for all levels
π³ Docker Deployment
Build Image
docker build -t json2toon:2.0.0 .Run with Docker Compose
# Production mode
docker-compose up -d json2toon-server
# Development mode
docker-compose --profile dev up json2toon-devDocker Features
β Python 3.11 optimized image
β Non-root user for security
β Health checks
β Resource limits (2 CPU, 1GB RAM)
β Logging configuration
β Development mode with live reload
π Architecture
βββββββββββββββββββββββββββββββββββββββββββ
β JSON2TOON MCP Server β
β (v2.0) β
βββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββ ββββββββββββ ββββββββββββ
βAdvanced β βPattern β βSmart β
βConverterβ βAnalyzer β βOptimizer β
βββββββββββ ββββββββββββ ββββββββββββ
β β β
βββββββββββ΄βββββββββββββββ
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
ββββββββ ββββββββ ββββββββ
βSchemaβ βStringβ βValue β
βComp β β Dict β β Comp β
ββββββββ ββββββββ ββββββββπ― Pattern Types Detected
API Response - REST, GraphQL, JSON-RPC
Database Record - CRUD, audit logs, versioned
User Data - Profiles, auth, preferences
Pagination - Page-based, offset-based
Nested Address - Street, city, state, country
Nested Coordinates - Lat/lng/alt
Nested Dimensions - Width/height/depth
Nested Metadata - Created/updated by, tags
Homogeneous Array - Same-type elements
Consistent Schema Array - Similar object structures
Repeated Structure - Duplicate patterns
Time Series - Temporal data sequences
Graph Node - Network/graph structures
Tree Structure - Hierarchical data
Enum Values - Limited value sets
Sparse Array - Many null/empty values
Deep Nesting - Complex nested levels
π§ Development
Setup Development Environment
# Install dev dependencies
pip install -e ".[dev]"
# Format code
black src/ tests/
# Lint
ruff src/ tests/
# Type check
mypy src/Code Quality Tools
black: Code formatting (line length: 100)
ruff: Fast Python linter
mypy: Static type checking (strict mode)
pytest: Testing framework with async support
π Comparison with TOON v1.0
Feature | TOON v1.0 | JSON2TOON v2.0 |
Compression Levels | 2 | 4 |
Key Abbreviations | 68 | 150+ |
Pattern Types | 8 | 17+ |
MCP Tools | 6 | 12 |
Max Savings | 60% | 85% |
String Dictionary | β | β |
Value Compression | β | β |
Partial Schema | β | β |
zlib Support | β | β |
AI Analysis | Basic | Advanced |
Custom Abbreviations | β | β |
Savings Estimation | β | β |
π€ Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Run tests (
pytest tests/ -v)Format code (
black src/ tests/)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Open a Pull Request
π Use Cases
1. Large API Responses
Save 50-65% tokens when storing API responses in Claude conversations.
2. Database Query Results
Compress database results by 60-70% for efficient context usage.
3. Time Series Data
Achieve 65-75% compression on temporal datasets.
4. Configuration Files
Store configs in compact format with 40-55% savings.
5. Codebase Analysis
Fit more file contents in token limits when analyzing code.
6. Log Processing
Compress structured logs by 50-60% for pattern analysis.
π¦ Quick Tips
When to Use Each Level
MINIMAL: Quick conversions, need high speed
STANDARD: General purpose (best balance)
AGGRESSIVE: Large datasets, high savings needed
EXTREME: Maximum compression, archival use
Optimization Profiles
speed: Prefer MINIMAL/STANDARD levels
balanced: Auto-select based on data (recommended)
size: Prefer AGGRESSIVE/EXTREME levels
Best Practices
β Analyze patterns first with
analyze_patternsβ Use
smart_optimizefor automatic best resultsβ Validate with
validate_toonafter conversionβ Use
estimate_savingsbefore large batch jobsβ Monitor with
get_server_statsfor metrics
pip install -e .
python -m src.mcp_serverAvailable Tools
12 toolsanalyze_patternsC
Deep analysis of JSON patterns with AI-powered detection
Inputs: json_data (required), detailed.
batch_convertC
Batch convert multiple JSON objects
Inputs: json_array (required), level.
calculate_metricsC
Calculate detailed compression metrics and savings
Inputs: json_data (required), level.
compare_levelsC
Compare compression across all levels
Inputs: json_data (required).
convert_to_jsonB
Convert TOON format back to standard JSON
Inputs: toon_data (required).
convert_to_toonC
Convert JSON to TOON format with specified compression level
Inputs: json_data (required), level.
estimate_savingsC
Estimate compression savings without converting
Inputs: json_data (required).
get_optimal_strategyC
Get AI-recommended optimal compression strategy
Inputs: json_data (required).
get_server_statsC
Get comprehensive server statistics and performance metrics
Inputs: no named parameters.
smart_optimizeC
Automatically detect and apply optimal compression
Inputs: json_data (required), profile.
suggest_abbreviationsC
Generate custom key abbreviations for your data
Inputs: json_data (required), min_frequency.
validate_toonA
Validate TOON format and test round-trip conversion
Inputs: toon_data (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 12 tools
Tools have distinct purposes overall, but some analytical tools like 'analyze_patterns', 'get_optimal_strategy', and 'smart_optimize' could be confused; however, descriptions help differentiate them.
Most tools follow a verb_noun pattern with snake_case, but 'smart_optimize' and 'batch_convert' deviate slightly from the typical verb_noun structure, though they remain readable.
Twelve tools cover the domain wellβconversion, validation, analysis, optimization, batch processing, and metricsβwithout being excessive or sparse.
The tool set covers the full workflow: converting to/from TOON, validating, analyzing patterns, optimizing, estimating savings, and batch processing. No obvious gaps for the intended purpose.
Maintenance
Related MCP Connectors
Single-connection meta-router indexing 500+ MCP servers & A2A tools with 85% token compression and
Single-connection meta-router indexing 500+ MCP servers & A2A tools with 85% token compression an.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Free, no-key MCP server: token estimates, JSON Schema conversion, MCP configs, tool search.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA token-optimized MCP server for Notion that reduces context window usage by 73% while preserving full functionality, enabling AI assistants to interact with Notion efficiently.29 npm2MIT
- AlicenseNot gradedqualityDmaintenanceToken-optimized MCP server that reduces context window usage by 59.5% by grouping 12 tools into 5 semantic operations, preserving all original functionality for AI assistants.14 npm1MIT
- FlicenseNot gradedqualityDmaintenanceSelf-hosted MCP server with 83+ tools for AI workflows. Features 80%+ token reduction through 5 optimization layers.-
- AlicenseBqualityDmaintenanceLocal MCP server for token optimization, providing tools to compress code/JSON, optimize prompts, and manage placeholder-based content redaction and hydration to reduce LLM token usage.5ISC