TokenZero MCP server
Commit 5. Nov. 2026Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
Auch bekannt als tokenzero-ai/tokenzero
- Stars
- 0
- Tools
- —
- Downloads, 30 Tage
- —
- Neueste Version
- 0.2.2
- Letzter Commit
- 5. Nov. 2026
- Lizenz
- Apache-2.0
Was ist TokenZero MCP?
TokenZero ist ein MCP server. Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
Zusammenfassung generiert aus dem README des Projekts
Über TokenZero MCP server
TokenZero provides a suite of tools designed to help developers identify and reduce unnecessary LLM expenditures. The MCP server version allows coding agents like Claude Code, Cursor, Windsurf, and Cline to perform local audits of an open project. It identifies token waste by analyzing code through static heuristics rather than monitoring live traffic. This process helps developers find opportunities for cost savings through model arbitrage and prompt optimization.
Users can run specific tools such as audit_repo_token_waste and calculate_model_arbitrage entirely on their own machines. The optimize_prompt_payload tool is different because it sends the provided request body to the TokenZero service at tokenzero.sh. The system detects specific patterns like LLM calls inside loops, large static prompts lacking caching directives, and the use of frontier models for simple extraction tasks. It also flags unpriced or retired model IDs to ensure budget accuracy.
Was du damit machen kannst
- 1Identify local token wasteAsk your AI agent to scan the current repository to find where LLM spending can be reduced.
- 2Find cheaper model alternativesRequest a comparison of different pricing models to see if a cheaper model can handle a specific task.
- 3Optimize prompts for cachingProvide a request body to the server to make it more compatible with prompt caching mechanisms.
- 4Prevent cost regressions in CISet up a gate in your continuous integration pipeline to fail if recoverable waste exceeds a certain percentage.
Geschrieben aus dem README des Projekts. Jeder Use Case wurde gegen ein Zitat daraus geprüft.
So installierst du TokenZero MCP
Formate geprüft am 10. Nov. 2026Zu Cursor hinzufügenZu Goose hinzufügenTokenZero MCP in Claude Code installieren
$ claude mcp add --transport http tokenzero https://tokenzero.sh/mcpTokenZero MCP in Cursor installieren
~/.cursor/mcp.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp"
}
}
}TokenZero MCP in VS Code installieren
.vscode/mcp.json
{
"servers": {
"tokenzero": {
"type": "http",
"url": "https://tokenzero.sh/mcp"
}
}
}TokenZero MCP in VS Code CLI installieren
$ code --add-mcp '{"name":"tokenzero","type":"http","url":"https://tokenzero.sh/mcp"}'TokenZero MCP in Codex installieren
$ codex mcp add tokenzero --url https://tokenzero.sh/mcpTokenZero MCP in Codex config.toml installieren
~/.codex/config.toml
[mcp_servers.tokenzero] url = "https://tokenzero.sh/mcp"
TokenZero MCP in Gemini CLI installieren
$ gemini mcp add -s user --transport http tokenzero https://tokenzero.sh/mcpTokenZero MCP in Gemini settings.json installieren
~/.gemini/settings.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp",
"type": "http"
}
}
}Automatisierte Checks
Geluften am 15. Nov. 2026Vollständiger Bericht →Noch nicht verifiziert. Ein Server benötigt einen Score von 80, keine kritischen Befunde und genug Daten für unsere Prüfung. Wie die Checks funktionieren · Was du für mehr Punkte verbessern kannst
- Source Repository verknüpft und erreichbartokenzero-ai/tokenzero is public and reachablegithub.com/tokenzero-ai/tokenzero ↗Bestanden
- Paket nennt dieses Repository als QuelleNicht geprüft
- Build-Provenienz (Sigstore-Attestierung)Nicht geprüft
- Open Source Lizenz (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Bestanden
- Commit oder Release im letzten JahrLast commit or release 2026-11-05github.com/tokenzero-ai/tokenzero ↗Bestanden
- OpenSSF ScorecardNicht geprüft
- Package-Name ähnelt keinem populären PackageNicht geprüft
- Keine kritischen Advisories im Paket oder seinen AbhängigkeitenNicht geprüft
- Keine versteckten Anweisungen an das Modell0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersBestanden
- Destruktive Tools sind markiertNicht geprüft
- Remote-Endpoint beantwortet den MCP-Handshakeinitialize answered with protocol 2025-06-18 in 289 msBestanden
README
Auf GitHub ansehenTokenZero tools
Open-source tools from TokenZero, the independent ledger of record for AI spend (metering, attribution, budget control, audit).
-
The receipt verifier (
verifier/tokenzero-verify.mjs) checks a TokenZero receipt without trusting TokenZero: Ed25519 signature over canonical JSON, the savings-bucket math and the hash chain. Zero dependencies; library or CLI. The format is specified indocs/receipt-spec.md. -
@tokenzero/mcpis a stdio MCP server for Claude Code, Cursor, Windsurf and Cline: audit the open project for token waste (locally), price model alternatives, make request bodies cache-friendly. -
@tokenzero/cliconnects a project to the ledger (through the gateway sensor) with no code changes, audits LLM token waste locally, shows usage and verifies signed savings receipts. -
The analyzer (
src/audit-core.ts) is the static token-waste audit used by the CLI, the hosted repo audit and the PR cost-diff check. It runs entirely on your machine. -
The pricing table (
src/pricing.ts) lists the list prices every estimate is computed from, versioned and dated.
Audit a project
npx -y @tokenzero/cli audit # local, nothing is uploaded
npx -y @tokenzero/cli audit --json
npx -y @tokenzero/cli audit --fail-over 30 # CI gate: exit 1 above 30% recoverable
git diff origin/main | npx -y @tokenzero/cli audit --diff - --format markdown
Audits are static heuristics: they read code, not traffic. Numbers are estimates at list prices; verified savings come from the gateway's signed ledger once requests flow through it.
What it looks for:
- large static prompts sent without caching directives (Anthropic
cache_control, OpenAI prefix stability) - prompt templates defined away from their call sites with no caching anywhere
- frontier models on prompts that read like extraction or classification
- LLM calls inside loops (Batch API or shared-prefix caching candidates)
- unpriced or retired model ids
Library and SDK repositories are detected and their findings downgraded, since their call sites pass through whatever the caller chooses.
Check every pull request (GitHub Action)
# .github/workflows/tokenzero.yml
name: TokenZero cost check
on: pull_request
permissions: { contents: read, pull-requests: write }
jobs:
cost-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: tokenzero-ai/tokenzero/action@v0
One comment per PR, updated on every push; nothing leaves the runner. See action/README.md for inputs and outputs.
Use it from a coding agent (MCP)
claude mcp add tokenzero -- npx -y @tokenzero/mcp # Claude Code
{ "mcpServers": { "tokenzero": { "command": "npx", "args": ["-y", "@tokenzero/mcp"] } } }
audit_repo_token_waste and calculate_model_arbitrage run entirely on your machine. optimize_prompt_payload sends the request body you give it to the TokenZero service (https://tokenzero.sh unless TOKENZERO_URL is set), so do not put secrets in it.
Connect a project to the gateway
npx -y @tokenzero/cli init
init audits locally, creates a workspace, and (with your consent) adds OPENAI_BASE_URL / ANTHROPIC_BASE_URL to .env. Your provider keys pass through untouched and are never stored.
Authentication: send the workspace key as the X-TokenZero-Key header (recommended). For zero-code setups the CLI can also embed it in the base URL (/w/<key>/v1); treat such URLs as secrets and use tokenzero rotate-key if one leaks.
Develop
npm install
npm run build # bundles cli/bin/tokenzero.mjs (single file, no runtime deps)
npm test
License: Apache-2.0 · support@tokenzero.sh
TokenZero MCP Fragen
Wie füge ich TokenZero MCP zu Claude Code hinzu?
Führe claude mcp add --transport http tokenzero https://tokenzero.sh/mcp in deinem Terminal aus. Füge --scope user hinzu, damit der Server in jedem Projekt verfügbar ist.
Wie füge ich TokenZero MCP zu Cursor hinzu?
Öffne ~/.cursor/mcp.json und füge den Server unter mcpServers hinzu, mit der Cursor-Config aus dem Installationsabschnitt oben.
Does the MCP server send my secrets to a remote service?
The optimize_prompt_payload tool sends request bodies to the TokenZero service, so you should avoid including secrets in those bodies.
Can I use this in my CI/CD pipeline?
Yes, you can use a GitHub Action to check pull requests for cost changes.
Are the audit numbers exact?
The numbers provided are estimates based on list prices; actual verified savings are provided by the gateway's signed ledger.