Package Exports
- cc-usage-mcp
- cc-usage-mcp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cc-usage-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cc-usage-mcp
Claude Code 用量追踪 MCP 服务器,支持 Windows / macOS / Linux。
解析本地 ~/.claude/projects/ 下的 JSONL 会话文件,统计 token 用量和费用。
功能
usage_summary- 按项目/模型/日期汇总用量和费用,支持时间范围筛选usage_today- 查看今日用量usage_session- 查看指定会话或最近会话的用量usage_cost_estimate- 估算指定 token 数量的费用
安装
npm install
npm run build配置
在 Claude Code 的 MCP 设置中添加:
方式一:项目级配置 (.claude/settings.json)
{
"mcpServers": {
"cc-usage": {
"command": "node",
"args": ["d:/temp/ikun-cc-usage-mcp/dist/index.js"]
}
}
}方式二:全局配置 (~/.claude/settings.json)
{
"mcpServers": {
"cc-usage": {
"command": "node",
"args": ["/path/to/cc-usage-mcp/dist/index.js"]
}
}
}路径根据你的系统调整:
- Windows:
"d:/temp/ikun-cc-usage-mcp/dist/index.js" - macOS/Linux:
"/home/user/cc-usage-mcp/dist/index.js"
支持的模型计价
| 模型 | Input | Output | Cache Write | Cache Read |
|---|---|---|---|---|
| claude-opus-4-6 | $15/M | $75/M | $18.75/M | $1.5/M |
| claude-sonnet-4-6 | $3/M | $15/M | $3.75/M | $0.3/M |
| claude-haiku-4-5 | $0.8/M | $4/M | $1/M | $0.08/M |