← 返回 Skills 市场
abhinas90

MCP Token Auditor

作者 abhinas90 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
41
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install mcp-token-audit
功能描述
Analyze your MCP server config to estimate token consumption per tool. Identify which tools are blowing up your context window, get per-role groupings to kee...
使用说明 (SKILL.md)

MCP Token Auditor

Stop your subagents from silently failing due to tool schema bloat.

If you have 20+ MCP servers, your tool schemas alone can hit 209k tokens — exceeding Claude's context window before your subagent even starts working. The subagent dies. Silently. Zero error in the UI.

This tool audits your MCP config and gives you an exact breakdown.

What it does

  1. Reads your mcp.json (or any MCP config)
  2. Estimates token consumption per tool based on schema complexity
  3. Groups tools into logical roles (code-analysis, deployment, testing, data, communication, file-system)
  4. Calculates total token footprint vs your target limit
  5. Outputs per-role groupings you can copy directly into role-specific MCP configs

Quick start

# Basic audit
python3 mcp-token-audit.py --config ~/.claude/mcp.json

# With custom token target (default: 60,000)
python3 mcp-token-audit.py --max-tokens 50000

# JSON output for scripting
python3 mcp-token-audit.py --json

Example output

═══════════════════════════════════════════
  MCP TOKEN AUDIT REPORT
═══════════════════════════════════════════
  Config: ~/.claude/mcp.json
  Servers: 34
  Total tools: 566
  Total estimated tokens: 209,412
  Target limit: 60,000
  Utilization: 349.0%

───────────────────────────────────────────
  PER-ROLE BREAKDOWN
───────────────────────────────────────────
  communication      42,891 tokens  █████████████████████
  deployment         38,221 tokens  ███████████████████
  code-analysis      35,120 tokens  █████████████████
  data               28,450 tokens  ██████████████
  testing            24,310 tokens  ████████████
  general            40,420 tokens  ████████████████████

  🔴 Total tool schema tokens exceed target by 149,412 tokens
     Fix: Split MCP servers into per-role configs

───────────────────────────────────────────
  SUGGESTED ROLE GROUPINGS
───────────────────────────────────────────
  communication (mcp-communication.json) — 42,891 tokens ✅
  deployment (mcp-deployment.json) — 38,221 tokens ✅
  code-analysis (mcp-code-analysis.json) — 35,120 tokens ✅
  ...

Why this matters

The #1 silent failure mode in multi-agent Claude Code setups isn't model quality. It's tool schema bloat. When your subagent's context window is 60% full before it even processes your prompt, you get: silent hangs, partial completions, and "prompt too long" errors with no diagnostic.

This tool catches the problem before your subagent crashes.

Prerequisites

  • Python 3.8+
  • An MCP config file (works with any MCP-compatible format)
  • No API keys required — runs entirely locally

Files

  • scripts/mcp-token-audit.py — Main audit script
  • SKILL.md — This file
安全使用建议
Reasonable to install if you want local MCP token-footprint reporting. Run it only on MCP config files you intend to inspect, and treat saved reports as potentially sensitive because they can disclose your MCP server and tool layout.
能力评估
Purpose & Capability
The skill says it reads an MCP config, estimates per-tool schema token usage, groups tools by role, and reports optimization suggestions; the Python script implements that local analysis.
Instruction Scope
Runtime instructions are explicit CLI examples with a disclosed default config path and optional output path; no prompt override, hidden role change, or automatic high-impact action was found.
Install Mechanism
The artifact contains SKILL.md and one Python script with no declared dependencies, install hooks, package-manager scripts, or startup behavior.
Credentials
Reading ~/.claude/mcp.json or a user-specified MCP config is proportionate, but generated reports can reveal local MCP server and tool names.
Persistence & Privilege
No network access, subprocess execution, privilege escalation, background worker, credential use, or persistence was found; the only write behavior is saving a report when the user supplies --output.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install mcp-token-audit
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /mcp-token-audit 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Analyze MCP config token consumption, get per-role groupings to prevent subagent context window failures
元数据
Slug mcp-token-audit
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

MCP Token Auditor 是什么?

Analyze your MCP server config to estimate token consumption per tool. Identify which tools are blowing up your context window, get per-role groupings to kee... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 MCP Token Auditor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install mcp-token-audit」即可一键安装,无需额外配置。

MCP Token Auditor 是免费的吗?

是的,MCP Token Auditor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

MCP Token Auditor 支持哪些平台?

MCP Token Auditor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 MCP Token Auditor?

由 abhinas90(@abhinas90)开发并维护,当前版本 v1.0.0。

💬 留言讨论