Case study · No. 03
mcp-weight
A read-only CLI that finds the MCP servers your agents load and puts a token number on every tool schema - per tool, per server, per client, with provenance.
The problem
Every MCP server injects its tool names, descriptions, and JSON schemas into context on every turn - before a user types anything. The cost is invisible, compounds with each server, and is spread across client-specific config files. mcp-weight makes that cost visible without writing to any config.
Constraints
- Read-only: never write a client config, never print an environment or header value.
- Measure the real servers through a
tools/listhandshake, not by parsing docs. - Label the tokenizer as a proxy; do not claim provider-native precision.
- One broken or offline server is a row, never a failed scan.
- Support the configs developers actually use, including JSONC and TOML.
Decisions
- Discover, do not guess. The scan walks known client paths, the working directory, and explicit
--configpaths. - Probe the real handshake. Stdio and HTTP transports use the official MCP SDK with per-server timeouts; a failure stays attached to its row.
- Count with a labelled proxy.
cl100k_baseplus a chars/4 estimate makes servers comparable without pretending the number is provider-native. - Snapshot and diff.
scan --outanddiff --fail-overturn context growth into a CI gate. - Secrets stay out. Provenance includes the config path and transport, but never header or environment values.
Evidence
Published to npm; the registry reports over 1,000 downloads to date. In the sample report, 20 tools across four servers came to 2,910 tokens - 1.5% of a 200,000-token window - with one failed server reported as a row. CI runs on Ubuntu and Windows across Node 20 and 24.
Limits
The tokenizer is a proxy (cl100k_base plus chars/4), not a provider-native count; the README labels the roughly 15% gap. It measures exposure, not actual usage, and downloads measure reach rather than adoption. The package is still growing, and the roadmap is deliberately not linked from this record.