API keys & AI assistants (MCP)
Create API keys and connect Claude Desktop, Cursor or Claude Code to your cost data.
API keys & AI assistants (MCP)
Create a key so an AI assistant such as Claude Desktop, Cursor, Claude Code or Windsurf can ask CostGlass questions about your cloud costs.
- An API key is a secret that lets a program act as the person who created it. It starts with cg_live_.
- The full key is shown once, when you create it. CostGlass stores only a fingerprint, so a lost key cannot be recovered; revoke it and make a new one.
- The page offers one scope, read, but see the warning below: a key acts with its creator's role.
- The MCP (Model Context Protocol) connection gives an AI assistant seven read-only tools, two resources and two ready-made prompts.
- You are an Owner or Admin.
- Some cost data is already connected, otherwise the assistant has nothing to answer from.
- An AI assistant that supports MCP servers.
Create a key
Revoke a key
In the key's row use the revoke action and confirm. The key stops working immediately for everything that uses it, and it disappears from the list. Revoke a key when a laptop is lost, a person leaves, or you are unsure who has seen it. Only Owners and Admins can revoke.
What a key can do (read this)
- The scope field is stored, but today it is not enforced by the server. A key acts with the role of the person who created it, on the whole CostGlass API, not only on the assistant tools. If an Owner creates it, it has Owner rights.
- A key is not narrowed by hierarchy scope. The assistant tools read the whole organisation even if the creator is limited to one node.
- If the creator is removed or disabled, the key stops working.
Good practice
- Create keys for a dedicated, least-privileged person where possible (a Member who is not scoped), not an Owner.
- Use short expiries and one key per tool or machine, so you can revoke one without affecting the rest.
- Never paste a key into chat, tickets or source control. Keep it in the assistant's environment settings.
- Check Last Used regularly and revoke keys you do not recognise.
- Remember that what the assistant reads is sent to the AI provider that runs the assistant. Only connect assistants your company has approved.
Connect your assistant
Replace the key placeholder with your key. The API address below is the UK region's. If your organisation is in another region, use your region's API address instead; ask support if you are unsure.
Claude Desktop and Cursor (local server)
Add this to claude_desktop_config.json (Claude Desktop) or .cursor/mcp.json (Cursor). The path points at the CostGlass MCP server script you have installed.
Claude Code
Remote connection (no local install)
For assistants that can talk to a remote MCP server over HTTP:
Restart the assistant. Ask it "What were our top five cloud spenders this month?" to test.
What the assistant can use
| Tool | What it does |
|---|---|
costglass_query_costs | Spend grouped by service, region or account, over a time range (for example current month, last 30 days, year to date), daily or monthly, with optional filters and cost basis (unblended or amortized). The provider filter accepts aws, azure and gcp. |
costglass_get_anomalies | Cost anomalies, filterable by status, severity and provider. |
costglass_get_savings_recommendations | Savings opportunities, optionally above a minimum monthly saving. |
costglass_get_kubernetes_costs | Kubernetes cluster spend, namespace allocation, idle capacity and pod rightsizing. |
costglass_get_budgets | Budgets, limits and current spend. |
costglass_get_connected_accounts | Connected accounts and their sync status. |
costglass_get_cost_filters | The services, regions, accounts and tag dimensions that exist, so the assistant uses valid names. |
Two resources are available, costglass://summary/current-month and costglass://anomalies/active, and two prompts: /finops_audit (a broad review of spend, anomalies and waste) and /investigate_cost_spike (step-by-step triage of a sudden rise). All of these only read data. They do not change anything in CostGlass or in your clouds.