Skip to main content

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

MCP Registry PyPI version

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:

  1. Optimizing Code Context: Stripping comments and redundant spacing from code files while preserving functional structure and docstrings.
  2. Data Format Conversion: Converting JSON, XML, YAML, and CSV inputs into the compact TOON format to save tokens.
  3. 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

  1. Open Cursor Settings -> MCP.
  2. Click "+ Add New MCP Server".
  3. Name: toon-parse-mcp
  4. Type: command
  5. Command: python -m src.server (Ensure your environment is active or use absolute path to python)

Windsurf

  1. Click the hammer icon in the Cascade toolbar and select "Configure".
  2. Alternatively, edit ~/.codeium/windsurf/mcp_config.json directly.
  3. Add the following to the mcpServers object:
{
  "mcpServers": {
    "toon-parse-mcp": {
      "command": "python",
      "args": ["-m", "src.server"]
    }
  }
}

Antigravity

  1. Open the MCP store via the "..." menu at the top right of the agent panel.
  2. Select "Manage MCP Servers" -> "View raw config".
  3. Alternatively, edit ~/.gemini/antigravity/mcp_config.json directly.
  4. Add the following to the mcpServers object:
{
  "mcpServers": {
    "toon-parse-mcp": {
      "command": "python",
      "args": ["-m", "src.server"]
    }
  }
}

Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "toon-parse-mcp": {
      "command": "python",
      "args": ["-m", "src.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:

  1. Install test dependencies:
    pip install -e ".[test]"
    
  2. Run tests:
    pytest tests/
    

Requirements

  • Python >= 3.10
  • mcp >= 1.25.0
  • toon-parse >= 2.4.1

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toon_parse_mcp-1.0.2b0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toon_parse_mcp-1.0.2b0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file toon_parse_mcp-1.0.2b0.tar.gz.

File metadata

  • Download URL: toon_parse_mcp-1.0.2b0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for toon_parse_mcp-1.0.2b0.tar.gz
Algorithm Hash digest
SHA256 36635c88e74b2395729e41828d75363339a8403beeb57dd2e36f84d3c91ae6c4
MD5 8e9244d08613fadde4cca569c1c5db2e
BLAKE2b-256 1a961595c5c84dc450340bd9697dd9888e56165dc3cabbc33185f6ad3394eb54

See more details on using hashes here.

File details

Details for the file toon_parse_mcp-1.0.2b0-py3-none-any.whl.

File metadata

File hashes

Hashes for toon_parse_mcp-1.0.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3ac496f63f29155f16e9c4bf2075540861807ec2a0443cd38883147bccfc06
MD5 9c96b5026f7cd86326447fcb031028ec
BLAKE2b-256 1623de8f9a64cd0e8ff3108c4fe6697c2b08c6f594f64cb99f454626f6ab67cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page