home / mcp / toon mcp server

Toon MCP Server

Provides JSON ↔ TOON conversion, system prompt wrapping, and an MCP stdio server for token‑efficient data handling with LLMs.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hasnainali47-toon-mcp-server": {
      "command": "toon-mcp-server",
      "args": [],
      "env": {
        "TOON_MCP_SERVER_ENV": "PLACEHOLDER"
      }
    }
  }
}

You run a compact, token‑efficient MCP server that exposes TOON data conversion and system prompt handling as easy-to-use tools. This server lets editors and orchestrators convert between JSON and TOON, wrap system prompts, and access these capabilities over stdio through a simple MCP interface.

How to use

You launch the MCP stdio server and connect via an MCP host or compatible tool. The server exposes three tools you can call from your host: convert_json_to_toon, convert_toon_to_json, and convert_system_prompt_to_toon. Use these to convert between JSON objects and TOON strings, and to wrap your system prompts in a compact TOON structure for token efficiency.

How to install

Prerequisites: Python and pip must be installed on your system.

Install the package from PyPI and install the console script that runs the MCP stdio server.

pip install toon-mcp-server

For local development in your workspace, install in editable mode so you can modify the source as needed.

cd path/to/this/repo
pip install -e .

Run the MCP stdio server to start accepting calls from your MCP host.

toon-mcp-server

Additional notes

The server runs over stdio and exposes three tools: convert_json_to_toon, convert_toon_to_json, and convert_system_prompt_to_toon. You can invoke these through an MCP host or orchestration layer that supports stdio servers.

When you configure an MCP host, you typically reference the stdio server by its command and arguments. If you have a host that supports JSON or TOON payloads, point it to the toon-mcp-server process and feed it the appropriate tool invocations.

Example usage patterns

Convert a JSON payload to TOON text to send to an LLM.

Convert a TOON string back to a Python object for further processing or for serialisation to JSON.

Wrap a long system prompt in a compact TOON document to keep prompts structured and token‑efficient.

Available tools

json_to_toon

Convert a JSON‑serialisable Python object into a TOON string.

toon_to_json

Parse a TOON string back into a Python object.

system_prompt_to_toon

Wrap a plain system prompt in a minimal TOON document for token efficiency.