Urgent.News

What's breaking now, across thousands of outlets.

AI

Real Token Cost of MCP: 91K Tokens of JSON

255 MCP tools. 91,000 tokens of JSON schemas. Before you ask a single question. Here's what I found and how I fixed it. The experiment I connected Claude Code to 5 MCP servers. File system, GitHub, Postgres, Puppeteer, and a custom search tool. Then I counted every token that flowed through the system. The numbers: Phase Token Count What it is Tool discovery (initial) 91,247 JSON schemas for 255…

The article discusses the significant cost of JSON schema tokens when using MCP tools with Claude Code. Testing with 5 MCP servers resulted in a total of 91,000 JSON token tokens, mainly driven by repeated schema injections and tool definitions. The wrapped result structure further adds to the overhead, with every result wrapped in JSON braces and brackets.

This excessive token usage can be costly, especially for developers who use MCP tools frequently, potentially leading to daily costs of $7.80 to $15.00 and monthly costs of $156 to $300. To address this issue, the author developed mcptoon, a CLI tool that caches tool schemas, compresses results, and uses TOON format (Token-Optimized Object Notation) to reduce token usage by 97%.

Real-world results show a significant savings in tokens, with the mcptoon tool reducing the total token count in a conversation by approximately 71%.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

More from Saturday 22 August →