Is this related to an existing feature request or issue?
Yes — this complements the existing AWS Pricing MCP Server and AWS IaC MCP Server. The Pricing server does manual lookups, and the IaC server helps author infrastructure code but nothing currently reads your IaC files and estimates the cost automatically. This server bridges that gap.
Summary
An MCP server that estimates monthly AWS costs from Terraform, CloudFormation, and CDK infrastructure-as-code files before deployment by parsing resource declarations and querying the AWS Price List API in real-time.
Developers get cost visibility at authoring time: "What will this infrastructure cost?" — answered in the IDE, not after the bill arrives.
Motivation
The Problem
- No pre-deployment cost visibility — Teams discover infrastructure costs after deployment when the billing dashboard updates, often weeks later
- Manual pricing lookups are slow — The existing Pricing MCP server requires users to know the exact service code, filters, and attribute values to query
- IaC and pricing are disconnected — You can author infrastructure (IaC MCP server) or look up prices (Pricing MCP server), but nothing connects the two automatically
- Cost surprises in PRs — A teammate adds 3 NAT Gateways and nobody catches the $100+/month impact until the bill
Why This Should Be an MCP Server
- IDE-native — Cost estimates surface where developers make decisions (Kiro, Cursor, VS Code, Claude Code)
- Automated — No manual lookups; just point at your project and get an estimate
- Context-aware — The AI assistant can ask follow-up questions about usage patterns and refine estimates
- Composable — Works alongside the existing Pricing and IaC servers for a complete authoring + cost workflow
Proposed Tools
| Tool |
Description |
estimate_terraform_cost |
Estimate costs for a Terraform project directory (parses .tf files) |
estimate_tfplan_cost |
Estimate costs from a Terraform plan JSON file (terraform show -json) — most accurate |
estimate_cloudformation_cost |
Estimate costs from CloudFormation/SAM templates (YAML/JSON, single file or directory) |
estimate_cdk_cost |
Estimate costs from a CDK project (reads pre-synthesized cdk.out/) |
estimate_resource_cost |
Quick single-resource estimate (e.g., "How much is an m5.xlarge?") |
cost_diff |
Compare baseline vs proposed IaC — outputs PR-ready markdown showing cost delta |
compare_region_costs |
Compare the same infrastructure across multiple AWS regions |
list_supported_resources |
List all supported Terraform + CloudFormation resource types |
Use Cases
1. Estimate during development
"How much will my Terraform project in ./infrastructure cost per month?"
The server parses all .tf files, extracts resources, queries pricing, and returns a breakdown with total monthly/annual estimate.
2. Cost impact in PRs
"Compare the cost between main branch and my current changes"
Uses cost_diff to show: resources added (+$45/mo), resources removed (-$12/mo), resources modified, and net monthly impact. Output is PR-comment-ready markdown.
3. Region optimization
"Which region is cheapest for this stack — us-east-1, eu-west-1, or ap-southeast-1?"
Uses compare_region_costs to query pricing across regions and rank by total monthly cost.
4. Usage-based service questions
For services like Lambda, S3, and DynamoDB where cost depends on usage, the server proactively asks the developer about expected traffic (with impact ranges) rather than silently guessing.
Design
Architecture
IaC Files (.tf / .yaml / cdk.out)
│
▼
Parser Layer (Terraform / CloudFormation / CDK)
│
▼
Resource Extraction (type, config, count)
│
▼
Pricing Engine
├── AWS Price List API (instance-based: EC2, RDS, etc.)
├── Known Prices (fixed-price: NAT GW, ALB, KMS, etc.)
└── Usage Questions (Lambda, S3, DynamoDB, etc.)
│
▼
Cost Aggregation + Formatting
Key Design Decisions
- Direct AWS Price List API — No middleman SaaS, no stale data. Only needs
pricing:GetProducts (read-only)
- Privacy-first — All processing is local. Only generic resource parameters are sent to the Pricing API (e.g.,
instanceType=m5.large). No code, names, or paths leave the machine.
- Coverage transparency — Never silently skips resources. Unsupported types are clearly listed with coverage percentage.
- Usage questions with impact ranges — Instead of silently assuming defaults, asks: "How many Lambda requests/month? (1M = $0.20, 10M = $2.00)"
- API caching — Avoids duplicate pricing API calls for the same instance types across resources
- Path validation — Blocks access to sensitive directories (
/etc, ~/.aws, ~/.ssh)
Supported Resources (Current)
50 Terraform + 50 CloudFormation resource types covering:
- Compute: EC2, Lambda, ECS Fargate, EKS
- Database: RDS, Aurora, DynamoDB, ElastiCache, Redshift, OpenSearch
- Networking: ALB/NLB, NAT GW, CloudFront, API Gateway, VPC Endpoints, Transit GW, Route 53
- Storage: S3, EBS, EFS, FSx
- Messaging: SQS, SNS, Kinesis, Step Functions, Amazon MQ, EventBridge
- Security: KMS, WAF, GuardDuty, Secrets Manager
- ML: SageMaker, Bedrock Agent
- Plus: CloudWatch, Cognito, and more
Security
- All processing runs locally — no telemetry, no data collection
- Path validation prevents directory traversal attacks
- File size/count limits prevent resource exhaustion
- CDK synth is NOT auto-executed (security risk) — only reads pre-existing
cdk.out/
Technical Implementation
- Language: Python 3.10+
- MCP Framework: FastMCP (Python MCP SDK)
- Dependencies: boto3 (AWS SDK), python-hcl2 (Terraform parsing), PyYAML (CloudFormation)
- Transport: stdio (standard MCP transport)
- Required IAM:
pricing:GetProducts only (read-only, no write access to any AWS resource)
Alternatives Considered
| Alternative |
Why Not Sufficient |
| AWS Pricing Calculator (web UI) |
Manual, not IDE-integrated, can't read IaC files |
| AWS Pricing MCP Server |
Manual lookup only — user must know service codes and filter values |
| Infracost (third-party) |
Requires separate CLI/SaaS, not MCP-native, Terraform-only |
| AWS Cost Explorer |
Post-deployment only — can't estimate before deploying |
Implementation Status
The server is fully implemented and tested:
- 8 tools, all functional
- 11 unit tests passing
- Tested against real customer CloudFormation templates (SAM, nested stacks, CDK-generated)
- Ready to restructure to awslabs/mcp monorepo format
Dependencies and Integrations
- Requires: AWS credentials with
pricing:GetProducts permission
- Complements: AWS Pricing MCP Server (for detailed manual lookups after estimation)
- Complements: AWS IaC MCP Server (for authoring infrastructure — this estimates its cost)
Notes
Why not extend the existing Pricing MCP Server?
The Pricing server is designed for manual lookups — you ask "what does m5.large cost?" and it queries the API. This server does something fundamentally different: it reads your infrastructure code and automatically maps resources to pricing. The parsing layer, usage question system, cost diff, and multi-format support (TF/CFN/CDK) are distinct enough to warrant a separate server.
Overlap with AWS IaC MCP Server?
No overlap. The IaC server helps you write infrastructure code (authoring assistance). This server reads your existing infrastructure code and estimates cost. They're complementary — author with IaC server, estimate with Cost Estimator.
Is this related to an existing feature request or issue?
Yes — this complements the existing AWS Pricing MCP Server and AWS IaC MCP Server. The Pricing server does manual lookups, and the IaC server helps author infrastructure code but nothing currently reads your IaC files and estimates the cost automatically. This server bridges that gap.
Summary
An MCP server that estimates monthly AWS costs from Terraform, CloudFormation, and CDK infrastructure-as-code files before deployment by parsing resource declarations and querying the AWS Price List API in real-time.
Developers get cost visibility at authoring time: "What will this infrastructure cost?" — answered in the IDE, not after the bill arrives.
Motivation
The Problem
Why This Should Be an MCP Server
Proposed Tools
estimate_terraform_cost.tffiles)estimate_tfplan_costterraform show -json) — most accurateestimate_cloudformation_costestimate_cdk_costcdk.out/)estimate_resource_costcost_diffcompare_region_costslist_supported_resourcesUse Cases
1. Estimate during development
The server parses all
.tffiles, extracts resources, queries pricing, and returns a breakdown with total monthly/annual estimate.2. Cost impact in PRs
Uses
cost_diffto show: resources added (+$45/mo), resources removed (-$12/mo), resources modified, and net monthly impact. Output is PR-comment-ready markdown.3. Region optimization
Uses
compare_region_coststo query pricing across regions and rank by total monthly cost.4. Usage-based service questions
For services like Lambda, S3, and DynamoDB where cost depends on usage, the server proactively asks the developer about expected traffic (with impact ranges) rather than silently guessing.
Design
Architecture
Key Design Decisions
pricing:GetProducts(read-only)instanceType=m5.large). No code, names, or paths leave the machine./etc,~/.aws,~/.ssh)Supported Resources (Current)
50 Terraform + 50 CloudFormation resource types covering:
Security
cdk.out/Technical Implementation
pricing:GetProductsonly (read-only, no write access to any AWS resource)Alternatives Considered
Implementation Status
The server is fully implemented and tested:
Dependencies and Integrations
pricing:GetProductspermissionNotes
Why not extend the existing Pricing MCP Server?
The Pricing server is designed for manual lookups — you ask "what does m5.large cost?" and it queries the API. This server does something fundamentally different: it reads your infrastructure code and automatically maps resources to pricing. The parsing layer, usage question system, cost diff, and multi-format support (TF/CFN/CDK) are distinct enough to warrant a separate server.
Overlap with AWS IaC MCP Server?
No overlap. The IaC server helps you write infrastructure code (authoring assistance). This server reads your existing infrastructure code and estimates cost. They're complementary — author with IaC server, estimate with Cost Estimator.