Token optimization MCP server that reduces LLM context by stripping code comments and converting data formats to TOON
Project description
toon-parse MCP Server
mcp-name: io.github.ankitpal181/toon-parse-mcp
A specialized Model Context Protocol (MCP) server that optimizes token usage by converting data to TOON (Token-Oriented Object Notation) and stripping non-essential context from code files.
Overview
The toon-parse-mcp MCP server helps AI agents (like Cursor, Claude Desktop, etc.) operate more efficiently by:
- Optimizing Code Context: Stripping comments and redundant spacing from code files while preserving functional structure and docstrings.
- Data Format Conversion: Converting JSON, XML, YAML, and CSV inputs into the compact TOON format to save tokens.
- Mandatory Efficiency Protocol: A built-in resource that instructs LLMs to prioritize token-saving tools.
Features
Tools
optimize_input_context(raw_input: str): Processes raw text data (JSON/XML/CSV/YAML) and returns optimized TOON format.read_and_optimize_file(file_path: str): Reads a local code file and returns a token-optimized version (no inline comments, minimized whitespace).
Resources
protocol://mandatory-efficiency: Provides a strict system instruction prompt for LLMs to ensure they use the optimization tools correctly.
Installation
pip install toon-parse-mcp
Configuration
Cursor
- Open Cursor Settings -> MCP.
- Click "+ Add New MCP Server".
- Name:
toon-parse-mcp - Type:
command - Command:
python3 -m toon_parse_mcp.server(Ensure your environment is active or use absolute path to python)
Windsurf
- Click the hammer icon in the Cascade toolbar and select "Configure".
- Alternatively, edit
~/.codeium/windsurf/mcp_config.jsondirectly. - Add the following to the
mcpServersobject:
{
"mcpServers": {
"toon-parse-mcp": {
"command": "python3",
"args": ["-m", "toon_parse_mcp.server"]
}
}
}
Antigravity
- Open the MCP store via the "..." menu at the top right of the agent panel.
- Select "Manage MCP Servers" -> "View raw config".
- Alternatively, edit
~/.gemini/antigravity/mcp_config.jsondirectly. - Add the following to the
mcpServersobject:
{
"mcpServers": {
"toon-parse-mcp": {
"command": "python3",
"args": ["-m", "toon_parse_mcp.server"]
}
}
}
Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"toon-parse-mcp": {
"command": "python3",
"args": ["-m", "toon_parse_mcp.server"]
}
}
}
Usage
When the server is active, the AI will have access to the optimize_input_context and read_and_optimize_file tools. You can also refer to the efficiency protocol by asking the AI to "check the mandatory efficiency protocol".
Testing
To run the test suite:
- Install test dependencies:
pip install -e ".[test]"
- Run tests:
pytest tests/
Requirements
- Python >= 3.10
mcp>= 1.25.0toon-parse>= 2.4.1
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toon_parse_mcp-1.0.3b0.tar.gz.
File metadata
- Download URL: toon_parse_mcp-1.0.3b0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c55863f842f51b0d18e9450f3bb7646ee4ff72e4e01891975c314666df1014c9
|
|
| MD5 |
4db62454a5044a19975b88bf9fdcf02b
|
|
| BLAKE2b-256 |
a32b9f1bbf2c6770c619ee56d13b02a741c34848936308dbdad8adb6efc2ac19
|
File details
Details for the file toon_parse_mcp-1.0.3b0-py3-none-any.whl.
File metadata
- Download URL: toon_parse_mcp-1.0.3b0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c08285d79b1de2af9af4381d3bbe77153dc3a870d3935dda9efb74e95dabdf65
|
|
| MD5 |
3912597d78f8faed561c230a8cc02f94
|
|
| BLAKE2b-256 |
ca026e2f18679b1e6980183b31eafec0255ac2e7b61231b108d9353abd0dafa4
|