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 集成