feat(readme): publish the context-window cost as a badge, guarded by CI - #126
Closed
VickyXAI wants to merge 1 commit into
Closed
feat(readme): publish the context-window cost as a badge, guarded by CI#126VickyXAI wants to merge 1 commit into
VickyXAI wants to merge 1 commit into
Conversation
Package managers have shown install size for decades. Installing an MCP server
spends the user's context on every turn — whether or not the tools are ever
called — and almost nothing shows that number. This publishes ours.
- README hero badge: 12.9K context tokens, plus a per-profile table at the
point where a reader is already choosing a profile. `--profile trading` is
57% less context than the default for the same trading workflow, which was
already true and already shipped, but nowhere stated.
- scripts/measure-tool-schema.mjs: the harness, committed rather than left in
a scratch directory. Runs against this repo's server or, with `-- <cmd>`,
any stdio MCP server, so the claim is checkable by anyone against anyone.
`npm run measure:schema`.
- test/schema-tokens.test.ts: the guard. Measures the live server in-process
and fails if the README disagrees. Asserts the PUBLISHED form ("12.9K") and
the table's exact per-profile totals — pinning raw counts would fail CI on
every wording tweak, while pinning the published figure fails exactly when
the claim becomes wrong. Verified by deliberately corrupting both the badge
and a table row and confirming each fails.
The projection counted is {name, description, input_schema} per tool with the
host prefix, matching what lands in the API tools array. Numbers agree to the
token across four independent implementations: this script, an earlier Python
harness, a third-party rewrite, and the in-process test.
Stacked on #125 — the 12,900 figure assumes the $schema header is gone. Merge
that first; without it every number here is 300 higher.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUL3ExR4Nz7uebxKaKwjDi
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A package manager has shown you install size for thirty years. Installing an MCP server spends your context window on every turn, whether or not you call the tools — and essentially no server tells you how much. There is no norm because nobody established one.
The precedent worth copying is bundlephobia: it did not win by adding a badge, it won by defining a metric and shipping the tool that measures it, after which bundle size became a competitive axis for everyone. Same move here.
What ships
A badge and a table. The hero gets
🧮 12.9K Context Tokens, and the profile section — where a reader is already choosing — gets what each profile costs:full(default)tradingmediaresearchchat--profile tradingis 57% less context than the default for the same workflow. That was already true and already shipped; it was just never stated anywhere a user would see it.The harness, committed.
scripts/measure-tool-schema.mjs(npm run measure:schema) runs against this server or, with-- <cmd>, any stdio MCP server. The claim is checkable by anyone, against anyone — which is the part that makes it a standard rather than marketing.A guard.
test/schema-tokens.test.tsmeasures the live server in-process and fails when the README disagrees. It asserts the published form (12.9K) and the table's exact totals: pinning raw counts would fail CI on every wording tweak, while pinning the published figure fails precisely when the claim stops being true. Verified by deliberately corrupting the badge and a table row and confirming each fails.Honesty, stated in the README rather than omitted
{name, description, input_schema}+ host prefix); excludesannotations/_meta/outputSchema, a further ~3.7% on the wire.o200k_baseis a proxy — Claude's tokenizer is not public and runs higher on JSON, so every figure is a slight under-count, never an over-count.Verification
sync-brand-numbers --checkall clean.Follow-up, not in this PR
Promoting
mcp.contextTokensintobrand-numbers.jsonneeds a matching change in blockrun'ssrc/app/brand/numbers.json/route.tsfirst — adding the key here alone would be dropped on the next--refreshand break markers. Kept out deliberately.🤖 Generated with Claude Code
https://claude.ai/code/session_01WUL3ExR4Nz7uebxKaKwjDi