mcp-token-optimizer

v0.1.1
io.github.rccola990-cloud/mcp-token-optimizer Checked 4 days ago Published 5 months ago

Cut LLM token costs: count tokens, estimate cost, slim prompts, and pick the cheapest capable model.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

count_tokens

Count the tokens in a piece of text and show the input cost across common LLM models (or one model if specified). Use before sending a prompt to know its size and price.

ParameterTypeDescription
text *stringThe text/prompt to measure.
modelstringOptional model id (e.g. gpt-4o, claude-sonnet-4). Omit to compare across common models.

estimate_cost

Estimate the per-call and monthly cost of a prompt for a given model, including assumed completion tokens and call volume. Use to forecast LLM spend.

ParameterTypeDescription
text *stringThe input prompt.
completion_tokensnumberAssumed output tokens per call (default 0).
modelstringModel id (default gpt-4o).
monthly_callsnumberCalls per month, to project monthly/yearly spend (default 0).

slim_prompt

Compress a prompt with safe, meaning-preserving rules (shorten verbose phrases, drop filler, dedupe lines, normalize whitespace) and report tokens and dollars saved. Use to cut token costs without an LLM call.

ParameterTypeDescription
text *stringThe prompt to slim down.
modelstringModel id used to price the savings (default gpt-4o).
monthly_callsnumberCalls per month, to project monthly savings (default 0).

compare_model_costs

Compare the per-call cost of a prompt across many models and recommend the cheapest. Use to route work to the cheapest capable model.

ParameterTypeDescription
text *stringThe input prompt.
completion_tokensnumberAssumed output tokens per call (default 0).
modelsarrayOptional subset of model ids to compare. Omit for all known models.