Serveur MCP TokenZero
Commit 5 nov. 2026Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
Aussi connu sous tokenzero-ai/tokenzero
- Étoiles
- 0
- Outils
- —
- Téléchargements, 30 jours
- —
- Dernière version
- 0.2.2
- Dernier commit
- 5 nov. 2026
- Licence
- Apache-2.0
Qu'est-ce que TokenZero MCP ?
TokenZero est un serveur MCP. Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
Résumé généré à partir du README du projet
À propos du MCP server TokenZero
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.
Ce que vous pouvez faire avec
- 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.
Extrait du README du projet. Chaque cas d'utilisation est vérifié par rapport à une citation du document.
Comment installer TokenZero MCP
Formats vérifiés le 10 nov. 2026Ajouter à CursorAjouter à GooseInstaller TokenZero MCP dans Claude Code
$ claude mcp add --transport http tokenzero https://tokenzero.sh/mcpInstaller TokenZero MCP dans Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp"
}
}
}Installer TokenZero MCP dans VS Code
.vscode/mcp.json
{
"servers": {
"tokenzero": {
"type": "http",
"url": "https://tokenzero.sh/mcp"
}
}
}Installer TokenZero MCP dans VS Code CLI
$ code --add-mcp '{"name":"tokenzero","type":"http","url":"https://tokenzero.sh/mcp"}'Installer TokenZero MCP dans Codex
$ codex mcp add tokenzero --url https://tokenzero.sh/mcpInstaller TokenZero MCP dans Codex config.toml
~/.codex/config.toml
[mcp_servers.tokenzero] url = "https://tokenzero.sh/mcp"
Installer TokenZero MCP dans Gemini CLI
$ gemini mcp add -s user --transport http tokenzero https://tokenzero.sh/mcpInstaller TokenZero MCP dans Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp",
"type": "http"
}
}
}Vérifications automatisées
Exécuté le 15 nov. 2026Rapport complet →Pas encore vérifié. Un serveur nécessite un score de 80, aucune faille sérieuse et suffisamment de données pour que nous puissions effectuer les vérifications. Fonctionnement des vérifications · Ce qu'il faut corriger pour gagner des points
- Dépôt source lié et accessibletokenzero-ai/tokenzero is public and reachablegithub.com/tokenzero-ai/tokenzero ↗Réussi
- Le nom du package correspond au dépôt sourceNon vérifié
- Provenance du build (attestation Sigstore)Non vérifié
- Licence open source (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Réussi
- Commit ou version publiée au cours de l'année écouléeLast commit or release 2026-11-05github.com/tokenzero-ai/tokenzero ↗Réussi
- OpenSSF ScorecardNon vérifié
- Nom du package non proche d'un package populaireNon vérifié
- Aucun avis critique dans le package ou ses dépendancesNon vérifié
- Aucune instruction cachée destinée au modèle0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersRéussi
- Les outils destructifs sont étiquetésNon vérifié
- Le point de terminaison distant répond à la poignée de main MCPinitialize answered with protocol 2025-06-18 in 289 msRéussi
README
Voir sur GitHubTokenZero 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
Questions sur TokenZero MCP
Comment ajouter TokenZero MCP à Claude Code ?
Exécutez claude mcp add --transport http tokenzero https://tokenzero.sh/mcp dans votre terminal. Ajoutez --scope user pour le rendre disponible dans tous les projets.
Comment ajouter TokenZero MCP à Cursor ?
Ouvrez ~/.cursor/mcp.json et ajoutez le serveur sous mcpServers, avec la configuration Cursor indiquée dans la section d'installation ci-dessus.
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.