aws-iac-cost-estimator-mcp-server

v0.1.1
aws-iac-cost-estimator-mcp-server Checked 13 hours ago Published 3 months ago

An MCP server that estimates AWS monthly costs from Terraform and CDK infrastructure-as-code files

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

estimate_terraform_cost

Estimate monthly AWS costs from a Terraform project directory. Parses .tf files, extracts AWS resources, and queries the AWS Price List API to provide cost estimates for each resource and a total monthly/annual estimate. For usage-based services (Lambda, S3, DynamoDB, SQS), the output includes usage_questions — ask the user these questions and pass their answers back via usage_inputs on a follow-up call for accuracy. If the user says 'skip' or 'use defaults', proceed without usage_inputs.

ParameterTypeDescription
project_path *stringPath to the Terraform project directory containing .tf files
regionstringAWS region for pricing (default: us-east-1)
usage_inputsobjectOptional. User-provided usage data for usage-based resources. Keys are resource identifiers (e.g., 'aws_lambda_function.processor'), values are objects with usage fields (e.g., {"monthly_requests": 50…

estimate_tfplan_cost

Estimate monthly AWS costs from a Terraform plan JSON file. Use 'terraform show -json tfplan > plan.json' to generate the input. This provides more accurate estimates than parsing .tf files directly as it includes resolved variables and computed values.

ParameterTypeDescription
plan_path *stringPath to the Terraform plan JSON file (output of 'terraform show -json')
regionstringAWS region for pricing (default: us-east-1)

estimate_cloudformation_cost

Estimate monthly AWS costs from a CloudFormation template (YAML or JSON). Parses the Resources section, extracts AWS resources, and queries the AWS Price List API. Supports both single template files and directories containing multiple templates.

ParameterTypeDescription
template_path *stringPath to a CloudFormation template file (.yaml, .yml, .json) or a directory containing multiple templates
regionstringAWS region for pricing (default: us-east-1)

estimate_cdk_cost

Estimate monthly AWS costs from a CDK project. Reads synthesized CloudFormation templates from cdk.out/ directory. IMPORTANT: You must run 'cdk synth' manually BEFORE calling this tool — automatic synthesis is disabled for security reasons (it would execute arbitrary project code). Works with any CDK language (TypeScript, Python, Java, Go, C#).

ParameterTypeDescription
project_path *stringPath to the CDK project directory (containing cdk.json)
regionstringAWS region for pricing (default: us-east-1)

estimate_resource_cost

Estimate monthly AWS cost for a single resource by specifying the resource type and its attributes directly. Useful for quick cost checks without having a full IaC project. Accepts both Terraform-style (aws_instance) and CloudFormation-style (AWS::EC2::Instance) resource types.

ParameterTypeDescription
attributes *objectResource attributes. For Terraform: {"instance_type": "m5.large"}. For CloudFormation: {"InstanceType": "m5.large"}.
resource_type *stringResource type — either Terraform style (e.g., aws_instance, aws_db_instance) or CloudFormation style (e.g., AWS::EC2::Instance, AWS::RDS::DBInstance)
countintegerNumber of this resource (default: 1)
regionstringAWS region for pricing (default: us-east-1)

list_supported_resources

List all supported resource types for cost estimation, including both Terraform and CloudFormation resource type formats and their corresponding AWS services.

compare_region_costs

Compare estimated costs for the same infrastructure across multiple AWS regions. Useful for choosing the cheapest region for deployment.

ParameterTypeDescription
iac_type *stringType of IaC project (terraform, cloudformation, or cdk)
project_path *stringPath to Terraform, CDK, or CloudFormation project
regions *arrayList of AWS regions to compare (e.g., ['us-east-1', 'eu-west-1', 'ap-southeast-1'])

cost_diff

Compare cost estimates between two versions of infrastructure (e.g., current main branch vs. a proposed PR). Shows what changed: new resources added, resources removed, resources modified, and the total cost impact. Generates a PR-ready markdown comment. Ideal for code reviews and CI/CD pipelines.

ParameterTypeDescription
baseline_path *stringPath to the baseline/current IaC project (e.g., main branch)
iac_type *stringType of IaC project
proposed_path *stringPath to the proposed/new IaC project (e.g., PR branch)
regionstringAWS region for pricing (default: us-east-1)