# OpenCost (K8s Cost) MCP for AI Agents AI Agent Connect

> OpenCost (K8s Cost) lets you query Kubernetes spending and infrastructure efficiency directly through your AI agent. It pulls data on workload allocations, cloud billing, and third-party costs so you can see exactly where your budget is going without leaving your chat interface. It helps you move from guessing your cloud bill to knowing your exact spend down to the pod level, making it a must-have for anyone managing large-scale K8s clusters.

## Overview
- **Category:** cloud-infrastructure
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_5JgTTx4dCCg1vy5LoQY7EOXCEeiHxNr943mMQtmk/ai-agent-connect
- **Tags:** kubernetes, cost-optimization, cloud-billing, infrastructure-monitoring, resource-allocation, finops

## Description

This Connector lets you query your OpenCost instance to see exactly where your Kubernetes spending is going. It connects your infrastructure data to your AI agent so you can ask questions about your budget instead of digging through complex dashboards. You can see which namespaces are over-provisioned, check the cost of specific cloud assets like load balancers, and even reconcile your internal labels with your actual cloud provider bills. It handles the heavy lifting of aggregating data across different sources so you can focus on making decisions. When you use this through the Vinkius catalog, you get a unified way to audit your spending across the entire stack. It turns complex infrastructure cost analysis into a simple conversation about your budget. Instead of manually jumping between multiple cloud consoles and trying to map out which specific services are driving your costs, you can just ask a question and get a summarized answer. This is a huge win for anyone who needs to stay on top of cloud waste without spending hours on manual audits every week. You can get a clear picture of your spend by drilling down into specific clusters, nodes, or even individual pods. It also lets you pull in data from your primary cloud provider to make sure your internal records actually match what you're being billed for. This gives you a complete view of your costs, from the high-level totals down to the granular details of your infrastructure.

## Tools

### get_custom_cost_total
Get a summary of third-party costs over a specific time window. Use this to see your total external service spend.

### set_log_level
Change the OpenCost log level at runtime. This lets you adjust the amount of info you see during troubleshooting.

### get_allocation
Query costs and resources allocated to specific Kubernetes workloads. This helps you identify which pods are burning your budget.

### get_assets
Retrieve cost data broken down by individual physical assets. See the cost of disks, load balancers, and other hardware.

### get_cloud_cost
Retrieve cloud cost data directly from your provider's billing reports. Use this to see your actual cloud spend.

### get_custom_cost_timeseries
Get cost samples over time for third-party services like Datadog or MongoDB Atlas. This helps you track external costs.

## Prompt Examples

**Prompt:** 
```
Which namespaces are costing the most right now?
```

**Response:** 
```
I've checked your workload allocations. Here's the current spend by namespace:

| Namespace | Spend |
| :--- | :--- |
| production | $1,200.00 |
| staging | $340.50 |
| dev | $120.00 |

Production is currently your highest spender. Would you like to see the specific pods driving that cost?
```

**Prompt:** 
```
Can you show me the cost for our load balancers?
```

**Response:** 
```
I've pulled the backing asset costs. Your load balancers are currently costing $45.20 for the current period. This is broken down by region:

- US-East: $25.00
- US-West: $20.20

Do you want to see the costs for disks or other assets next?
```

**Prompt:** 
```
What was our total spend on Datadog last month?
```

**Response:** 
```
The total custom cost for Datadog over the last 30 days was $850.00. This is part of your third-party service total of $1,250.00. I can also pull the daily timeseries if you want to see when the spikes happened.
```

## Capabilities

### Query workload spending
Get a breakdown of costs and resources allocated to specific Kubernetes namespaces or pods.

### Pull cloud billing data
Retrieve direct spending data from AWS, Azure, or GCP billing reports.

### Track third-party costs
Monitor expenses for external services like Datadog or MongoDB Atlas.

### Inspect asset costs
See the specific costs for physical infrastructure like disks and load balancers.

### Adjust log levels
Change the OpenCost logging output at runtime for easier troubleshooting.

### Filter by labels
Aggregate spending data by specific labels or annotations to see project-level costs.

## Use Cases

### Identifying over-budget namespaces
A DevOps engineer needs to find which namespace is over-budget. They ask the agent to list costs by label and identify the top spenders.

### Reconciling cloud provider bills
A FinOps lead wants to see if the AWS bill matches the internal K8s reporting. They ask the agent to pull both and compare the totals.

### Summarizing third-party service spend
An engineering manager wants a monthly summary of Datadog costs. They ask the agent to get the total custom cost for the last 30 days.

### Auditing backing asset costs
A platform engineer wants to see the cost of a specific load balancer. They ask the agent to pull the backing asset costs for that resource.

## Benefits

- Stop manual dashboard hopping by getting K8s cost data directly in your chat interface using `get_allocation`.
- Reconcile your internal spend with your actual cloud provider bills instantly using `get_cloud_cost`.
- Identify wasted money on orphaned resources or over-provisioned nodes by using `get_assets` to see individual costs.
- Track your total spend on third-party services like MongoDB Atlas or Datadog with `get_custom_cost_total`.
- Quickly adjust your OpenCost logs during troubleshooting without touching your configuration files via `set_log_level`.
- Filter costs by specific labels or annotations to see exactly how much each project or team is spending.

## How It Works

The bottom line is you get instant, conversational access to your Kubernetes spending data without opening a single dashboard.

1. Connect your OpenCost API Base URL to the Connector.
2. Ask your AI agent to pull cost data for specific namespaces, labels, or cloud providers.
3. Receive a summarized breakdown of your spending and resource usage in your chat window.

## Frequently Asked Questions

**What is the OpenCost (K8s Cost) MCP for?**
It lets your AI agent pull and analyze Kubernetes cost data from your OpenCost instance. You can ask questions about your spending, workload costs, and cloud billing instead of digging through complex dashboards.

**Can I use OpenCost (K8s Cost) to see my AWS bills?**
Yes, it can pull data from AWS CUR, Azure Export, and GCP Billing reports. This helps you see how your K8s costs align with what your cloud provider is actually charging you.

**Does the OpenCost (K8s Cost) MCP track third-party tools?**
It can track costs for external services like Datadog or MongoDB Atlas. You can get total summaries or see how those costs change over time.

**How do I get my Kubernetes spend into my AI agent?**
You connect this Connector to your AI client and provide your OpenCost API URL. From there, you can just type questions about your budget or resource usage.

**Can I use OpenCost (K8s Cost) to see costs for specific pods?**
Yes, the Connector can query costs and resources for specific workloads. This helps you identify which specific pods or controllers are burning through your budget.

**Is OpenCost (K8s Cost) good for FinOps?**
It's a primary tool for FinOps teams because it bridges the gap between internal K8s labels and external cloud billing. It makes reconciling those two numbers much faster.

**Can I see costs grouped by a specific Kubernetes namespace?**
Yes. Use the `get_allocation` tool and set the `aggregate` parameter to 'namespace'. You can also specify a `window` like '7d' to see trends over the last week.

**Does this server support viewing external cloud provider billing?**
Absolutely. The `get_cloud_cost` tool retrieves data directly from cloud provider billing reports (AWS CUR, Azure Export, GCP Billing) to give you a complete financial picture.

**Can I track costs for non-Kubernetes services like Datadog?**
Yes, if configured in your OpenCost instance, you can use `get_custom_cost_total` or `get_custom_cost_timeseries` to query costs for third-party SaaS and infrastructure services.