Debugging a surprise spike after a deploy usually turns into tab hopping. You open AWS Cost Explorer in one window and GCP Billing or Azure Cost Management in another. Then you check OpenRouter to see whether a prompt change drained prepaid credits. Doing that while you are already debugging in Claude Code or Cursor pushes most engineers to wire billing straight into their IDE agent.
That first attempt almost always hits two walls: credentials and math.
We ran into both while building Cloud Cost Analyzer (CCA). They are the main reason we built a hosted, read-only Model Context Protocol (MCP) server instead of shipping a local CLI wrapper around raw cloud SDKs.
Why local cloud keys and raw billing exports fail inside an IDE agent
Giving an AI coding assistant access to local ~/.aws/credentials or a GCP service account JSON file works until a shell loop runs the wrong command or reads an unintended environment. Developer laptops collect broad IAM permissions over time. Keeping static keys on disk just so an agent can check yesterday's EC2 or BigQuery bill widens the blast radius for zero gain.
Even with tight IAM policies, raw billing exports fit badly inside a prompt. AWS Cost and Usage Reports (CUR), BigQuery billing tables, and OpenRouter activity logs mix line-item SKU codes, amortized reservations, taxes, and credit adjustments. Loading hundreds of raw rows into Claude Code or Cursor fills the context window before the model even answers your cost question.
Then comes arithmetic. Language models reason well over a structured finding, such as whether an unused volume or an oversized RDS box is safe to shrink. Ask them to sum 800 CUR rows or reconcile net versus gross spend across credits and discounts from memory, and numbers drift quietly.
Reliable LLM cost tracking alongside cloud spend in an IDE requires two things. Keep cloud credentials off the laptop, and run aggregation logic on the server.
How we separate billing math from the agent prompt
In Cloud Cost Analyzer, every MCP workflow that queries cloud cost data sits behind two boundaries: read-only provider access and deterministic backend rules.
CCA never stores long-lived plaintext cloud secrets. AWS accounts connect via sts:AssumeRole with an ExternalId, issuing short-lived temporary STS credentials (1-hour default sessions). GCP uses Workload Identity Federation over OIDC, with an optional Fernet-encrypted service account fallback only when an org requires it. Azure uses an Entra ID Service Principal, and OpenRouter uses a Fernet-encrypted Management API key scoped only to /api/v1/activity and /api/v1/credits. PostgreSQL Row-Level Security (app.current_tenant) isolates every query to a single organization.
Neither CCA nor the MCP layer holds write permissions in your cloud accounts. An agent cannot stop an instance, detach a volume, or edit a security group.
All pricing and metric normalization happens on our backend before an MCP tool returns JSON. Python rules deterministically calculate cost rollups, 14-day CloudWatch or Cloud Monitoring averages, risk scores, and What-If resize simulations. By the time Claude Code or Cursor reads a payload, the math is settled.
Wiring Claude Code or Cursor to CCA's /mcp endpoint
Cloud Cost Analyzer exposes a remote MCP endpoint at https://cloudcostanalyzer.app/mcp. Pick Clerk OAuth 2.1 for interactive laptop sessions, or an organization API key for headless scripts.
Clerk OAuth 2.1 (no static secrets in config)
For local development, add the endpoint without credentials:
{ "mcpServers": { "cloud-cost-analyzer": { "url": "https://cloudcostanalyzer.app/mcp" } } } On first connection, Claude Code or Cursor opens a browser sign-in flow via Clerk OAuth 2.1. Once approved, requests stay locked to your CCA organization under your plan's rate limits. Nothing sensitive sits in your MCP config file (.mcp.json or .cursor/mcp.json).
Scoped Read-only API key (CI bots and strict environments)
For an automated PR assistant or headless CI check, create a Read-only key under Settings -> Integrations in CCA and pass it in X-API-Key. Even though CCA never mutates your cloud accounts, a Read-only key also blocks changes to CCA's own workflow state (such as triaging Action Cards or editing alert rules):
{ "mcpServers": { "cloud-cost-analyzer": { "url": "https://cloudcostanalyzer.app/mcp", "headers": { "X-API-Key": "<YOUR_READ_ONLY_API_KEY>" } } } } If a client with a Read-only key calls any mutating CCA tool, the server rejects the request before execution.
What tools your agent gets on Solo vs team plans
Different tiers expose distinct slices of the MCP catalog so simple spend monitoring stays predictable.
The Solo plan (€12/month or €119/year, up to 3 accounts across AWS, GCP, Azure, and OpenRouter) gives /mcp a Cost-Only allowlist at 60 requests per hour. Your IDE receives five read-only tools:
| MCP Tool | What it returns |
|---|---|
list_cloud_accounts | Connected accounts and sync health |
get_cost_breakdown | Gross, credit, and net spend grouped by up to two dimensions (service, account, project, sku, region, month, credit_type) |
get_dashboard_stats | Top-level spend summary across providers |
get_metric_glossary | Canonical FinOps metric definitions |
get_notification_settings | Active email budget thresholds |
That handles the everyday AWS and AI gateway cost check inside Claude Code or Cursor:
Use cloud-cost-analyzer to compare our OpenRouter API spend and AWS spend over the last 30 days, grouped by service. Once a team needs 14-day telemetry cleanup or action workflows, Starter (€49/month, 120 req/hr) unlocks 40+ MCP tools, including get_action_queue, get_action_detail, and get_resource_explorer. Pro (€79/month, 300 req/hr) adds anomaly detection, billing verification, and higher rate limits, while Growth (€149/month, 600 req/hr) adds what_if_simulate for pre-change resize modeling.
While editing an RDS Terraform module, an engineer can ask:
Find our highest-waste idle AWS database in cloud-cost-analyzer, check 14-day connection metrics, and simulate moving it to Single-AZ db.r6g.large. Because CCA already joined billing lines with 14-day metrics, those tools return concrete evidence: 0 active connections, 1.8% average CPU, and a risk rating. A What-If simulation then estimates the cost shift (for example, an illustrative drop from $888/mo to $248/mo). The agent can draft a Terraform PR with a snapshot step, while a human reviews and applies it in CI.
When an MCP server is overkill (and when it actually pays off)
If you run one AWS account and check your bill once a month before invoices close, skip hosted MCP. Opening Cost Explorer or running aws ce get-cost-and-usage takes thirty seconds.
/mcp pays off when spend drifts across providers. Pairing AWS or GCP infrastructure with variable OpenRouter token spend from background jobs or coding agents creates blind spots fast. Checking combined spend inside the same editor where you write infrastructure code lets you catch cost spikes alongside code changes, without hopping across consoles or storing cloud keys on laptops. Keep provider roles read-only, use OAuth 2.1 on laptops, reserve Read-only keys for bots, and ship every infrastructure change through Git pull requests.
Common questions
Does CCA replace building a custom AWS MCP server?
For cost and optimization workflows, yes. Point Claude Code or Cursor to https://cloudcostanalyzer.app/mcp instead of maintaining AWS CLI profiles, CUR scripts, and OpenRouter cron jobs on every developer machine. CCA handles multi-cloud ingestion, credit math, and 14-day telemetry rules server-side.
Can an agent stop EC2 instances or delete volumes through /mcp?
No. CCA connects to AWS, GCP, Azure, and OpenRouter exclusively with read-only permissions. Neither the platform nor an MCP client can stop, resize, or delete cloud resources.
Why separate Cost-Only Solo access from the full toolset?
Solo users watching up to 3 accounts usually want clean cost rollups, remaining OpenRouter credits, and threshold alerts without 40+ fleet optimization tools getting in the way. Starter and Pro unlock the Action Card queue and anomaly checks, while Growth adds what_if_simulate when teams want to model resize changes before deploying.
Want to query AWS, GCP, Azure, and OpenRouter spend from Claude Code or Cursor with zero cloud keys on disk?
Read how CCA's Read-Only MCP server works or start a 14-day free trial.



