Dev.to AI 🤖 Ai 👁 0 📖 1 min read

mcp-tax 0.3: your MCP schemas are billed every turn, not once per session

Two readers argued with my billing model in the comments, and they were right. So mcp-tax 0.3 rebuilds it. The correction: schemas re-enter the window on every turn The old audit billed each server's tool sch

Two readers argued with my billing model in the comments, and they were right. So mcp-tax 0.3 rebuilds it.

The correction: schemas re-enter the window on every turn

The old audit billed each server's tool schemas once per session. That's wrong — the whole context, including every tool schema, is re-sent to the model on every API call. A 30k-token schema in a 20-turn session isn't a 30k tax; it's a 600k tax that also has to fit inside the window 20 times over.

The new ledger bills per turn. mcp-tax audit --turns 20 scales the session total, and the old once-per-session number is kept in the JSON output as old_model_session_tokens so you can see exactly how much it undercounted: it was the truth divided by your turn count. Thanks to MCPulse for pressing on this — schema cost isn't paid at tools/list time; it's paid every time the model is called. (And prompt caching only lowers the price, never the window occupancy: the ledger keeps billable_tokens and cumulative_window_tokens as separate columns for that reason.)

Per-server preamble split

Each server is now an independent billing line: its own preamble (tokens re-injected per turn), its own cumulative window tokens, its own billable tokens. The preamble is the unit you actually decide on — disable the most expensive one and watch the total move.

Per-page wire counter

tools/list pagination now reports wire bytes per page — a second, orthogonal dimension. Wire bytes are the transport cost of discovery, paid once per session; they are not context tax and never re-enter the window. A server can be wire-chatty (many small pages) yet schema-cheap, or the reverse. The audit shows both so you stop conflating them. Thanks to Rudratosh Shastri for the discussion that shaped this split.

pip install mcp-tax
mcp-tax audit --turns 20

34 tests green (25 unittest + 9 smoke), stdlib only, MIT.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.