CloudCost MCP is a Model Context Protocol server that lets AI agents parse infrastructure-as-code across multiple formats (Terraform, CloudFormation, Pulumi, Bicep/ARM), query pricing data, and generate multi-cloud cost comparison reports. AWS and Azure pricing are queried from public pricing endpoints; GCP pricing is served from bundled snapshots because Google does not provide CloudCost a credential-free live pricing path. No cloud credentials are required.
MCP server for multi-cloud cost analysis of Terraform, CloudFormation, Pulumi, and Bicep/ARM codebases
2026-10-28
Sterne
—
Tools
—
Uptime
—
What it does
Parses Terraform HCL files, CloudFormation templates, Pulumi stack exports, and Bicep/ARM templates with automatic format detection
Extracts resource inventories with variable resolution, including referenced modules and OpenTofu .tofu files
Queries live on-demand pricing from AWS Bulk Pricing CSV and Azure Retail Prices REST API; GCP from a weekly-refreshed bundled snapshot
Maps equivalent resources across AWS, Azure, and GCP (compute, database, storage, networking, Kubernetes, container registries, secrets management, DNS)
Generates cost estimates with per-resource breakdowns (monthly and yearly) across multiple currencies
Compares costs across all three providers side-by-side in markdown, JSON, CSV, or FOCUS format
Models hypothetical scenarios (instance type changes, region moves, commitment levels) without modifying Terraform files
Projects costs over 3, 6, 12, and 36-month horizons with reserved instance comparisons
Tags resources for cost attribution and groups report output by team, environment, or any custom label
Posts cost estimate comments to pull requests via a reusable GitHub Actions composite action
Provider pricing support
Provider
Pricing source
Support level
AWS
Live public pricing APIs + bundled fallback tables
Live
Azure
Live Retail Prices API + bundled fallback tables
Live
GCP
Bundled pricing snapshots + fixed public rates
Supported, but not live
GCP cost estimation still works, but its figures are snapshot-based and should not be described as real-time Google Cloud pricing. See How Pricing Works and Limitations for the freshness model.
Supported IaC Formats
Format
Extensions
Auto-detected
Terraform/OpenTofu
.tf, .tofu
Yes
CloudFormation
.yaml, .yml, .json, .template
Yes
Pulumi
.json (stack export)
Yes
Bicep/ARM
.json (ARM template)
Yes
How this compares to Infracost
Infracost is the mature choice for Terraform-on-AWS cost estimation in CI — PR-comment cost deltas, threshold gating, deep Terragrunt support. If that's your workflow, use it.
CloudCostMCP targets a different surface:
Agent-native via MCP. Models call it as a tool during generation. check_cost_budget returns allow / warn / block with the specific blocking resources named, fast enough on a warm pricing cache for an agent to veto an expensive config before writing it to disk.
Multi-IaC in one server. Terraform, CloudFormation, Pulumi, Bicep/ARM — one tool, not four.
Zero cloud credentials. AWS and Azure pricing use public endpoints; GCP pricing uses bundled snapshots. No account, cloud IAM, or cloud API keys are required.
Optimization + what-if scenarios built in. Right-sizing, reserved-pricing, cross-provider switching, and spot modeling are first-class tools.
The two are complementary. Use Infracost in CI; use CloudCostMCP inside your agent or editor.
Installation
Requires Node.js 20 or later.
60-second quick start (Claude Code)
npm install -g @jadenrazo/cloudcost-mcp
claude mcp add cloudcost -- cloudcost-mcp
Then, inside a project directory with Terraform files, ask Claude:
"Use cloudcost to estimate the monthly AWS cost of this Terraform config, then check it against a $2000/month budget with check_cost_budget."
No API keys, no cloud credentials, no separate account. For other MCP clients (Claude Desktop, Cursor, any MCP-compatible agent), see the detailed setup below.
All install options
# From source
git clone https://github.com/jadenrazo/CloudCostMCP.git
cd CloudCostMCP
npm install
npm run build
# Global npm install
npm install -g @jadenrazo/cloudcost-mcp
# One-shot, no install
npx -y @jadenrazo/cloudcost-mcp
Claude Desktop
Add to your Claude Desktop MCP configuration (claude_desktop_config.json):
claude mcp add cloudcost -- node /path/to/CloudCostMCP/dist/index.js
Or if installed globally via npm:
claude mcp add cloudcost -- cloudcost-mcp
As a standalone MCP server (stdio)
node dist/index.js
Tools
The server exposes twelve MCP tools. Each accepts JSON input and returns structured JSON output. For agent-centric workflows, check_cost_budget is the headline tool: it returns an allow / warn / block verdict fast enough to be called between IaC generation and disk write — see docs/guardrails.md.
Cost-reporting tools (estimate_cost, compare_providers, check_cost_budget, analyze_plan, compare_actual) also include a pricing_metadata block — { source, as_of, age_days, staleness } — describing the vintage of the bundled pricing data behind the numbers (fresh < 14 days, aging < 45 days, stale ≥ 45 days; compare_providers reports one block per compared provider). When a non-USD currency is requested, responses additionally carry exchange_rate: { rate, rate_as_of } — conversions use a static rate snapshot (currently 2026-03), not a live FX feed.
analyze_terraform
Parse Terraform files and return a resource inventory. Detects the cloud provider, resolves variables (including tfvars), and extracts cost-relevant attributes like instance types, storage sizes, and database engines.
Parameter
Type
Required
Description
files
{path, content}[]
Yes
Terraform .tf files to analyze
tfvars
string
No
Contents of a terraform.tfvars file
estimate_cost
Calculate costs for parsed resources on a specific provider. Returns monthly and yearly breakdowns per resource with confidence scores.
Full pipeline: parse Terraform, map resources across providers, fetch pricing, and produce a comparison report. This is the main entry point for cost analysis.
Analyze Terraform resources and return optimization recommendations. Includes right-sizing suggestions, reserved instance comparisons, and cross-provider savings opportunities.
Parameter
Type
Required
Description
files
{path, content}[]
Yes
Terraform files
tfvars
string
No
Variable overrides
providers
string[]
No
Providers to evaluate (default: all three)
what_if
Run hypothetical pricing scenarios against existing Terraform resources. Change instance types, regions, providers, or commitment levels and see the cost delta without modifying your actual configuration.
Parameter
Type
Required
Description
files
{path, content}[]
Yes
Terraform files
tfvars
string
No
Variable overrides
scenarios
object[]
Yes
Changes to model. Each specifies a resource name and the attributes to override
providers
string[]
No
Providers to evaluate (default: all three)
currency
string
No
Output currency (default: USD)
Example: model the cost impact of switching compute from on-demand to spot across providers:
Parse terraform plan JSON output for before/after cost-of-change analysis. Shows what resources are being added, changed, or destroyed and the cost impact of each change.
Parameter
Type
Required
Description
plan_json
string
Yes
JSON output from terraform show -json planfile
provider
aws | azure | gcp
No
Target provider for pricing (auto-detected if omitted)
currency
string
No
Output currency (default: USD)
compare_actual
Parse .tfstate files to compare actual infrastructure costs vs estimates. Identifies drift between planned and deployed resources.
Parameter
Type
Required
Description
state_json
string
Yes
Contents of a terraform.tfstate file
provider
aws | azure | gcp
No
Target provider for pricing (auto-detected if omitted)
currency
string
No
Output currency (default: USD)
price_trends
Query historical pricing trends and price change tracking. Shows how pricing has changed over time for specific resource types.
Parameter
Type
Required
Description
provider
aws | azure | gcp
Yes
Cloud provider
service
string
Yes
Service category
resource_type
string
Yes
Instance type, storage type, etc.
region
string
Yes
Cloud region
period_days
number
No
Lookback period in days (default: 90)
detect_anomalies
Cost anomaly detection with budget checks, price changes, concentration risk, and right-sizing hints. Analyzes parsed resources and flags potential cost issues.
Parameter
Type
Required
Description
files
{path, content}[]
Yes
IaC files to analyze
tfvars
string
No
Variable overrides
provider
aws | azure | gcp
No
Target provider (auto-detected if omitted)
budget_monthly
number
No
Monthly budget cap in USD
currency
string
No
Output currency (default: USD)
check_cost_budget
Fast cost-safety guardrail designed for AI agents. Returns allow / warn / block with the specific blocking resources named, so an agent can veto an expensive IaC generation before writing it to disk. Thresholds cascade: per-call params → CLOUDCOST_GUARDRAIL_* env → CLOUDCOST_BUDGET_* env. See docs/guardrails.md for integration patterns.
Parameter
Type
Required
Description
files
{path, content}[]
Yes
IaC files to evaluate
tfvars
string
No
Variable overrides
provider
aws | azure | gcp
No
Target provider (auto-detected if omitted)
region
string
No
Target region (auto-detected if omitted)
currency
string
No
Output currency (default: USD)
max_monthly
number
No
Aggregate monthly threshold. Over = block.
max_per_resource
number
No
Per-resource threshold. One over = block.
warn_ratio
number (0–1)
No
Fraction of limit that triggers warn (default 0.8)
How Pricing Works
CloudCost uses a tiered approach to get the most accurate pricing available without requiring any API keys or credentials. That constraint is real and it has a cost: where a provider has closed off anonymous access, CloudCost ships a snapshot instead of pretending to query live. See the GCP section below.
AWS
Live CSV streaming (primary). For EC2 compute pricing, the server streams the AWS Bulk Pricing CSV for the target region line-by-line. This avoids loading the full ~267 MB file into memory. All on-demand compute prices for the region are extracted in a single pass and cached in SQLite for 24 hours. Concurrent requests for the same region share a single download.
Live JSON API (secondary). For RDS (~24 MB), S3, ELB, and VPC, the server fetches regional JSON from the AWS Price List Bulk API. These files are small enough to parse directly.
Fallback tables + interpolation. If live fetching fails (network issues, timeouts), the server falls back to built-in pricing tables covering 85+ EC2 and 29 RDS instance types. A size-interpolation algorithm estimates prices for unlisted sizes within known families by following AWS's predictable doubling pattern (e.g., large to xlarge doubles the price).
Azure
Live REST API (primary). Queries the Azure Retail Prices API with OData filters for exact SKU matching (armSkuName). Fast, free, unauthenticated. Returns precise per-SKU pricing. Results are paginated and fully consumed.
Fallback tables + interpolation. If the API is unreachable, falls back to built-in tables covering 40+ VM sizes and 14 database tiers. A vCPU-proportional interpolation algorithm estimates prices for unlisted sizes.
GCP
GCP has no live path, and this is a limitation rather than a design choice. Google has retired every key-free bulk pricing source it used to publish, and cloudbilling.googleapis.com answers unregistered callers with 403 PERMISSION_DENIED. Since CloudCost ships no credentials, GCP prices come from bundled data.
Bundled pricing data (only path). Served from data/gcp-pricing/, which ships with the package. Covers Compute Engine machine types, Cloud SQL tiers, Cloud Storage classes and Persistent Disk types across 37 regions. Every GCP price is tagged pricing_source: "bundled" and carries its vintage in pricing_metadata.
How it stays current..github/workflows/refresh-pricing.yml fetches the official Google Cloud Billing Catalog with a restricted Actions secret and generates Compute Engine, Persistent Disk and Cloud Storage tables weekly. The owned generator preserves pinned gcosts mappings (Apache-2.0), including whole-instance GPU and bundled local SSD prices. Every API page and required component must validate before metadata advances. Source effective time, completed retrieval, snapshot generation and verification are recorded separately. Consumers need no credentials. Cloud SQL remains hand-curated and check-freshness.ts reports it separately.
Infrastructure services. Load balancer, Cloud NAT, and GKE pricing use fixed public rates. GKE Autopilot is an approximation: it is billed per-pod across vCPU, memory and ephemeral storage, and the bundled figure is a per-vCPU/hour estimate.
Pricing Source Transparency
Every price returned includes a pricing_source attribute indicating its origin:
"live": fetched from a public API in real time
"fallback": from built-in tables (approximate, but reasonable for estimates)
"bundled": from bundled data files shipped with the package
All pricing data is cached in a local SQLite database (~/.cloudcost/cache.db) with a 24-hour TTL to minimize redundant API calls.
Prices are on-demand estimates. Actual costs vary by usage, region, and commitment level.
Configuration
All configuration is optional. The server works out of the box with sensible defaults.
Environment Variables
Variable
Default
Description
CLOUDCOST_CACHE_TTL
86400
Cache TTL in seconds (24 hours)
CLOUDCOST_CACHE_PATH
~/.cloudcost/cache.db
SQLite cache file location
CLOUDCOST_LOG_LEVEL
info
Log level: debug, info, warn, error
CLOUDCOST_MONTHLY_HOURS
730
Hours per month for cost calculations
CLOUDCOST_INCLUDE_DATA_TRANSFER
true
Include a synthetic default estimate of 100 GB/month internet egress per provider+region. Its share of the total is surfaced separately as estimated_egress_monthly (still included in total_monthly)
CLOUDCOST_PRICING_MODEL
on_demand
Default pricing model: on_demand, spot, or reserved
CLOUDCOST_RESOLVE_MODULES
true
Expand referenced Terraform modules during parsing
CLOUDCOST_BUDGET_MONTHLY
Monthly budget cap in USD. Triggers a warning when exceeded
CLOUDCOST_BUDGET_PER_RESOURCE
Per-resource monthly budget cap in USD
CLOUDCOST_BUDGET_WARN_PCT
80
Percentage of budget at which a warning is surfaced (default: 80%)
CLOUDCOST_GUARDRAIL_MAX_MONTHLY
Aggregate monthly ceiling for check_cost_budget. Over = block verdict
CLOUDCOST_GUARDRAIL_MAX_PER_RESOURCE
Per-resource ceiling for check_cost_budget. One over = block verdict
CLOUDCOST_GUARDRAIL_WARN_RATIO
0.8
Fraction of guardrail threshold that triggers warn instead of allow
Highlights: no cloud credentials required; AWS and Azure use public pricing endpoints, while GCP uses bundled pricing snapshots and fixed public rates. SQLite-backed caching is used by live/fallback pricing paths, AWS bulk CSV ingest is streamed, and every response carries pricing_source and confidence so callers can distinguish live quotes from bundled or fallback estimates. Full layer-by-layer walkthrough and extension guides in docs/architecture.md.
Instance type mapping covers 70+ AWS instance types (including Graviton/ARM families: m6g, m7g, c6g, c7g, r6g, r7g, t4g), 40+ Azure VM sizes, and 20+ GCP machine types with full bidirectional cross-provider mapping.
Limitations
On-demand pricing only by default. Prices reflect pay-as-you-go rates. The optimize_cost tool recommends reserved instances; AWS Savings Plans are not yet supported (tracked in docs/roadmap.md). Pass pricing_model: "spot" in what_if scenarios to model spot/preemptible pricing.
GCP pricing is always bundled. There is no live GCP path: cloudbilling.googleapis.com rejects unauthenticated callers and CloudCost ships no credentials. The bundled tables are rebuilt weekly (see How Pricing Works > GCP), and every GCP figure reports its own vintage, but they are a snapshot rather than a live quote.
Fallback-data signaling. When a live pricing API is unreachable and estimate_cost / compare_providers / get_pricing serve data from bundled or fallback tables, the response includes a warnings entry ("using fallback/bundled pricing data for …") so callers can flag stale estimates. AWS and Azure bundled tables are re-verified weekly via CI; the GCP tables are rebuilt weekly from an upstream snapshot. Datasets no automation covers (GCP Cloud SQL, AWS EBS, Azure disk and database tables) are listed under curated_datasets in each data/*-pricing/metadata.json and reported by scripts/check-freshness.ts.
Synthetic egress line item. Unless CLOUDCOST_INCLUDE_DATA_TRANSFER=false, every breakdown includes an assumed 100 GB/month of internet egress per provider+region. total_monthly includes it (unchanged behavior); its share is reported separately as estimated_egress_monthly with an explanatory warning so the composition is visible.
Static FX rates. Non-USD output is converted with a bundled rate table, not a live feed. Every converted response carries exchange_rate: { rate, rate_as_of } so consumers know which snapshot produced the figures.
First request latency. The initial EC2 pricing lookup for a new AWS region may take 30-120 seconds as the CSV file is streamed. Subsequent lookups for the same region are instant (cached for 24 hours).
Specialty instance types. GPU instances (p4d, g5, etc.), high-memory (x2idn), and bare-metal types may fall back to interpolated pricing if not in the built-in tables and live fetch fails.
More docs
docs/guardrails.md — check_cost_budget integration patterns for Claude Code, Cursor, and other agents.
Noch keine Tool-Liste. Remote-Server erhalten eine nach dem ersten Health-Check.
FAQ
Fragen
Wie installiere ich @jadenrazo/cloudcost?
Kopieren Sie auf dieser Seite die stdio-Konfiguration für Cursor, Claude Desktop, Claude Code oder VS Code. Sie nutzt die Installation des Herausgebers, keinen PlugMCP-Proxy.
Benötigt @jadenrazo/cloudcost einen API-Schlüssel?
In diesem Eintrag ist keine erforderliche Umgebungsvariable aufgeführt.
Welchen Transport verwendet @jadenrazo/cloudcost?
@jadenrazo/cloudcost läuft lokal über stdio.
Wann wurde @jadenrazo/cloudcost zuletzt geprüft?
Zuletzt geprüft: 2026-10-28. MCP server for multi-cloud cost analysis of Terraform, CloudFormation, Pulumi, and Bicep/ARM codebases