JSON to TOON MCP Server

JSON to TOON MCP Server

Converts JSON data to TOON (Token-Oriented Object Notation) format and back, reducing token usage by 30-60% for more efficient LLM applications.

Category
访问服务器

README

JSON to TOON MCP Server

A Model Context Protocol (MCP) server that provides tools for converting JSON data to TOON (Token-Oriented Object Notation) format. TOON is a token-efficient format designed specifically for LLM applications, reducing token usage by 30-60% compared to JSON.

Features

  • JSON to TOON Conversion: Convert JSON data to TOON format with customizable options
  • TOON to JSON Conversion: Convert TOON format back to JSON
  • Token Savings Analysis: Analyze potential token savings before conversion
  • MCP Protocol Support: Full MCP server implementation for integration with LLM applications

Quick Start

1. Install the Package

npm install -g json-to-toon-mcp-server

2. Configure Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "json-to-toon": {
      "command": "npx",
      "args": ["json-to-toon-mcp-server"]
    }
  }
}

3. Restart Claude Desktop

Restart Claude Desktop and the MCP server will be available.

Installation

npm install

Usage

Running the Server

npm start

The server runs on stdio and can be connected to any MCP client.

Available Tools

1. convert_json_to_toon

Converts JSON data to TOON format.

Parameters:

  • json_data (string, required): JSON data to convert
  • options (object, optional): Conversion options
    • delimiter (string): Delimiter for tabular arrays (default: ",")
    • indentation (string): Indentation string (default: " ")
    • show_length_markers (boolean): Show length markers [N] for arrays (default: true)

Example:

{
  "json_data": "{\"users\": [{\"id\": 1, \"name\": \"Alice\"}]}",
  "options": {
    "delimiter": ",",
    "show_length_markers": true
  }
}

2. convert_toon_to_json

Converts TOON format back to JSON.

Parameters:

  • toon_data (string, required): TOON data to convert

Example:

{
  "toon_data": "users[1]{id,name}:\n  1,Alice"
}

3. analyze_token_savings

Analyzes potential token savings when converting JSON to TOON.

Parameters:

  • json_data (string, required): JSON data to analyze

Example:

{
  "json_data": "{\"users\": [{\"id\": 1, \"name\": \"Alice\"}]}}"
}

Example Conversions

JSON to TOON

JSON Input:

{
  "users": [
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "user" }
  ]
}

TOON Output:

users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,user

Token Savings

The TOON format typically reduces token usage by 30-60% compared to JSON, making it ideal for LLM applications where token efficiency is important.

Development

Running Tests

npm test

Development Mode

npm run dev

Integration with MCP Clients

This server can be integrated with any MCP-compatible client. The server communicates via stdio, making it suitable for integration with various LLM applications and development tools.

Manual Configuration for Claude Desktop

To add this MCP server to Claude Desktop manually, add the following configuration to your claude_desktop_config.json file.

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

To add this MCP server to Claude Desktop manually, add the following configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "json-to-toon": {
      "command": "npx",
      "args": ["json-to-toon-mcp-server"],
      "env": {}
    }
  }
}

Alternative configuration using local installation:

{
  "mcpServers": {
    "json-to-toon": {
      "command": "node",
      "args": ["/path/to/json-to-toon-mcp-server/index.js"],
      "env": {}
    }
  }
}

Configuration for development (from source):

{
  "mcpServers": {
    "json-to-toon": {
      "command": "node",
      "args": ["index.js"],
      "cwd": "/path/to/json-to-toon-mcp-server"
    }
  }
}

Configuration Notes

  • Replace /path/to/json-to-toon-mcp-server with the actual path to your installation
  • The npx method requires the package to be installed globally (npm install -g json-to-toon-mcp-server)
  • The server communicates via stdio, so no additional network configuration is needed
  • After adding the configuration, restart Claude Desktop for changes to take effect

TOON Format Benefits

  • Token Efficient: 30-60% fewer tokens than JSON
  • LLM-Friendly: Structured format that's easy for LLMs to parse
  • Lossless: Full bidirectional conversion between JSON and TOON
  • Human Readable: Maintains readability while being compact
  • Schema Aware: Explicit structure declarations help with validation

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选