mcp-context-audit
Use when considering adding an MCP server, when context feels bloated with tool definitions, when auditing which MCP servers consume the most context window budget, or before committing a change to mcp_config.json. Estimates per-server tool-definition token cost and flags bloat.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- mcp-context-audit
- triggers
- [ "user", "model" ]
- description
- Use when considering adding an MCP server, when context feels bloated with tool definitions, when auditing which MCP servers consume the most context window budget, or before committing a change to mcp_config.json. Estimates per-server tool-definition token cost and flags bloat.
02 资源文件 1
- 脚本scripts/mcp-context-audit.py9.6 KB
03 SKILL.md 正文
MCP Context Audit
Why
Every MCP server injects all its tool definitions into the system prompt of every conversation. Two "plug-and-play" servers can consume a third of a 200k window before the first user message. This is the fastest way to bloat context and trigger lost-in-the-middle. Audit before adding; keep only what earns its tokens.
Rule of thumb: tool count per server under 10-15 keeps tool-selection accuracy above 90% (arXiv:2606.30317). Above that, the model picks the wrong tool more often than not.
When to Use
- About to add an MCP server to
mcp_config.json. - Context feels bloated and MCP tool definitions are suspected.
- Periodic hygiene review of configured servers.
- A server exposes many tools and you want to know the token cost.
When NOT to Use
- No MCP servers configured - nothing to audit.
- You already know the cost and have decided to keep the server.
Audit by tool
Measure the cost of each tool definition, not just the server total. If a server exposes many tools but the task uses only a few, prefer a narrower server or disable the unused tools if the server supports scoping.
Workflow
Step 1: List configured servers
exec: python3 "{{APPDATA}}/devin/skills/mcp-context-audit/scripts/mcp-context-audit.py" --config mcp_config.json
Reads mcp_config.json and reports each server's transport, command/url, and
a static bloat risk (based on config complexity). No tool calls made.
Step 2: Measure real tool counts
The script cannot call MCP tools itself. You (the agent) list tools per server and feed the result to the script for token estimation:
mcp_list_tools server_name="atlassian"
Capture the tool list, then pipe it to the estimator:
exec: python3 "{{APPDATA}}/devin/skills/mcp-context-audit/scripts/mcp-context-audit.py" --tools - < tools_atlassian.json
Or pass a file:
exec: python3 "{{APPDATA}}/devin/skills/mcp-context-audit/scripts/mcp-context-audit.py" --tools tools_atlassian.json
The script estimates token cost of the tool definitions (chars/4 heuristic) and flags servers over the 10-15 tool threshold.
Step 3: Decide
| Signal | Action |
|---|---|
| Server unused in N sessions | Remove from mcp_config.json |
| Tool count > 15 | Prefer a narrower server, or scope tools if the server supports it |
| Token cost > 5% of window | Justify with concrete usage; else remove |
| Untrusted server | Review code/permissions first; run in sandbox |
Step 4: Verify after removal
Re-run Step 1 to confirm the server is gone and the budget dropped.
Anti-Patterns
- Adding servers "just in case." Permanent context tax for speculative use.
- Auditing once and never again. Servers grow tools over time; re-audit.
- Trusting tool count alone. A 5-tool server with huge descriptions can cost more than a 15-tool server with terse ones. Check token cost.
- Skipping the trust review. MCP servers run with user permissions; evaluate the 5 architecture patterns / 4 anti-patterns before adding.
Source
- Tool-count accuracy threshold: arXiv:2606.30317 (<10-15 tools/server for
90% selection accuracy).
- MCP architecture patterns / anti-patterns: trust checklist above.
Cross-skills
- After auditing, invoke
mcp-lazy-enablementto decide which servers to keep active or disable. - Context bloat from MCP: "Context Windows Explained for Coding Agents" (Matt Pocock) - MCP servers can consume a third of the window before the first message.
If the user asks about a specific MCP server's current tool list, security posture, or configuration, invoke research before auditing.
04 同仓库更多 Skills
montador-de-ideias
Use when assembling, expanding, or elevating a raw project idea or initial prompt into an ultra-detailed, first-principles dossier and compiled master prompt with journalistic OSINT market research, Tech Lead and Staff Architect justifications, atomic and modular hardening/optimization, and high-impact contact surfaces.
git-github-adaptive-engineering
Use when any task touches git history, GitHub issues/PRs/releases/CI, repo governance, or branch and merge decisions. Runs the Fase Zero situational-awareness battery, picks one of five delivery flows via the adaptive decision engine, and enforces commit/PR information-density standards. Orchestrates the gh, git-workflows, github-actions, pr, and debug/finish skills.
adaptive-agenda-calendar-routine-engine
Use when planning or executing work across hours, days, weeks, or sprints. Turns the calendar into a strict time-blocked agenda (HH:MM-HH:MM blocks carrying a routine profile, expected inputs, and a handoff output artifact), runs the 5-stage cognitive flow (Radar and Hunt -> Triage plus Steve Jobs conception -> workbench manifest -> >=32-cycle loop -> Close plus Open-Minded Scrum), and unfolds macro calendar milestones into micro agenda blocks through extensions/gcal/wrapper.py.
demo
Use when demonstrating a skill in a fixture project.
duplicate-skill
Use when testing duplicate skill name detection.
duplicate-skill
Use when testing duplicate skill name detection.