CloudCost MCP Server
Provides live pricing data for AWS resources and enables cost estimation and comparison across instance types, databases, storage, and networking.
Posts cost estimate comments to pull requests via a reusable GitHub Actions composite action.
Provides live pricing data for GCP resources and enables cost estimation and comparison across compute, database, storage, and Kubernetes services.
Parses OpenTofu .tofu files for cost analysis, similar to Terraform support.
Parses Pulumi stack export JSON files to extract resources for cost estimation and cross-provider comparison.
Parses Terraform HCL files, resolves variables, and extracts resource inventories for cost analysis and multi-cloud comparison.
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., "@CloudCost MCP Serverestimate the monthly AWS cost of this Terraform config"
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.
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 real-time pricing data, and generate multi-cloud cost comparison reports. It connects directly to public pricing APIs from AWS, Azure, and GCP. No API keys or cloud credentials required.
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
.tofufilesQueries live on-demand pricing from AWS Bulk Pricing CSV and Azure Retail Prices REST API; GCP via live Cloud Billing Catalog API with bundled fallback
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
Provides optimization recommendations: right-sizing, reserved pricing, provider switching, spot/preemptible instances
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
Supported IaC Formats
Format | Extensions | Auto-detected |
Terraform/OpenTofu |
| Yes |
CloudFormation |
| Yes |
Pulumi |
| Yes |
Bicep/ARM |
| 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_budgetreturnsallow/warn/blockwith 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 credentials. All pricing comes from public endpoints. No account, no cloud IAM, no API keys.
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-mcpThen, 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-mcpClaude Desktop
Add to your Claude Desktop MCP configuration (claude_desktop_config.json):
{
"mcpServers": {
"cloudcost": {
"command": "node",
"args": ["/path/to/CloudCostMCP/dist/index.js"]
}
}
}If installed globally via npm:
{
"mcpServers": {
"cloudcost": {
"command": "cloudcost-mcp"
}
}
}Claude Code
claude mcp add cloudcost -- node /path/to/CloudCostMCP/dist/index.jsOr if installed globally via npm:
claude mcp add cloudcost -- cloudcost-mcpAs a standalone MCP server (stdio)
node dist/index.jsTools
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.
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 |
|
| Yes | Terraform |
|
| No | Contents of a |
estimate_cost
Calculate costs for parsed resources on a specific provider. Returns monthly and yearly breakdowns per resource with confidence scores.
Parameter | Type | Required | Description |
|
| Yes | Terraform files |
|
| No | Variable overrides |
|
| Yes | Target provider for pricing |
|
| No | Target region (auto-mapped if omitted) |
|
| No | Output currency (default: |
compare_providers
Full pipeline: parse Terraform, map resources across providers, fetch pricing, and produce a comparison report. This is the main entry point for cost analysis.
Parameter | Type | Required | Description |
|
| Yes | Terraform files |
|
| No | Variable overrides |
|
| No | Report format (default: |
|
| No | Providers to compare (default: all three) |
|
| No | Output currency (default: |
get_equivalents
Look up the equivalent Terraform resource type and instance size across providers. Useful for migration planning.
Parameter | Type | Required | Description |
|
| Yes | Terraform resource type (e.g., |
|
| Yes | Provider the resource belongs to |
|
| No | Specific target (omit for all) |
|
| No | Instance type to also map (e.g., |
get_pricing
Direct pricing lookup. Returns the normalized unit price with metadata for a specific resource on a specific provider.
Parameter | Type | Required | Description |
|
| Yes | Cloud provider |
|
| Yes | Service category |
|
| Yes | Instance type, storage type, etc. |
|
| Yes | Cloud region |
optimize_cost
Analyze Terraform resources and return optimization recommendations. Includes right-sizing suggestions, reserved instance comparisons, and cross-provider savings opportunities.
Parameter | Type | Required | Description |
|
| Yes | Terraform files |
|
| No | Variable overrides |
|
| 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 |
|
| Yes | Terraform files |
|
| No | Variable overrides |
|
| Yes | Changes to model. Each specifies a resource name and the attributes to override |
|
| No | Providers to evaluate (default: all three) |
|
| No | Output currency (default: |
Example: model the cost impact of switching compute from on-demand to spot across providers:
{
"files": [{ "path": "main.tf", "content": "..." }],
"scenarios": [
{ "resource": "aws_instance.web", "pricing_model": "spot" },
{ "resource": "aws_instance.app", "instance_type": "m6i.2xlarge" }
]
}analyze_plan
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 |
|
| Yes | JSON output from |
|
| No | Target provider for pricing (auto-detected if omitted) |
|
| No | Output currency (default: |
compare_actual
Parse .tfstate files to compare actual infrastructure costs vs estimates. Identifies drift between planned and deployed resources.
Parameter | Type | Required | Description |
|
| Yes | Contents of a |
|
| No | Target provider for pricing (auto-detected if omitted) |
|
| No | Output currency (default: |
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 |
|
| Yes | Cloud provider |
|
| Yes | Service category |
|
| Yes | Instance type, storage type, etc. |
|
| Yes | Cloud region |
|
| No | Lookback period in days (default: |
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 |
|
| Yes | IaC files to analyze |
|
| No | Variable overrides |
|
| No | Target provider (auto-detected if omitted) |
|
| No | Monthly budget cap in USD |
|
| No | Output currency (default: |
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 |
|
| Yes | IaC files to evaluate |
|
| No | Variable overrides |
|
| No | Target provider (auto-detected if omitted) |
|
| No | Target region (auto-detected if omitted) |
|
| No | Output currency (default: |
|
| No | Aggregate monthly threshold. Over = |
|
| No | Per-resource threshold. One over = |
|
| No | Fraction of limit that triggers |
How Pricing Works
CloudCost uses a tiered approach to get the most accurate pricing available without requiring any API keys or credentials.
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.,
largetoxlargedoubles 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
Live Cloud Billing Catalog API (primary). Queries the GCP Cloud Billing Catalog API (
cloudbilling.googleapis.com) using unauthenticated public endpoints. Results are cached for 24 hours.Bundled pricing data (fallback). If the live API is unreachable, falls back to curated pricing data in
data/gcp-pricing/that ships with the package. Covers Compute Engine machine types, Cloud SQL tiers, Cloud Storage classes, and Persistent Disk types across all major regions.Infrastructure services. Load balancer, Cloud NAT, and GKE pricing use fixed public rates.
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.
Example
Given this Terraform config:
# infrastructure.tf
resource "aws_instance" "web" {
count = 3
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t3.xlarge"
}
resource "aws_instance" "app" {
count = 2
ami = "ami-0c55b159cbfafe1f0"
instance_type = "m5.2xlarge"
}
resource "aws_db_instance" "primary" {
instance_class = "db.r6g.xlarge"
engine = "postgres"
allocated_storage = 200
}
resource "aws_ebs_volume" "data" {
count = 5
size = 500
type = "gp3"
}
resource "aws_s3_bucket" "assets" {}
resource "aws_lb" "main" {
load_balancer_type = "application"
}
resource "aws_nat_gateway" "main" {}
resource "aws_eks_cluster" "main" {
name = "prod"
}Running compare_providers against that config produces:
| Category | AWS (USD/mo) | Azure (USD/mo) | GCP (USD/mo) |
|-----------------|-------------|----------------|--------------|
| Compute | $1,176.48 | $1,209.60 | $1,142.88 |
| Database | $314.64 | $297.12 | $285.48 |
| Storage | $48.00 | $52.80 | $44.00 |
| Load Balancer | $16.20 | $18.00 | $18.26 |
| NAT Gateway | $32.40 | $32.40 | $31.68 |
| Kubernetes | $72.00 | $72.00 | $72.00 |
| **Total** | **$1,659.72** | **$1,681.92** | **$1,594.30** |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 |
|
| Cache TTL in seconds (24 hours) |
|
| SQLite cache file location |
|
| Log level: |
|
| Hours per month for cost calculations |
|
| Include estimated data transfer costs in reports |
|
| Default pricing model: |
|
| Expand referenced Terraform modules during parsing |
| Monthly budget cap in USD. Triggers a warning when exceeded | |
| Per-resource monthly budget cap in USD | |
|
| Percentage of budget at which a warning is surfaced (default: 80%) |
| Aggregate monthly ceiling for | |
| Per-resource ceiling for | |
|
| Fraction of guardrail threshold that triggers |
Config File
You can also create ~/.cloudcost/config.json:
{
"cache": {
"ttl_seconds": 43200,
"db_path": "/tmp/cloudcost-cache.db"
},
"pricing": {
"monthly_hours": 730,
"default_currency": "USD"
},
"logging": {
"level": "debug"
}
}Configuration priority: environment variables > config file > built-in defaults.
Architecture
┌───────────────────────────────┐
│ MCP Client │
│ (Claude Desktop / Agent) │
└──────────────┬────────────────┘
│ stdio
┌──────────────▼────────────────┐
│ CloudCost MCP Server │
│ (src/server.ts) │
└──────────────┬────────────────┘
│
┌────────────────────────┼───────────────────────┐
│ │ │
┌─────────▼─────────┐ ┌─────────▼─────────┐ ┌─────────▼─────────┐
│ Tool Handlers │ │ HCL Parsers │ │ Cost Engine │
│ (src/tools/*.ts) │ │ (src/parsers/) │ │ (src/calculator/) │
└─────────┬─────────┘ └───────────────────┘ └─────────┬─────────┘
│ │
┌─────────▼────────────────────────────────────────────────▼─────────┐
│ PricingEngine (router) │
│ (src/pricing/pricing-engine.ts) │
└──────┬───────────────────┬─────────────────────┬───────────────────┘
│ │ │
┌────────▼───────┐ ┌────────▼───────┐ ┌────────▼───────┐
│ AWS Bulk │ │ Azure Retail │ │ GCP Bundled │
│ Loader │ │ Client │ │ Loader │
│ (CSV + JSON) │ │ (REST API) │ │ (static JSON) │
└────────┬───────┘ └────────┬───────┘ └────────┬───────┘
│ │ │
▼ ▼ ▼
AWS Bulk Pricing Azure Retail API data/gcp-pricing/
CSV (public) (public, no auth) (bundled files)Highlights: zero API keys (all providers exposed via public endpoints), SQLite-backed price cache shared across tool calls, streaming ingest for the 267 MB AWS bulk CSV, and a graceful live → fallback → interpolated-table chain so every response carries a pricing_source and confidence field. Full layer-by-layer walkthrough and extension guides in docs/architecture.md.
Supported Resources
Category | AWS | Azure | GCP |
Compute |
|
|
|
Database |
|
|
|
Storage |
|
|
|
Network |
|
|
|
Kubernetes |
|
|
|
Container Registries |
|
|
|
Secrets Management |
|
|
|
DNS |
|
|
|
API Gateway |
|
|
|
WAF |
|
| |
OpenSearch |
| ||
Messaging |
|
|
|
ML/AI |
|
|
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_costtool recommends reserved instances; AWS Savings Plans are not yet supported (tracked in docs/roadmap.md). Passpricing_model: "spot"inwhat_ifscenarios to model spot/preemptible pricing.GCP live pricing is fetched from the Cloud Billing Catalog API with automatic fallback to bundled data when the API is unreachable. Bundled prices may lag slightly behind actual rates.
Fallback-data signaling. When a live pricing API is unreachable and
estimate_cost/compare_providers/get_pricingserve data from bundled or fallback tables, the response includes awarningsentry ("using fallback/bundled pricing data for …") so callers can flag stale estimates. Bundled data is refreshed weekly via CI.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_budgetintegration patterns for Claude Code, Cursor, and other agents.docs/architecture.md — internal layers, design decisions, extension guides.
docs/ci-integration.md — GitHub Actions cost-estimate composite action for PR comments.
docs/development.md — local setup, npm scripts, source layout.
docs/troubleshooting.md —
$0estimates, slow first request, cache issues, fallback warnings.docs/roadmap.md — what's shipped, in flight, backlog, and explicitly not planned.
VERSIONING.md — SemVer-locked public surface and support policy.
CONTRIBUTING.md — PR guidelines and code style.
SECURITY.md — vulnerability reporting.
License
MIT. See LICENSE for details.
This server cannot be installed
Maintenance
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
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/JadenRazo/CloudCostMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server