tokens-saver-mcp
Works with OpenAI-compatible APIs to route low-risk text processing tasks to budget models, saving costs on GPT usage.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tokens-saver-mcp Summarize this paragraph into one sentence."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tokens-saver-mcp
A provider-agnostic MCP (Model Context Protocol) server that routes 7 narrow text-processing tools to budget models — local or cloud — to reduce main model token consumption.
Core idea: offload low-risk, structured, short-output sub-tasks (classification, extraction, summarization, rewriting, small code generation) to cheaper models, keeping complex reasoning and high-risk changes on Claude/GPT.
Tools
Tool | Purpose |
| Classify text into a given label set |
| Extract structured fields from long text |
| Compress long text to a short summary |
| Rewrite text in a different style (or translate zh↔en) |
| Generate small code snippets / function-level patches |
| Compress a git diff into a structured change summary |
| Extract actionable tasks from unstructured text |
All tools return both human-readable content and machine-consumable structuredContent.
Related MCP server: ai-workers-mcp
Requirements
Node.js >= 20
A running provider (local model or cloud API with OpenAI-compatible endpoint)
Setup
npm install
npm run buildCreate ~/.tokens-saver-mcp/settings.json to configure providers (see below).
If the file does not exist, the server falls back to a built-in default pointing at http://127.0.0.1:1234 with zai-org/glm-4.7-flash.
Configuration
~/.tokens-saver-mcp/settings.json
{
"defaultProvider": "remote_budget_cn",
"providers": {
"local": {
"type": "openai_compatible",
"baseUrl": "http://127.0.0.1:11434/v1",
"apiKeyEnv": "",
"model": "qwen2.5:14b",
"timeoutMs": 15000,
"maxRetries": 1,
"temperature": 0.1
},
"remote_budget_cn": {
"type": "openai_compatible",
"baseUrl": "https://api.minimax.chat/compatible-mode/v1",
"apiKeyEnv": "MINIMAX_API_KEY",
"model": "MiniMax-M2.7",
"timeoutMs": 20000,
"maxRetries": 2,
"temperature": 0.2
}
},
"toolRouting": {
"tsm_classify": "local",
"tsm_extract_json": "remote_budget_cn",
"tsm_summarize": "remote_budget_cn",
"tsm_rewrite": "remote_budget_cn",
"tsm_codegen_small_patch": "remote_budget_cn",
"tsm_diff_digest": "remote_budget_cn",
"tsm_task_extract": "local"
}
}Key rules:
API keys are never stored in the config file. Set
apiKeyEnvto the environment variable name that holds the key.For local providers with no auth, set
apiKeyEnvto"".toolRoutingis optional — unrouted tools fall back todefaultProvider.
Usage
# Run as MCP server (stdio transport)
npm startClaude Code integration
{
"mcpServers": {
"tokens-saver": {
"command": "node",
"args": ["/path/to/tokens-saver-mcp/dist/server.js"]
}
}
}Development
npm test # Run 61 tests
npm run typecheck # Type check only
npm run build # Compile TypeScriptAvailable Tools
7 toolstsm_classifyA
Classify text into one of the provided labels using a budget model. Returns label, confidence score, and a brief reason. Useful for intent classification, routing decisions, and tagging.
Inputs: text (required), labels (required), instructions.
tsm_codegen_small_patchA
Generate small code snippets or function-level patches using a budget model. Scoped to single functions, regex, SQL, scripts, or unit test samples. NOT for multi-file or architectural designs.
Inputs: task (required), language, constraints, existing_code.
tsm_diff_digestA
Compress a git diff into a structured summary of changed areas, behavior changes, risks, and a one-paragraph overview. Helps the main model quickly understand large diffs.
Inputs: diff_text (required), focus.
tsm_extract_jsonA
Extract structured fields from long text according to a schema description. Returns a JSON object with extracted data and a list of missing fields. Useful for parsing documents, issues, logs.
Inputs: text (required), extraction_goal (required), schema_description (required).
tsm_rewriteA
Rewrite text in a different style (concise, formal, technical, friendly, or translate between Chinese and English) without changing the core facts.
Inputs: text (required), style (required), constraints.
tsm_summarizeB
Compress long text into a concise summary with bullet points and risk flags. Useful for compressing long conversations, logs, documents, or diff context before passing to the main model.
Inputs: text (required), summary_style (required), max_points.
tsm_task_extractB
Extract an actionable task list from unstructured text (meeting notes, daily reports, requirements). Returns tasks with optional owner, due date, status, and notes.
Inputs: text (required), task_granularity (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a distinct, non-overlapping purpose: classification, code patch generation, diff summarization, JSON extraction, rewriting, text summarization, and task extraction. No ambiguity between tools.
All tools use the 'tsm_' prefix and snake_case. Most follow a verb_noun pattern (classify, summarize, rewrite), though 'tsm_codegen_small_patch' is slightly less consistent with its compound noun. Overall, naming is clear and predictable.
With 7 tools, the server is well-scoped for a utility focused on token-saving and text processing. Each tool addresses a common need without being excessive or insufficient.
The tool set covers major text operations: classification, extraction, transformation, and summarization. Minor gaps exist (e.g., no data masking or bulk processing), but the core functionality for offloading to budget models is complete.
Maintenance
Related MCP Connectors
Route each agent task to the few tools it needs (BM25 shortlist). Free tier; x402 or credits.
Deterministic AI agent microtools, no accounts/API keys. fetch_extract: 98% token cut. 47 tools.
Cost-optimized LLM model routing recommendations for autonomous AI agents
36 SEC, WCAG and entity-diligence tools behind 2 low-context ones: discover_tools, call_tool.
Related MCP Servers
- AlicenseAqualityDmaintenanceOptimizes token costs by intelligently delegating low-complexity tasks to local LLMs via LiteLLM, enabling cost-effective development workflows.31MIT
- FlicenseAqualityDmaintenanceRoutes commodity NLP tasks like summarization and translation to free-tier LLMs, saving Claude tokens for complex work.12-
- AlicenseAqualityCmaintenanceEvaluates task suitability for local models before cloud API calls, routing to Ollama or similar to reduce costs.170 npmMIT
- AlicenseBqualityDmaintenanceDelegates heavy, repetitive, and verifiable tasks like PDF extraction, code analysis, and log processing to a local LLM to reduce token consumption for frontier AI models, while keeping decision-making with the main AI.8MIT