# Infracost MCP

> Infracost provides cloud cost estimates for Terraform workflows. It lets your AI agent manage cost guardrails, enforce tagging policies, and apply custom enterprise pricing directly from your CI/CD pipeline. Stop unexpected cloud bills before they hit production.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** terraform, cloud-cost, finops, cost-estimation, governance, pull-request, infrastructure-as-code

## Description

Need to make sure your infrastructure changes don't bankrupt the company? This MCP connects financial governance right into your code reviews. When you run a Pull Request, it checks projected costs against predefined limits, blocking the merge if spending spikes too high. Beyond simple alerts, you can enforce organizational standards by updating tagging policies, guaranteeing every cloud resource is properly attributed to a department or project. If your company has negotiated discounts with AWS or Azure, this MCP lets you manage those custom price books so cost estimates reflect reality, not standard rates. You can even upload raw CSV data containing business properties from systems like ServiceNow, mapping vague cloud charges to your actual internal organizational hierarchy. All of this governance is accessible through Vinkius and available to any compatible AI client.

## Tools

### list_guardrails
Retrieves a complete list of all active spending guardrails for the entire organization.

### query_pricing
Runs complex GraphQL queries against the Cloud Pricing API to compare costs across different resource types and regions.

### create_guardrail
Sets up a new cost guardrail rule that will monitor spending changes in your environment.

### create_price_book
Initiates the process to create and manage a custom, enterprise-specific price book for cloud billing.

### delete_guardrail
Permanently removes an existing cost guardrail rule from your organization's policy set.

### get_guardrail
Retrieves the specific details of a single, existing guardrail by its unique ID.

### get_price_book_files_url
Generates a secure URL that you must use to upload your custom price book CSV file.

### get_price_book
Checks the current status and details of an uploaded price book, waiting for successful completion.

### ingest_price_book
Triggers the actual processing and ingestion of a newly uploaded custom price book CSV file.

### update_guardrail
Modifies parameters, thresholds, or conditions on an already active cost guardrail rule.

### update_organization
Updates core organizational settings, such as activating a previously created custom price book ID.

### update_tagging_policy
Changes the rules and allowed values within an existing tagging policy for cloud resources.

### upload_custom_properties
Accepts raw CSV data to upload custom business properties, linking vague costs to internal departments or projects.

## Prompt Examples

**Prompt:** 
```
List all cost guardrails for the organization 'acme-corp'.
```

**Response:** 
```
I've retrieved the guardrails for 'acme-corp'. You have two active rules: 1. A $500 increase threshold that blocks PRs, and 2. A $5,000 total monthly budget alert.
```

**Prompt:** 
```
Create a new guardrail for 'acme-corp' that triggers when cost increase exceeds $200 and blocks the PR.
```

**Response:** 
```
Successfully created the guardrail. Any Pull Request in 'acme-corp' that increases monthly costs by more than $200 will now be automatically blocked until approved.
```

**Prompt:** 
```
Update the tagging policy for 'acme-corp' to make the 'Environment' tag mandatory.
```

**Response:** 
```
I've updated the tagging policy for 'acme-corp'. The 'Environment' tag is now marked as mandatory for all resources managed under this policy.
```

## Capabilities

### Enforce spending limits on code changes
You can list or create guardrails that automatically alert or block Pull Requests when the proposed infrastructure change exceeds a defined cost threshold.

### Maintain resource attribution standards
The agent updates tagging policies, ensuring every piece of cloud infrastructure is tagged correctly for accurate department or project billing.

### Apply negotiated enterprise pricing
You can create and manage custom price books using your company's specific discounted rates for major cloud providers like AWS and Azure.

### Map costs to internal business units
Upload raw data from external systems, allowing you to map general cloud expenses directly into your organization's cost center structure.

## Use Cases

### Preventing a runaway microservice deployment
A DevOps engineer submits a PR for a new service. The agent runs a check, sees the cost increase exceeds $200/month, and automatically blocks the merge, alerting the team that they need to optimize before deploying.

### Auditing resource ownership after a merger
A FinOps analyst needs to assign costs from a newly acquired subsidiary. They use `upload_custom_properties` to ingest raw CSV data, successfully mapping the new cloud expenses into the existing corporate cost center structure.

### Ensuring compliance before launch
An Engineering Manager updates the tagging policy using `update_tagging_policy`, making 'Environment' mandatory. The agent now rejects any resource creation that doesn't carry the correct operational tag, enforcing governance from day one.

### Verifying accurate cost projections
A team is planning a multi-region rollout. They use `query_pricing` to programmatically compare costs between three different regions and two resource types, verifying the best financial approach before committing to architecture.

## Benefits

- Prevents unexpected costs from hitting production. By using the `create_guardrail` tool, your agent blocks Pull Requests if cost increases exceed your defined thresholds.
- Enforces compliance without manual checks. You use `update_tagging_policy` to ensure every resource is correctly tagged with department and project IDs.
- Uses real-world pricing data. The MCP lets you manage custom enterprise discounts via `create_price_book`, so cost estimates reflect your actual negotiated rates, not public cloud prices.
- Connects cloud spend to internal budgets. Upload raw data using `upload_custom_properties` to map technical costs directly into your company's financial hierarchy.
- Saves time on audits. Instead of digging through multiple dashboards, you can programmatically query pricing data with `query_pricing` to compare resource types across regions.

## How It Works

The bottom line is that you get real-time financial control over infrastructure changes without having to switch context from your coding environment.

1. Subscribe to this MCP and enter your Infracost API Token.
2. Connect your AI client (like Claude or Cursor) to the Vinkius catalog.
3. Tell your agent what you need—for instance, 'List all cost guardrails' or 'Update the tagging policy for Environment'—and it executes the governance action.

## Frequently Asked Questions

**How does Infracost use the `create_guardrail` tool?**
The `create_guardrail` tool lets you set specific cost thresholds. You define rules that automatically block a Pull Request or send an alert if infrastructure changes exceed your defined dollar amount.

**What is the difference between `update_tagging_policy` and `upload_custom_properties`?**
Updating a tagging policy sets the rules for *what* tags must exist (like 'Environment' or 'Owner'). Uploading custom properties uses raw CSV data to map existing, complex cloud costs to your specific internal cost centers.

**Can Infracost help me with my enterprise discounts?**
Yes. You use the `create_price_book` tool to manage a custom price book. This ensures that all cost estimates reflect your company's negotiated, discounted rates for AWS and Azure.

**Which tool should I use if I need to check existing rules?**
Start with `list_guardrails` to see everything active. If you only want details on one specific rule, you can then use `get_guardrail`.

**Is Infracost good for complex cost comparisons?**
The `query_pricing` tool handles this by allowing you to run detailed GraphQL queries. This lets you programmatically compare costs across different regions and resource types accurately.