diff --git a/servers/toon-mcp/readme.md b/servers/toon-mcp/readme.md new file mode 100644 index 000000000..4c1cf8141 --- /dev/null +++ b/servers/toon-mcp/readme.md @@ -0,0 +1,113 @@ +# TOON - Token-Optimized Object Notation + +MCP server for reducing token consumption by up to 60% when working with JSON data in AI contexts. + +## Overview + +TOON (Token-Optimized Object Notation) is a compact representation format for JSON data that dramatically reduces token consumption in AI-assisted workflows. By using intelligent key abbreviations, schema compression, and pattern detection, TOON minimizes the tokens needed to represent structured data while maintaining full reversibility. + +Key benefits: +- **40-60% Token Reduction**: Significantly reduce API costs and context usage +- **Fully Reversible**: Convert back to original JSON with zero data loss +- **Pattern Detection**: Automatically identifies optimization opportunities +- **Batch Processing**: Efficiently handle arrays of similar objects +- **Zero Configuration**: Works out of the box with any JSON data + +## Tools + +### `convert_to_toon` +Convert JSON to TOON format for reduced token consumption. + +**Parameters:** +- `json_data` (string, required): JSON data to convert +- `aggressive` (boolean, optional): Enable aggressive compression (default: false) + +**Returns:** TOON formatted data with savings statistics + +### `convert_to_json` +Convert TOON format back to standard JSON. + +**Parameters:** +- `toon_data` (string, required): TOON data to convert + +**Returns:** Original JSON data + +### `analyze_patterns` +Detect compression patterns in JSON data. + +**Parameters:** +- `json_data` (string, required): JSON data to analyze + +**Returns:** Detected patterns and compression recommendations + +### `get_compression_strategy` +Get optimal compression settings for specific data. + +**Parameters:** +- `json_data` (string, required): JSON data to analyze + +**Returns:** Recommended strategy and expected savings percentage + +### `calculate_savings` +Estimate token savings without converting. + +**Parameters:** +- `json_data` (string, required): JSON data to analyze + +**Returns:** Estimated token reduction and savings percentage + +### `batch_convert` +Convert multiple JSON objects efficiently. + +**Parameters:** +- `json_array` (string, required): Array of JSON objects +- `aggressive` (boolean, optional): Enable aggressive compression + +**Returns:** Batch conversion results with total savings + +## How TOON Works + +### Key Abbreviations +Common JSON keys are shortened: +- `id` → `i` +- `name` → `n` +- `type` → `t` +- `status` → `s` + +### Schema Compression +Arrays of similar objects use schema-based encoding to eliminate redundancy. + +### Example + +**Original JSON (156 tokens):** +```json +{ + "id": 123, + "name": "John Doe", + "type": "user", + "status": "active", + "metadata": { + "created": "2024-01-01", + "updated": "2024-06-15" + } +} +``` + +**TOON Format (62 tokens):** +```json +{"_toon":"1.0","d":{"i":123,"n":"John Doe","t":"user","s":"active","m":{"c":"2024-01-01","u":"2024-06-15"}}} +``` + +**Savings: 60%** + +## Use Cases + +- **API Response Processing**: Compress large API responses before analysis +- **Context Window Optimization**: Fit more data in limited context windows +- **Cost Reduction**: Lower token usage = lower API costs +- **Batch Data Analysis**: Process large datasets efficiently + +## Links + +- [Source Repository](https://github.com/aj-geddes/toon-context-mcp) +- [Issue Tracker](https://github.com/aj-geddes/toon-context-mcp/issues) diff --git a/servers/toon-mcp/server.yaml b/servers/toon-mcp/server.yaml new file mode 100644 index 000000000..b6a9ec61b --- /dev/null +++ b/servers/toon-mcp/server.yaml @@ -0,0 +1,31 @@ +name: toon-mcp +image: mcp/toon-mcp +type: server + +meta: + category: ai + tags: + - token-optimization + - compression + - json + - context-management + - efficiency + - cost-reduction + +about: + title: TOON - Token-Optimized Object Notation + description: | + MCP server for TOON (Token-Optimized Object Notation) conversions. Reduces token + consumption by up to 60% when working with JSON data in AI contexts. + + TOON compresses JSON data using intelligent abbreviations, schema compression, + and pattern detection while maintaining full reversibility. Ideal for: + - Reducing API costs with large JSON payloads + - Maximizing context window utilization + - Optimizing AI-assisted data processing workflows + icon: https://avatars.githubusercontent.com/u/78109011 + +source: + project: https://github.com/aj-geddes/toon-context-mcp + commit: d7b8457a73d415ef202c117479c821215faa5a0c + directory: mcp-server-toon diff --git a/servers/toon-mcp/tools.json b/servers/toon-mcp/tools.json new file mode 100644 index 000000000..b30cbbaa1 --- /dev/null +++ b/servers/toon-mcp/tools.json @@ -0,0 +1,96 @@ +[ + { + "name": "convert_to_toon", + "description": "Convert JSON data to TOON (Token-Optimized Object Notation) format for reduced token consumption. Achieves 40-60% token reduction on typical JSON payloads.", + "inputSchema": { + "type": "object", + "properties": { + "json_data": { + "type": "string", + "description": "JSON data to convert (as string)" + }, + "aggressive": { + "type": "boolean", + "description": "Use aggressive compression for maximum token savings", + "default": false + } + }, + "required": ["json_data"] + } + }, + { + "name": "convert_to_json", + "description": "Convert TOON format back to standard JSON. Fully reversible conversion restores original data structure.", + "inputSchema": { + "type": "object", + "properties": { + "toon_data": { + "type": "string", + "description": "TOON formatted data to convert back to JSON" + } + }, + "required": ["toon_data"] + } + }, + { + "name": "analyze_patterns", + "description": "Analyze JSON data and detect patterns that can be optimized for compression. Returns detected patterns and compression recommendations.", + "inputSchema": { + "type": "object", + "properties": { + "json_data": { + "type": "string", + "description": "JSON data to analyze for compression patterns" + } + }, + "required": ["json_data"] + } + }, + { + "name": "get_compression_strategy", + "description": "Get the optimal compression strategy for JSON data based on its structure and patterns. Returns recommended settings and expected savings.", + "inputSchema": { + "type": "object", + "properties": { + "json_data": { + "type": "string", + "description": "JSON data to analyze for optimal compression strategy" + } + }, + "required": ["json_data"] + } + }, + { + "name": "calculate_savings", + "description": "Calculate potential token savings from TOON conversion without performing the actual conversion. Useful for estimating cost reduction.", + "inputSchema": { + "type": "object", + "properties": { + "json_data": { + "type": "string", + "description": "Original JSON data to calculate potential savings" + } + }, + "required": ["json_data"] + } + }, + { + "name": "batch_convert", + "description": "Convert multiple JSON objects to TOON format in a single operation. Efficient for processing arrays of similar objects.", + "inputSchema": { + "type": "object", + "properties": { + "json_array": { + "type": "string", + "description": "Array of JSON objects to convert (as string)" + }, + "aggressive": { + "type": "boolean", + "description": "Use aggressive compression for maximum savings", + "default": false + } + }, + "required": ["json_array"] + } + } +]