Anthropic Billing MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Anthropic Billing MCP ServerGet daily cost summary for this month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Anthropic Billing MCP Server
An MCP (Model Context Protocol) server for retrieving Anthropic billing and cost report data.
Features
Retrieve detailed cost reports from Anthropic's billing API
Support for time-based filtering and grouping
Daily cost summaries with USD conversion
Support for beta API features
Pagination support for large datasets
Type-safe with Zod validation
Related MCP server: Claude Stats MCP
Installation
Option 1: Using claude mcp add (Recommended)
# Add the MCP server from GitHub
claude mcp add anthropic-billing https://github.com/your-username/anthropic-billing-mcp
# Set your API key
claude mcp env anthropic-billing ANTHROPIC_API_KEY=your_api_key_hereOption 2: Manual Installation
git clone https://github.com/your-username/anthropic-billing-mcp
cd anthropic-billing-mcp
npm install
npm run buildSetup
Get your Anthropic Admin API key from https://platform.claude.com/settings/admin-keys
Note: Regular API keys from console.anthropic.com will not work for billing endpoints
You need an Admin API key with billing access permissions
If using
claude mcp add, set the environment variable:claude mcp env anthropic-billing ANTHROPIC_API_KEY=your_api_key_hereIf installing manually, set the environment variable:
export ANTHROPIC_API_KEY=your_api_key_here
Usage
With claude mcp add
After installation, the server will be automatically configured and available in Claude Desktop.
Manual Configuration
Add to your MCP configuration (e.g., in Claude Desktop config):
{
"mcpServers": {
"anthropic-billing": {
"command": "node",
"args": ["/path/to/anthropic-billing-mcp/dist/index.js"],
"env": {
"ANTHROPIC_API_KEY": "your_api_key_here"
}
}
}
}Available Tools
get_cost_report
Retrieve raw cost report data from Anthropic's API.
Parameters:
starting_at(required): RFC 3339 timestamp for start of time rangeending_at(optional): RFC 3339 timestamp for end of time rangebucket_width(optional): Time granularity ("1d" only)group_by(optional): Array of grouping options ["workspace_id", "description"]limit(optional): Maximum number of time buckets to returnpage(optional): Page token for paginationbeta_headers(optional): Array of beta feature headers
Example:
{
"starting_at": "2024-01-01T00:00:00Z",
"ending_at": "2024-01-31T23:59:59Z",
"group_by": ["description"],
"beta_headers": ["fast-mode-2026-02-01"]
}get_daily_costs_summary
Get a formatted summary of daily costs with USD conversion.
Parameters:
start_date(required): Start date in YYYY-MM-DD formatend_date(optional): End date in YYYY-MM-DD format (defaults to today)group_by_workspace(optional): Whether to group by workspace (default: false)group_by_description(optional): Whether to group by description (default: false)beta_headers(optional): Array of beta feature headers
Example:
{
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"group_by_description": true
}Demo: Real-World Usage for Budget Management
This MCP server enables powerful budget management and cost analysis workflows. Here's a real-world example of using it to create a comprehensive burn down analysis.
Scenario: Trading Profit vs API Costs
A trader made $1,000 profit in March 2026 and wanted to track their Anthropic API costs against this budget to ensure profitable AI-assisted trading decisions.
Live Cost Analysis (March 7, 2026)
Using the MCP server's get_cost_report tool, we retrieved actual spending data:
๐ Executive Summary
- Trading Profit This Month: $1,000.00
- Current API Costs: $91.05
- Remaining Budget: $908.95
- Days Elapsed: 7 of 31 (22.6%)
- Budget Utilization: 9.1%
๐ Key Performance Metrics
- Daily Average Cost: $13.01 ($91.05 รท 7 days)
- Projected Monthly Cost: $403.31 (at current rate)
- Target Daily Budget: $32.26 (1000 รท 31 days)
- API ROI: 1,098% ($1000 profit vs $91.05 cost)Budget Burn Rate Visualization
Week 1 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] $91.05 (28% of weekly target)
Week 2 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] $91.05 (projected)
Week 3 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] $91.05 (projected)
Week 4 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] $91.05 (projected)
Week 5 [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] $39.11 (projected)Risk Assessment & Strategic Insights
๐ข Current Status: LOW-MODERATE Risk
Tracking 59% below daily budget target
Cost efficiency: 9.1ยข per dollar of trading profit
Room to scale usage 2.5x while staying in budget
Outstanding ROI demonstrates profitable AI integration
MCP Integration Benefits
1. Real-Time Budget Monitoring
# Get current month costs instantly
get_daily_costs_summary start_date=2026-03-012. Automated Burn Rate Calculations
The MCP server enables programmatic cost analysis without manual API calls:
Daily average spending calculations
Projected monthly costs based on current usage
Budget variance tracking
ROI analysis against business metrics
3. Multi-Scenario Planning
# Scenario 1: Current pace โ $403.31 monthly (40.3% of budget)
# Scenario 2: 25% increase โ $504.14 monthly (50.4% of budget)
# Scenario 3: 50% increase โ $604.97 monthly (60.5% of budget)4. Integration with Business Logic
The MCP server allows seamless integration with:
Trading algorithms that factor in API costs
Automated budget alerts and thresholds
Cost-per-decision optimization
Dynamic usage scaling based on profitability
Sample Budget Management Workflow
# Pseudo-code showing typical workflow
def optimize_trading_strategy():
# Get real-time costs via MCP
current_costs = get_daily_costs_summary()
daily_avg = current_costs.total / days_elapsed
# Calculate remaining budget runway
remaining_budget = trading_profit - current_costs.total
safe_daily_spend = remaining_budget / days_remaining
# Adjust API usage based on cost efficiency
if daily_avg < safe_daily_spend * 0.8:
return "SCALE_UP" # Opportunity to use more AI
elif daily_avg > safe_daily_spend * 1.2:
return "SCALE_DOWN" # Risk of budget overrun
else:
return "MAINTAIN" # Optimal paceThis real-world example demonstrates how the MCP server transforms basic billing data into actionable business intelligence, enabling data-driven decisions about AI investment and usage optimization.
๐ Full Analysis Available: See examples/trading-budget-burndown.md for the complete burn down analysis with weekly projections, risk assessments, and KPI tracking.
API Response Structure
Cost Items
Each cost item includes:
amount: Cost in cents as decimal stringcurrency: Currency code (always "USD")description: Description of the cost itemmodel: Model name usedcost_type: Type of cost ("tokens", "web_search", "code_execution")token_type: Token type for token costsservice_tier: Service tier ("standard", "batch")context_window: Input context window usedworkspace_id: Associated workspace IDinference_geo: Inference geography usedspeed: Speed tier (with beta header)
Daily Summary Format
{
"summary": [
{
"date": "2024-01-01",
"total_cost_cents": 1234,
"total_cost_usd": "12.34",
"items": [...]
}
],
"total_cost_cents": 50000,
"total_cost_usd": "500.00",
"period": {
"start": "2024-01-01",
"end": "2024-01-31"
},
"has_more": false,
"next_page": null
}Development
Build
npm run buildRun in Development
npm run devTest
npm testEnvironment Variables
ANTHROPIC_API_KEY: Your Anthropic Admin API key from platform.claude.com/settings/admin-keys (required)Regular API keys will not work - billing endpoints require Admin API keys
Error Handling
The server includes comprehensive error handling for:
Missing API keys
Invalid API responses
Network errors
Validation errors
API rate limits
All errors are returned with descriptive messages to help with debugging.
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jongan69/anthropic-billing-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server