开发者生态
morning
Show HN:Mcptoon – MCP CLI 客户端,可将工具发现令牌减少 97%
摘要
MCP tool discovery costs 10,000+ tokens. mcptoon costs 350. One MCP client for every AI agent. Cross-platform. Zero dependencies. If this saves you tokens, please star the repo — it helps others disco...
tokens
mcptoon
MCP
000
type
for
agent
JSON
discovery
client
2026-08-11
1 阅读
约10分钟阅读
mcptokensaver
字号:
MCP 工具发现需要 10,000 多个代币。 mcptoon 费用为 350。每个 AI 代理一个 MCP 客户端。跨平台。零依赖。如果这可以为您节省代币,请为该存储库加注星标——这可以帮助其他人发现它。英语 | 中文文档 |报告错误 |请求功能 每个启用 MCP 的对话都会在语法上消耗令牌,而不是数据:您的代理连接到 5 个 MCP 服务器。列出他们的工具:约 10,000 个 JSON 标记。您的代理调用了 20 个工具。每个返回 500-3,000 个包含在 {"content":[{"type":"text","text":"..."}]} 中的令牌。 MCP 总开销:在进行任何实际思考之前需要 40,000-70,000 个代币。在 128K 上下文窗口中,30-55% 消失了。不在工作中。关于语法。 mcptoon 是一个 CLI 客户端,可连接到任何 MCP 服务器(stdio 或 HTTP)并输出 TOON(令牌优化对象表示法)而不是 JSON。操作 JSON 令牌 mcptoon 令牌 节省 工具发现(96 个工具) ~2,000 ~60 97% 工具结果(结构化数据) ~800 ~350 56% 工具结果(原始 HTML/文本) ~1,000 ~900 10% 零依赖性。纯Python。 50KB。适用于所有 AI 代理 — Claude Code、Codex、OpenCode、Cursor、CatPaw 以及任何运行 shell 命令的东西。 JSON(287 个令牌) — 其他 MCP 客户端返回的内容:[ { "name" : " search_web " , "description" : " 在网络上搜索信息 " , "inputSchema" : { "type" : " object " , "properties" : { "query" : { "type" : " string " , "description" : " 搜索查询 " }, "num_results" : { "type" : " number " , "default" : 5 }}, "required" : [ " query " ]}}, { "name" : " fetch_url " , "description" : " 从 URL 获取内容 " , "inputSchema" : { "type" : " object " , "properties" : { "url" : { "type" : " string " }}, "required" : [ " url " ]}} ] TOON (5 个令牌) — mcptoon 的回报:工具发现减少 98%,完整模式减少 60%,信息丢失为零。零依赖。 50KB。 Python 3.10+。 Windows、macOS、Linux。 mcptoon init # 示例配置:~/.mcptoon/config.json mcptoon add fetch --stdio npx -y @modelcontextprotocol/server-fetch mcptoon manifest --toon # -> fetch:fetch mcptoon call fetch fetch ' {"url":"https://example.com"} ' --toon mcptoon call fetch fetch ' {"url":"https://example.com"} ' --json # 当你需要 JSON JSON TOON 为什么 {"name":"search","count":3} name:search|count:3 管道替换大括号 + 引号 + 冒号 [1, 2, 3] 1 2 3 空格替换括号 + 逗号 true / false T / F 1 char vs 4-5 null ∅ 1 symbol vs 4 chars "line1\nline2" line1↲line2 ↲ 替换转义序列{"a":{"b":[1,2]}} a:b:1_2 递归压缩标记 您得到的内容 令牌足迹 --toon 紧凑表示法,完整语义比 JSON 少 40-60% --compact 仅工具名称,以空格分隔比 JSON 少 97% --json 标准 JSON(用于脚本、CI) 基线 --raw 原始响应,无解析 全尺寸 --head N 仅前 N 个项目 变量 --max-chars N 硬截断at N 字符变量 --full 禁用默认的 4000 字符截断完整大小设置 MCPTOON_AGENT_TYPE=claude 且每次调用都会自动选择 --toon 。 mcptoon mcp-cli mcporter 原始 MCP SDK 令牌节省 97% 清单,40-60% 结果 0% 0% 0% 适用于所有代理 是(Claude Code、Codex、OpenCode、Cursor、任何) 仅 Claude 仅 Claude 有所不同 所有代理的一种配置 是 no no no 输出格式 TOON + JSON + 紧凑 JSON JSON JSON 依赖项 0 5-20 npm 3-8 危险操作阻止 是 否 否 使用情况跟踪 是(本地) 否 否 架构缓存 是(5 分钟) 否 否 安装大小 ~50KB ~50MB+ ~30MB ~10MB 平台支持 Windows、macOS、Linux Linux/macOS macOS 不同 mcptoon 是一个 CLI 工具。如果您的代理可以运行 shell 命令,则它可以使用 mcptoon。代理 如何使用 Claude Code 在 SKILL.md 文件中写入 mcptoon 命令 Codex (OpenAI) 将 mcptoon 添加到 AGENTS.md OpenCode 在自定义命令中使用 mcptoon Cursor 将 mcptoon 添加到 .cursorrules CatPaw 在技能文件中写入 mcptoon 命令 任何代理 如果运行 shell 命令,则可以调用 mcptoon 在 ~/.mcptoon/config.json 中配置一次 MCP 服务器。每个代理共享相同的服务器、相同的工具、相同的代币节省。 export MCPTOON_AGENT_TYPE=claude # 自动选择 --toon # 在 ~ /.claude/skills/mcp-tools/SKILL.md 中搜索网络: mcptoon call exa search '{"query":"AI news"}' 列出可用工具: mcptoon manifest --toon 获取 URL: mcptoon call fetch fetch '{"url":" https://example.com"} ' # In AGENTS.md 或系统提示符 使用 mcptoon 调用 MCP 工具。与 JSON 相比,它节省了 60% 的令牌。 - 列出工具: mcptoon m
这篇文章对您有帮助吗?
订阅66必读
每日精选科技资讯,直达你的邮箱