Skip to content

feat(mcp): budget the tools MCP servers put in front of the model - #110

Merged
singhharsh1708 merged 1 commit into
mainfrom
feat/mcp-tool-budget
Aug 9, 2026
Merged

singhharsh1708 merged 1 commit into
mainfrom
feat/mcp-tool-budget

Conversation

@singhharsh1708

Copy link
Copy Markdown
Owner

The hole this closes

MCP was the largest standing-context line item Kitbash did not measure — the one place where "we measure token cost" had an undefended hole.

A skill body is statically countable, which is why context.budget can be enforced at compile time. An MCP server's real cost is not: it's the JSON schema of every tool the server exposes, and knowing that means asking the server — which for stdio means executing it. That's exactly what the install gate exists to prevent. So Kitbash does not connect, and does not print an estimate it cannot derive.

What it does count

Every tool in a declared allowlist is a tool definition the agent carries for the whole session, so the allowlist is an exact floor:

ℹ MCP tool budget: 8 tool(s) across 2 server(s); cap 100. Real token cost is
  unmeasured — it needs the server's tool schemas, and reading those means running it.

Reported on every compile and by doctor.

A server declaring tools = ["*"] has no countable bound, so the total renders as 8+ (1 server(s) declare "*") and warns that it cannot be bounded — rather than folding into a total that would be wrong.

Enforcement

max_mcp_tools in [policy] caps the declared total. A breach warns and fails --strict.

The default is 100 — the only primary-source numeric limit found across the clients (Windsurf documents it as a hard cap past which tools are dropped).

The widely-repeated Cursor "40 tool" limit is deliberately not encoded: it appears only in forum posts and third-party blogs, never in Cursor's own docs. A tool whose pitch is measurement must not ship a folklore number.

9 new tests; suite, typecheck, site --check and bench gate all green. Ships as 0.20.0.

MCP was the largest standing-context line item kitbash did not measure — the
one place where "we measure token cost" had an undefended hole.

A skill body is statically countable, which is why context.budget can be
enforced. An MCP server's real cost is not: it is the JSON schema of every
tool the server exposes, and knowing that means asking the server — which for
stdio means executing it. That is what the install gate exists to prevent, so
kitbash does not connect, and does not print an estimate it cannot derive.

What it counts exactly is what the manifest already states. Every tool in a
declared allowlist is a tool definition carried for the whole session, so the
allowlist is an exact floor. compile and doctor now report it, and say plainly
that the token cost is unmeasured and why.

A server declaring tools = ["*"] has no countable bound, so the total renders
as "8+ (1 server(s) declare "*")" with a warning that it cannot be bounded,
rather than folding into a total that would be wrong.

max_mcp_tools in [policy] caps the declared total; a breach warns and fails
--strict. The default is 100 — the only primary-source numeric limit across
the clients (Windsurf documents it as a hard cap past which tools are
dropped). The widely repeated Cursor "40 tool" limit is deliberately not
encoded: it appears only in forum posts and blogs, never in Cursor's docs,
and a tool whose pitch is measurement must not ship a folklore number.

Adds 9 tests. 0.20.0.
@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kitbash Ready Ready Preview Aug 9, 2026 8:25pm

@github-actions github-actions Bot added documentation Docs, spec, RFCs, README, site dependencies Dependency or action version bumps labels Aug 9, 2026
@singhharsh1708
singhharsh1708 merged commit 886a0da into main Aug 9, 2026
10 checks passed
@singhharsh1708
singhharsh1708 deleted the feat/mcp-tool-budget branch August 9, 2026 20:27

This branch was successfully deployed

1 active deployment
Preview — 7aad443d Deployed Aug 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency or action version bumps documentation Docs, spec, RFCs, README, site

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant