Claude Cost Audit

io.github.tylerscomic-lab由 GitHub 帳號 tylerscomic-lab 發布v1.0.0更新於 Oct 24, 2026

Exact Claude API cost calc with real cache economics, plus a tiktoken-misuse scanner.

發布方自己的服務:audit.domains - Domain Valuation

已驗證Streamable HTTP可網頁執行金融開發者工具

概覽

AI 產生的概覽

一個託管式 MCP 伺服器,用於精確計算 Claude API 成本、分析提示快取損益平衡,並掃描原始碼中誤用 tiktoken 的問題。

可以做什麼
依 token 數量計算 Claude API 訊息的精確美元成本,採用依模型定價與依日期解析的費率,包含快取寫入與讀取倍率以及前綴的最小可快取 token 門檻,以及快取是否划算,以及 5 分鐘或 1 小時 TTL 下是否回本,並標記使用 tiktoken、gpt-tokenizer 等 OpenAI 分詞器估算 Claude token 的原始碼檔案。
適用情境
適合在編列或稽核 Claude API 支出、判斷對重複前綴啟用提示快取是否值得,或審查程式碼庫中會悄悄扭曲成本與上下文預算估算的 token 計數錯誤時使用。
執行需求
透過 streamable HTTP 存取的遠端端點,需要 OAuth 驗證。未宣告環境變數或請求標頭。README 另說明了透過 npm install 與 node server.js 自行託管的方案。
安裝前請注意
託管服務需要 OAuth 登入,README 提到付費 Pro 方案,使用前請確認價格。分詞器稽核會讀取原始碼,請僅對願意分享給第三方服務的程式碼使用。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Claude Cost Audit,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.tylerscomic-lab%2Fclaude-cost-audit-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。

{
  "mcpServers": {
    "claude-cost-audit": {
      "type": "http",
      "url": "https://claude-cost-audit-mcp.mcpize.run/mcp"
    }
  }
}

README

claude-cost-audit-mcp

[License: MIT] [Live on MCPize]

An MCP server for exact Claude API cost calculation — correct prompt-cache economics (write 1.25x at 5-minute TTL / 2x at 1-hour TTL, read 0.1x), cache break-even analysis, and a scanner for the single most common Claude-cost mistake: estimating tokens with OpenAI's tiktoken.

The mistake this catches

Per Anthropic's own documentation: "Do not use tiktoken. It's OpenAI's tokenizer. It undercounts Claude tokens by ~15-20% on typical text, and by much more on code or non-English input." Any cost estimate or context-budget check built on tiktoken for a Claude model is silently wrong — this scans source for that exact pattern (foreign tokenizer + Claude/Anthropic usage in the same file) and points to the fix (messages.count_tokens).

Cache economics people get wrong

Caching doesn't pay off starting from the second request the way most people assume. The real break-even is 2 reuses at 5-minute TTL, but 3 reuses at 1-hour TTL — because the 1-hour write costs more (2x vs 1.25x). check_cache_breakeven computes this from Anthropic's real multipliers instead of a guessed rule of thumb, and flags prefixes below the model's own minimum-cacheable-token threshold (which is not monotonic across model generations — 512 tokens on the newest models, 4096 on some older ones).

Tools

calculate_message_cost

Exact $ cost from token counts, using Anthropic's real current per-model pricing (including Claude Sonnet 5's time-limited introductory rate, resolved automatically from the date you pass).

check_cache_breakeven

Given expected request volume reusing the same prefix, tells you whether caching saves money and at which TTL.

audit_tokenizer_usage

Scans source for tiktoken/gpt-tokenizer/etc. alongside Claude API usage.

Use it

Hosted (recommended): MCPize — free tier, $7/mo Pro.

Self-host:

bash
npm installnode server.js

Part of a small suite

mcp-schema-audit-mcp, cron-schedule-audit-mcp, regex-safety-audit-mcp.

License

MIT

來源:README.md,提交 57ff665

工具

0
該伺服器需要登入,因此 SourceWeft 無法在沒有帳號的情況下讀取其工具,也未收錄。已連接帳號所能看到的內容可能因帳號及其權限而異。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 85%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Audit 整合