TokenZero MCPサーバー
コミット 2026年11月5日Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
別名 tokenzero-ai/tokenzero
- スター
- 0
- ツール
- —
- ダウンロード数(30日間)
- —
- 最新バージョン
- 0.2.2
- 最終コミット
- 2026年11月5日
- ライセンス
- Apache-2.0
TokenZero MCPとは
TokenZeroはMCPサーバーです。 Audit projects for LLM token waste, price model alternatives, and optimize prompt payloads for caching.
プロジェクトのREADMEから生成された概要
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.
できること
- 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.
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
TokenZero MCPのインストール方法
フォーマット検証日 2026年11月10日Cursor に追加Gooseに追加Claude CodeにTokenZero MCPをインストール
$ claude mcp add --transport http tokenzero https://tokenzero.sh/mcpCursorにTokenZero MCPをインストール
~/.cursor/mcp.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp"
}
}
}VS CodeにTokenZero MCPをインストール
.vscode/mcp.json
{
"servers": {
"tokenzero": {
"type": "http",
"url": "https://tokenzero.sh/mcp"
}
}
}VS Code CLIにTokenZero MCPをインストール
$ code --add-mcp '{"name":"tokenzero","type":"http","url":"https://tokenzero.sh/mcp"}'CodexにTokenZero MCPをインストール
$ codex mcp add tokenzero --url https://tokenzero.sh/mcpCodex config.tomlにTokenZero MCPをインストール
~/.codex/config.toml
[mcp_servers.tokenzero] url = "https://tokenzero.sh/mcp"
Gemini CLIにTokenZero MCPをインストール
$ gemini mcp add -s user --transport http tokenzero https://tokenzero.sh/mcpGemini settings.jsonにTokenZero MCPをインストール
~/.gemini/settings.json
{
"mcpServers": {
"tokenzero": {
"url": "https://tokenzero.sh/mcp",
"type": "http"
}
}
}自動チェック
実行日 2026年11月15日完全なレポート →まだ検証されていません。サーバーには80点のスコア、重大な問題がないこと、および検証に必要な十分なデータが必要です。 チェックの仕組み · 点数を上げるための改善点
- ソースリポジトリがリンクされており、アクセス可能tokenzero-ai/tokenzero is public and reachablegithub.com/tokenzero-ai/tokenzero ↗合格
- パッケージがこのリポジトリをソースとして指定未チェック
- ビルドの来歴 (Sigstore 証明)未チェック
- オープンソースライセンス (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-11-05github.com/tokenzero-ai/tokenzero ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していない未チェック
- パッケージおよびその依存関係に重大な勧告なし未チェック
- モデルへの隠れた指示がない0 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされている未チェック
- リモートエンドポイントが MCP ハンドシェイクに応答initialize answered with protocol 2025-06-18 in 289 ms合格
README
GitHubで見るTokenZero 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のよくある質問
TokenZero MCPをClaude Codeに追加するには
ターミナルでclaude mcp add --transport http tokenzero https://tokenzero.sh/mcpを実行します。すべてのプロジェクトで利用するには--scope userを追加します。
TokenZero MCPをCursorに追加するには
~/.cursor/mcp.jsonを開き、上記のインストールセクションに示すCursor設定を使ってmcpServersの下にサーバーを追加します。
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.