
ctxcap
Offline context-budget MCP server for AI coding agents.
- GitHub stars
- 2
- tools
- 4
- transport
- STDIO
- last updated
- Nov 13, 2026
Tools
4 toolsPublic tool metadata for what this MCP can expose to an agent.
measure_contextReturns the full JSON report for the current working directory
Returns 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 spans
Returns 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 plan
Reports 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
Readme
ctxcap
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
The loop
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:
- Splice by
startLine/endLine. Never rewrite a file from scratch. - Never cut a span listed in
preserve. - If
satisfiableis false, reportminAchievableand stop.
Where plans live
Details
- Repository
- github.com/naeha-s/ctxcap
- Website
- github.com/Naeha-S/ctxcap
- Package
ctxcap-mcp- Transport
- STDIO
- Registry
- MCP registry, active