← 返回
未分类 中文

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...
分析你的MCP服务器配置,估算每个工具的token消耗。识别哪些工具正在耗尽你的上下文窗口,获取按角色分组的数据以保持...
abhinas90
未分类 clawhub v1.0.0 1 版本 99516.9 Key: 无需
★ 0
Stars
📥 206
下载
💾 0
安装
1
版本
#claude-code#developer-tools#latest#mcp#subagent#token-optimization

概述

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

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-26 18:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

RAG Pipeline Starter

abhinas90
为大型数据集(5万-50万行)配置并优化RAG流水线,包括文档分块、嵌入基准测试、向量索引和检索调优。
★ 0 📥 462

Claude Code Mastery

abhinas90
Claude Code CLI精通指南——从安装到生产工作流
★ 0 📥 351

Multi-Agent Deployment Skill for OpenClaw

abhinas90
在OpenClaw中部署可投入生产的多智能体集群,包含逐步设置指南、工作空间模板以及用于智能体创建的Python自动化脚本。
★ 1 📥 412