Anthropic Analytics MCP Server

Anthropic Analytics MCP Server

A local MCP server that lets Claude answer plain-language questions about your Anthropic usage and spend across the developer API platform and Claude Enterprise products.

Category
访问服务器

README

Anthropic Analytics MCP Server

A local MCP server that lets Claude (Desktop and Code) answer plain-language questions about your Anthropic usage and spend — both the developer API platform and the Claude Enterprise product (chat, Claude Code, Cowork).

It wraps two Anthropic APIs behind one server:

  • Usage & Cost Admin API (platform / developer API) — token usage and USD cost.
  • Enterprise Analytics API — org adoption, per-user activity, and per-user usage across Claude, Claude Code, and Cowork.

API keys are never stored on disk. They live in 1Password and are injected at launch by the 1Password CLI (op run), which prompts for Touch ID.

Tools

Platform (Admin key):

Tool Description
get_cost_report USD cost over time, grouped by workspace/description.
get_usage_report Token usage over time, grouped/filtered by model, workspace, key, tier.
list_workspaces Map wrkspc_… ids to names.
list_api_keys Map apikey_… ids to names/status.

Enterprise (Analytics key):

Tool Description
get_activity_summary Org-wide DAU/WAU/MAU, seat utilization, pending invites.
get_user_activity Per-user engagement (messages, projects, Claude Code commits/PRs, Cowork sessions).
get_skill_usage Skill adoption across surfaces.
get_connector_usage Connector adoption across surfaces.
get_chat_project_usage Conversation/user counts per chat project.
get_user_cost Users ranked by USD spend (usage credits on seat plans).
get_user_token_usage Users ranked by token usage.
get_usage_by_subsidiary Rolls per-user usage up by email domain = subsidiary.

Units note: both APIs return cost amount values in USD cents. The server converts totals to dollars (total_amount_usd, value_usd); raw rows inside data remain in cents.

Prerequisites

  • macOS with 1Password CLI (op) installed and its desktop app integration enabled (1Password → Settings → Developer → Integrate with 1Password CLI).
  • Python 3.10+.

1. Create the API keys

Admin key (platform usage/cost) — requires the org Admin/Primary Owner role:

  1. Console → Settings → Admin keys (https://platform.claude.com/settings/admin-keys).
  2. Create Admin Key. Value starts with sk-ant-admin….

Enterprise Analytics key (Enterprise product) — requires the Primary Owner:

  1. Analytics → API keys (https://claude.ai/analytics/api-keys).
  2. Toggle Access on under Analytics API, then + Create key.

The Enterprise Analytics cost/usage endpoints reflect usage credits on seat-based plans; the engagement/adoption endpoints are the main value there.

2. Store both keys in 1Password

Create two items (any vault), each with the key in a field (e.g. credential):

  • one for the Admin key
  • one for the Enterprise Analytics key

Right-click each field → Copy Secret Reference to get its op://… path.

3. Point the launcher at your items

Copy the example and fill in your two references:

cp config.local.sh.example config.local.sh
$EDITOR config.local.sh

config.local.sh is git-ignored, so your vault/item names never get committed.

4. Install

./install.sh          # creates .venv and installs deps

Smoke test (triggers Touch ID, makes one live call):

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./run.sh

5. Connect the clients

Use the absolute path to run.sh.

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "anthropic-analytics": {
      "command": "/absolute/path/to/anthropic-analytics-mcp/run.sh"
    }
  }
}

Claude Code:

claude mcp add anthropic-analytics --scope user /absolute/path/to/anthropic-analytics-mcp/run.sh

Restart Claude Desktop after editing its config.

Usage examples

  • "What was our total Anthropic API spend last month, by workspace?"
  • "Show Enterprise usage by subsidiary for May."
  • "Who are our top 10 users by Claude Code activity this week?"
  • "What's our weekly active user count and seat utilization?"

Notes & limits

  • Data freshness: platform ~5 min; Enterprise Analytics refreshes ~every 4h and can revise for up to 30 days. For invoice-grade Enterprise totals, query dates ≥30 days old.
  • Enterprise engagement data exists only from 2026-01-01 and for dates >3 days old.
  • Cost API is daily-only and excludes Priority Tier (track that via usage).

Troubleshooting

  • op: command not found → install the 1Password CLI; enable the app integration.
  • invalid character in secret reference → 1Password references can't contain ' or &; rename the item.
  • 401 invalid x-api-key → wrong key type/role. Admin endpoints need an sk-ant-admin… key; Enterprise endpoints need the Analytics key.
  • Desktop can't start it → ensure the command path is absolute and run.sh is executable. Logs: ~/Library/Logs/Claude/mcp*.log.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选