TokenZero MCP server
Commit 5 Nov 2026Audit proyek untuk mendeteksi pemborosan token LLM, mencari alternatif model harga yang lebih murah, dan optimasi prompt payload untuk caching.
Juga dikenal sebagai tokenzero-ai/tokenzero
- Stars
- 0
- Tools
- —
- Unduhan, 30 hari
- —
- Versi terbaru
- 0.2.2
- Commit terakhir
- 5 Nov 2026
- Lisensi
- Apache-2.0
Apa itu TokenZero MCP?
TokenZero adalah MCP server. Audit proyek untuk mendeteksi pemborosan token LLM, mencari alternatif model harga yang lebih murah, dan optimasi prompt payload untuk caching.
Ringkasan dibuat dari README proyek
Tentang TokenZero MCP server
TokenZero menyediakan rangkaian tool yang dirancang untuk membantu developer mengidentifikasi dan mengurangi pengeluaran LLM yang tidak perlu. Versi MCP server memungkinkan coding agent seperti Claude Code, Cursor, Windsurf, dan Cline untuk melakukan audit lokal pada sebuah proyek open source. Sistem ini mengidentifikasi pemborosan token dengan menganalisis kode melalui heuristik statis, bukan dengan memantau traffic secara live. Proses ini membantu developer menemukan peluang penghematan biaya melalui model arbitrage dan optimasi prompt.
User dapat menjalankan tool spesifik seperti audit_repo_token_waste dan calculate_model_arbitrage sepenuhnya di mesin mereka sendiri. Tool optimize_prompt_payload berbeda karena ia mengirimkan request body yang diberikan ke layanan TokenZero di tokenzero.sh. Sistem ini mendeteksi pola tertentu seperti pemanggilan LLM di dalam loop, prompt statis berukuran besar yang tidak memiliki direktif caching, serta penggunaan frontier models untuk tugas ekstraksi sederhana. Sistem ini juga menandai model ID yang tidak memiliki harga atau sudah pensiun untuk memastikan akurasi budget.
Apa yang bisa Anda lakukan dengannya
- 1Identifikasi pemborosan token lokalMinta AI agent Anda untuk memindai repositori saat ini guna menemukan di mana pengeluaran LLM dapat dikurangi.
- 2Temukan alternatif model yang lebih murahMinta perbandingan berbagai model pricing untuk melihat apakah model yang lebih murah dapat menangani tugas tertentu.
- 3Optimasi prompt untuk cachingBerikan request body ke server agar lebih kompatibel dengan mekanisme prompt caching.
- 4Cegah kenaikan biaya di CISiapkan gate pada pipeline continuous integration Anda agar gagal jika pemborosan yang dapat dipulihkan melebihi persentase tertentu.
Ditulis berdasarkan README proyek. Setiap use case diperiksa terhadap kutipan dari README tersebut.
Cara menginstal TokenZero MCP
Format diverifikasi 10 Nov 2026Tambahkan ke CursorTambahkan ke GooseInstal TokenZero MCP di Claude Code
$ claude mcp add --transport http tokenzero https://tokenzero.sh/mcpInstal TokenZero MCP di Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp"
}
}
}Instal TokenZero MCP di VS Code
.vscode/mcp.json
{
"servers": {
"tokenzero": {
"type": "http",
"url": "https://tokenzero.sh/mcp"
}
}
}Instal TokenZero MCP di VS Code CLI
$ code --add-mcp '{"name":"tokenzero","type":"http","url":"https://tokenzero.sh/mcp"}'Instal TokenZero MCP di Codex
$ codex mcp add tokenzero --url https://tokenzero.sh/mcpInstal TokenZero MCP di Codex config.toml
~/.codex/config.toml
[mcp_servers.tokenzero] url = "https://tokenzero.sh/mcp"
Instal TokenZero MCP di Gemini CLI
$ gemini mcp add -s user --transport http tokenzero https://tokenzero.sh/mcpInstal TokenZero MCP di Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp",
"type": "http"
}
}
}Pengecekan otomatis
Berjalan 15 Nov 2026Laporan lengkap →Belum diverifikasi. Sebuah server memerlukan skor 80, tidak ada temuan serius, dan data yang cukup untuk kami periksa. Cara kerja checks · Yang perlu diperbaiki untuk menambah poin
- Source repository terhubung dan dapat dijangkautokenzero-ai/tokenzero is public and reachablegithub.com/tokenzero-ai/tokenzero ↗Lolos
- Nama paket mencantumkan repositori ini sebagai sumbernyaTidak diperiksa
- Provenance build (atestasi Sigstore)Tidak diperiksa
- Lisensi open source (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Lolos
- Ada commit atau release dalam satu tahun terakhirLast commit or release 2026-11-05github.com/tokenzero-ai/tokenzero ↗Lolos
- OpenSSF ScorecardTidak diperiksa
- Nama package tidak mirip dengan package populerTidak diperiksa
- Tidak ada advisory kritis pada paket atau dependensinyaTidak diperiksa
- Tidak ada instruksi tersembunyi untuk model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersLolos
- Tools yang bersifat destruktif telah diberi labelTidak diperiksa
- Endpoint remote merespons handshake MCPinitialize answered with protocol 2025-06-18 in 289 msLolos
README
Lihat di 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
Pertanyaan tentang TokenZero MCP
Bagaimana cara menambahkan TokenZero MCP ke Claude Code?
Jalankan claude mcp add --transport http tokenzero https://tokenzero.sh/mcp di terminal Anda. Tambahkan --scope user agar tersedia di semua proyek.
Bagaimana cara menambahkan TokenZero MCP ke Cursor?
Buka ~/.cursor/mcp.json dan tambahkan server di bawah mcpServers, menggunakan config Cursor yang ditunjukkan di bagian instalasi di atas.
Apakah MCP server ini mengirimkan secret saya ke layanan remote?
Tool optimize_prompt_payload mengirimkan request body ke layanan TokenZero, jadi sebaiknya Anda menghindari penyertaan secret di dalam body tersebut.
Bisakah saya menggunakannya di pipeline CI/CD saya?
Ya, Anda bisa menggunakan GitHub Action untuk memeriksa perubahan biaya pada pull request.
Apakah angka auditnya akurat?
Angka yang diberikan adalah estimasi berdasarkan daftar harga; penghematan aktual yang terverifikasi disediakan oleh signed ledger dari gateway.