mcp-context-budget
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-context-budget
Your MCP servers eat the context window before you type anything. This tells you how much, and which one to drop.
Free, local, read-only. No account, no network call, no telemetry.
The problem this solves
Every MCP server you install injects its full tool schema into every request. There is no lazy loading in the protocol. A dozen servers can consume tens of thousands of tokens before your first message, and nothing in the client tells you this is happening — the agent just gets quietly worse.
Known incidents from public reports:
Cloudflare's standard MCP server consumed 1.17M tokens in production, prompting a dedicated workaround.
A practitioner measured 45K tokens for GitHub MCP alone — 22.5% of a 200K window.
A 12-server setup reported the system prompt at 18,000 tokens before the user typed.
This tool measures your actual setup instead of quoting those numbers at you.
Related MCP server: mcp-checkup
Why measurement, not estimation
The config file only records how to start a server. The real cost lives in the tools/list payload, which changes with the server version and its runtime flags. Guessing from the config produces a confident wrong answer.
So this tool starts each stdio server, asks it for its tools, measures the payload, and shuts it down. That is the only honest method, and it takes a few seconds.
Install
Requires Python 3.8+. No dependencies.
git clone <repo> mcp-context-budgetAdd to your MCP client config (claude_desktop_config.json, .cursor/mcp.json, or ~/.workbuddy/mcp.json):
{
"mcpServers": {
"mcp-context-budget": {
"command": "python",
"args": ["/absolute/path/to/mcp-context-budget/run.py"]
}
}
}Tools
audit_context_budget
Full report: cost per server, cost per tool, findings with quantified savings, and a fix order.
How much of my context window are my MCP servers eating?Optional arguments: window (200k default, or 128k/32k/16k), config (explicit path), show_tools (list the N most expensive tools per server).
rank_servers_by_cost
Just the ranking. Answers "which server should I remove first" in one line per server.
explain_token_cost
Measure an arbitrary schema or string before you publish a server of your own. Reports the CJK/ASCII split and shows how wrong the naive len/4 heuristic would be.
What it detects
Finding | What it means |
| One tool costs ≥2.5% of the window on its own |
| The same sentence appears in 4+ tool descriptions |
| An enum is spelled out in prose and declared in the schema |
| 4+ tools with identical parameter shapes, differing only by verb |
| A parameter description that only repeats the field name |
Each finding carries an estimated token saving, so you can decide whether it is worth the edit.
What it does not do
Does not edit anything. It never writes to your configs and never removes a server.
Does not measure remote servers. URL-based (SSE / streamable HTTP) servers are listed as not probed rather than silently scored zero. Their cost is real but cannot be measured locally.
Does not prove a bad agent is caused by schema cost. It quantifies one specific tax. If your schemas are 2% of the window, the cause is elsewhere and the report says so.
Estimates, not exact tokenizer output. No tokenizer dependency, by design — that would triple install size and pin you to one model family. The estimator is calibrated to over-count slightly, because under-counting a budget is the failure that hurts.
Reading the verdict
Verdict | Share of window |
| under 5% |
| 5–10% |
| 10–20% |
| over 20% |
Ten percent is the line where trimming is worth the afternoon. Twenty percent is where the agent is measurably worse than it was before you installed things.
Self-verification
Do not take the claims on faith:
python tests/selftest.py28 checks, both directions: pathological schemas must be caught, and clean well-written servers must produce zero findings. The negative tests are the important half — a tool that cries wolf gets ignored, which is worse than no tool.
License
MIT.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Statically audits MCP tool surfaces for token cost, schema quality, and design issues.
Grade MCP tool definitions for agent-readiness: score, A-F grade, fixes, est. token cost.
Free, no-key MCP server: token estimates, JSON Schema conversion, MCP configs, tool search.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceProvides tool to count token cost of any MCP server's tool definitions, enabling agents to assess cost before enabling.MIT
- AlicenseNot gradedqualityDmaintenanceDiagnoses MCP server token costs, finds duplicates, grades efficiency, and generates optimization reports.65 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables analyzing and optimizing context window token usage by measuring, compressing, and eliminating waste from MCP tool definitions.63 npmMIT
- AlicenseAqualityCmaintenanceMCP server that scores tool descriptions, estimates token costs, simulates agent tool selection, and generates reliability reports to help AI agents choose the right tools and reduce wasted tokens.58 npmMIT