Kalen PattersonAI systems engineer

Case study · No. 03

mcp-weight

LiveTypeScript · MCP · Node

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

Decisions

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.

mcp-weight scan pipeline mcp-weight discovers client configs, probes the configured MCP servers with tools/list, counts tool schema tokens with a labelled proxy, and emits a report or a snapshot diff gate. The scan is read-only and failures remain per-row. Configssix MCP clientsJSONC · TOML Discoveryknown pathsexplicit --config ProbeMCP SDKtools/list · timeout Accountingcl100k proxychars/4 Reporttokensdiff gate Read-only · secrets redacted · partial results stay per-row One broken server is a row, not a failed scan.
Five stages: discover the configs, probe the real servers, count the tool schemas, then emit a report or a snapshot diff. Nothing is written back to a client config. The diagram pans on narrow screens.

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.