
Promptbudget Mcp
io.github.MukundaKattaPublished by GitHub account MukundaKattav0.2.0Updated Oct 24, 2026
Token-budget-aware text handling: count, truncate, and chunk for LLM prompts.
Overview
Local MCP server that counts, truncates and chunks text to fit an LLM token budget before it goes into a prompt.
- What you can do
- Count estimated tokens in text, optionally against a max_tokens limit, returning whether it fits and how much it overflows.
- Trim text to a token budget using head, tail, head_tail or smart_cut strategies.
- Split long text into multiple under-budget chunks with optional overlap for RAG ingestion.
- When to use it
- Useful when an assistant is assembling context, fitting chat history into a model window, or feeding long source documents through a prompt and needs a pre-flight size check or a split.
- Requirements
- Runs as a local stdio process, typically launched with npx from the npm package @mukundakatta/promptbudget-mcp; needs Node.js and an MCP client such as Claude Desktop, Cursor, Cline, Windsurf or Zed. No accounts, keys or environment variables are declared.
Installation
In SourceWeft
- Open Promptbudget Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
@mukundakatta/promptbudget-mcp
MCP server for token-budget-aware text handling. Three tools: count, truncate, chunk. Use when an LLM is preparing context, fitting chat history, or feeding long source documents through a prompt.
Tools
Strategies for truncate
Real workflows
"Does this fit in my prompt?"
If fits: true, send as-is. If fits: false, decide between truncate_to_token_budget (lose info) or chunk_to_budget (multiple LLM calls).
"Make this fit, keep the latest"
"Ingest this 50k-token doc into my RAG"
The overlap_tokens value lets sentences at chunk boundaries still have surrounding context in the next chunk — important for RAG retrieval quality.
Token counting accuracy
The default chars_per_token = 4 is the OpenAI rule of thumb. It's accurate within ~10–15% for English. For accurate accounting against a specific model, plug in your real tokenizer's chars-per-token ratio:
For non-English text, divide further (Chinese is ~1 char/token, code is ~3 chars/token).
Install — Claude Desktop
Same shape for Cursor / Cline / Windsurf / Zed.
Run directly (no MCP client)
The server speaks MCP over stdio. Pair with mcptools or your client of choice. If nothing prints to the terminal, that is correct: stdio servers wait silently for an MCP client to connect.
Sibling library
The Rust crate promptbudget implements the same logic in pure Rust, in case you'd rather link the algorithm into a non-MCP context.
Changelog
- 0.2.0 (2026-05-10) — added
count_tokens(pre-flight check) andchunk_to_budget(split-with-overlap). README expanded with workflow examples + tokenizer ratio table. - 0.1.1 (2026-05-09) — added
mcpNamefield for MCP Registry compatibility. - 0.1.0 (2026-05-09) — initial release with
truncate_to_token_budget.
License
MIT OR Apache-2.0.
Source: packages/promptbudget-mcp/README.md at commit 6fad5bb
Tools
0Version history
1- v0.2.0LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts