
Offline context-budget MCP server for AI coding agents.
Public tool metadata for what this MCP can expose to an agent.
measure_contextReturns the full JSON report for the current working directoryReturns the full JSON report for the current working directory
No parameter schema in public metadata yet.
context_budget_planReturns a deterministic ranked splice plan with safety classifications and preserve spansReturns a deterministic ranked splice plan with safety classifications and preserve spans
No parameter schema in public metadata yet.
context_budget_verifyReports missed edits and preserve-span violations after applying a planReports missed edits and preserve-span violations after applying a plan
No parameter schema in public metadata yet.
trim_to_budgetDeprecated alias for `context_budget_plan`; always returns `apply: false`Deprecated alias for `context_budget_plan`; always returns `apply: false`
No parameter schema in public metadata yet.
Sponsors
Offline token-budget linter for agent context files. It measures CLAUDE.md,
AGENTS.md, prompts/**, and .cursor/rules/**, finds references that no
longer resolve, and hands your agent a ranked, verifiable plan to get back
under budget.
No config, API key, network, or telemetry. Node >= 20. Two runtime
dependencies: fast-glob and gpt-tokenizer.
npx ctxcap --json
Context files get trimmed by agents badly: the agent rewrites the file from
memory, drops the ## Never rules, hits the budget, and ships a worse file.
ctxcap closes that loop with line ranges, safety flags, and verification.
npx ctxcap --plan --budget 40000 # ranked plan, JSON
npx ctxcap --plan --budget 40000 --apply # splice atomically
npx ctxcap --verify <planId> # catch drift and violations
Three rules for the agent:
startLine/endLine. Never rewrite a file from scratch.preserve.satisfiable is false, report minAchievable and stop.ctxcap-mcp