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.
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
amountvalues in USD cents. The server converts totals to dollars (total_amount_usd,value_usd); raw rows insidedataremain 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:
- Console → Settings → Admin keys (
https://platform.claude.com/settings/admin-keys). - Create Admin Key. Value starts with
sk-ant-admin….
Enterprise Analytics key (Enterprise product) — requires the Primary Owner:
- Analytics → API keys (
https://claude.ai/analytics/api-keys). - 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 ansk-ant-admin…key; Enterprise endpoints need the Analytics key.- Desktop can't start it → ensure the
commandpath is absolute andrun.shis executable. Logs:~/Library/Logs/Claude/mcp*.log.
License
MIT — see LICENSE.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.