Enables posting cost comments and estimates to Bitbucket pull requests for Terraform infrastructure changes.
Enables posting cost comments and estimates to GitHub pull requests for Terraform infrastructure changes.
Enables posting cost comments and estimates to GitLab pull requests for Terraform infrastructure changes.
Provides tools for Terraform cost estimation and cloud governance, including generating cost breakdowns, comparing configurations, creating tagging policies, setting up cost guardrails, and managing custom properties for resource classification.
Provides cost analysis capabilities for Terraform configurations, including breakdown generation, configuration comparison, and cost estimation for infrastructure as code.
Infracost MCP Server
MCP server that lets Claude interact with Infracost for Terraform cost estimation and cloud governance. Works with Claude Desktop and Claude Code.
What it does
Generate cost breakdowns for Terraform configurations
Compare costs between different configs or branches
Create and manage tagging policies in Infracost Cloud
Set up cost guardrails that block expensive PRs
Post cost comments to GitHub/GitLab/Azure/Bitbucket PRs
Upload custom properties for resource classification
Prerequisites
Node.js 18+
Infracost CLI (install guide)
Infracost service token (get from dashboard)
Installation
Create a .env file:
Usage
With Claude Code
The repo includes .mcp.json and .claude/agents/ so it works out of the box - just open the project in Claude Code and the Infracost tools will be available.
With Claude Desktop
Add to your config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Examples
Ask Claude things like:
"What's the monthly cost of my Terraform in ./infrastructure?"
"Compare costs between staging and prod configs"
"Create a tagging policy that requires Environment and Owner tags"
"Set up a guardrail that blocks PRs adding more than $200/month"
"Generate an HTML cost report"
Available Tools
Cost Estimation:
infracost_breakdown- Generate cost breakdowninfracost_diff- Compare two configurationsinfracost_output- Format/combine outputsinfracost_upload- Upload to Infracost Cloudinfracost_comment- Post to PRs
Cloud API (requires service token):
Tagging policies: list, get, create, update, delete
Guardrails: list, get, create, update, delete
Custom properties: upload CSV data
See docs/README.md for detailed tool parameters and docs/EXAMPLES.md for JSON examples.
Project Structure
src/- TypeScript sourcedist/- Compiled output (created bynpm run build)docs/- Additional documentation.claude/- Claude Code configuration (optional)
Troubleshooting
Server not working: Verify Infracost CLI is installed (infracost --version) and token is set correctly in config.
Claude not using tools: Restart Claude after config changes. Make sure path to dist/index.js is absolute.
No resources found: Run terraform init in your Terraform directory first.
License
MIT
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
Enables Claude to interact with Infracost for Terraform cost estimation and cloud governance. Supports generating cost breakdowns, comparing configurations, creating tagging policies, setting up cost guardrails, and posting cost comments to PRs.