Prerequisites
- A CostGraph account with an active billing plan.
- Access to the tenant you want to query.
- An MCP client that supports remote HTTP servers.
Connect your agent through OAuth or API key
Choose your client. Use browser sign-in for an interactive session or the API key alternative for a headless session. Replace example keys with your own credential and keep them out of shared configuration files.- Codex
- Claude
- Amp
- OpenCode
- Other clients
Add CostGraph to 
Start browser authorization.For an API key, use this configuration instead. Set
~/.codex/config.toml.The following image shows the server entry. Copy the configuration from the
code block into your file.
COSTGRAPH_API_KEY in the
environment where you run Codex.Authorize a tenant
During browser sign-in, select the CostGraph tenant you want the agent to use and approve the requested access. Return to your client and confirm that CostGraph appears in its connected MCP servers. A tenant is the CostGraph workspace containing your connected data. A provider’s account or project can appear within that data as a sub-account. Refer to Sub-accounts and tenants for the distinction. API key connections use the access granted to that key. They do not require a browser approval step.Verify the connection
Check the connection with a read request before asking the agent to make changes.1
Check the connected server
Open your client’s MCP server list and confirm that CostGraph is connected.
If the client reports an authentication error, repeat its sign-in flow or
check the API key configuration.
2
Read your cost data
Ask the agent to read the Context map for your authorized tenant.
3
Check the result
Confirm that the agent calls CostGraph tools. The result includes the groups
found in your connected data and their costs for the requested window.If the map is empty, check the tenant and connected data sources. Connecting
through MCP does not import data. An authentication or billing error means
the query did not succeed.
Access and changes
CostGraph scopes queries to the tenant authorized by your connection. Available actions also depend on your credentials and role. An authorized agent can also start or continue a workflow. Open the returned run link to review its plan, approval requests, and outcome. If your connection is read-only, CostGraph returns a link to the relevant dashboard page instead of starting the workflow. Refer to Start workflows from MCP.Troubleshoot the connection
Check the client status before changing its configuration.Authentication fails
Authentication fails
Confirm the server URL is
https://mcp.costgraph.ai/. Repeat the client’s
OAuth sign-in, or check that its X-API-Key header contains an active personal
API key. An install token cannot authenticate a query.A tool reports a billing requirement
A tool reports a billing requirement
Check your organization’s plan in
Billing settings, then
retry the request.
The result contains no expected resources
The result contains no expected resources
Check the selected tenant, date range, and connected data sources. A successful
connection does not import infrastructure or billing data by itself.
