Kubecost MCP Server
Provides tools for managing Kubecost resources within Kubernetes environments, including budget management, cost allocation analysis, and asset monitoring for Kubernetes clusters.
Enables running the MCP server, with specific version requirements (v18 or higher) for proper functionality.
Used for package management during development of the MCP server.
Allows sending budget alerts and notifications to Slack via webhooks when spending thresholds are exceeded.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kubecost MCP Server show me our current budget rules and their spending status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Kubecost MCP Server
An implementation of Model Context Protocol (MCP) server for Kubecost, enabling AI assistants to interact with your Kubecost cost management platform through natural language. This server allows for seamless integration with Visual Studio Code, Cursor, and other MCP clients through stdio transport protocol.
Features
Transport Protocols: Supports stdio transport mode for flexible integration with different clients
Complete Kubecost API Integration: Provides comprehensive access to Kubecost resources and operations
Budget Management: Full CRUD operations for budget rules with notifications
Cost Analysis: Access to cost allocation and asset data
AI Assistant Ready: Pre-configured tools for AI assistants to interact with Kubecost in natural language
Related MCP server: AWS Cost Explorer MCP Server
Installation
Prerequisites
Node.js (v18 or higher recommended)
pnpm package manager (for development)
Kubecost instance with API access
Kubecost API token or username/password
Usage with Cursor
Follow the Cursor documentation for MCP support, and create a
.cursor/mcp.jsonfile in your project:
{
"mcpServers": {
"kubecost-mcp": {
"command": "npx",
"args": [
"kubecost-mcp@latest",
"stdio"
],
"env": {
"KUBECOST_BASE_URL": "<kubecost_url>",
"KUBECOST_API_TOKEN": "<kubecost_token>"
}
}
}
}Start a conversation with Agent mode to use the MCP.
Usage with VSCode
Follow the Use MCP servers in VS Code documentation, and create a
.vscode/mcp.jsonfile in your project:
{
"servers": {
"kubecost-mcp-stdio": {
"type": "stdio",
"command": "npx",
"args": [
"kubecost-mcp@latest",
"stdio"
],
"env": {
"KUBECOST_BASE_URL": "<kubecost_url>",
"KUBECOST_API_TOKEN": "<kubecost_token>"
}
}
}
}Start a conversation with an AI assistant in VS Code that supports MCP.
Usage with Claude Desktop
Follow the MCP in Claude Desktop documentation, and create a
claude_desktop_config.jsonconfiguration file:
{
"mcpServers": {
"kubecost-mcp": {
"command": "npx",
"args": [
"kubecost-mcp@latest",
"stdio"
],
"env": {
"KUBECOST_BASE_URL": "<kubecost_url>",
"KUBECOST_API_TOKEN": "<kubecost_token>"
}
}
}
}Configure Claude Desktop to use this configuration file in settings.
Authentication Options
You can authenticate with Kubecost using either:
API Token (recommended):
export KUBECOST_API_TOKEN="your-api-token"Username/Password:
export KUBECOST_USERNAME="your-username" export KUBECOST_PASSWORD="your-password"
Self-signed Certificates
If your Kubecost instance uses self-signed certificates or certificates from a private Certificate Authority (CA), you may need to add the following environment variable to your configuration:
"NODE_TLS_REJECT_UNAUTHORIZED": "0"This disables TLS certificate validation for Node.js when connecting to Kubecost instances using self-signed certificates or certificates from private CAs that aren't trusted by your system's certificate store.
Warning: Disabling SSL verification reduces security. Use this setting only in development environments or when you understand the security implications.
Available Tools
The server provides the following Kubecost management tools:
Budget Management
list_budgets: List all budget rulesget_budget: Get detailed information about a specific budget rulecreate_budget: Create a new budget ruleupdate_budget: Update an existing budget ruledelete_budget: Delete a budget rule
Cost Analysis
get_cost_allocation: Get cost allocation data with filtering and aggregationget_assets: Get asset data with filtering and aggregationhealth_check: Check if Kubecost API is healthy and accessible
Budget API Examples
Create a Weekly Budget
Create a budget that resets every Wednesday with a budget of $100.00 USD, and will send an alert via email when spending has exceeded 75% of the spend limit:
{
"name": "budget-rule",
"values": {
"cluster": ["test"]
},
"kind": "soft",
"interval": "weekly",
"intervalDay": 3,
"spendLimit": 100,
"actions": [
{
"percentage": 75,
"emails": [
"admin@company.com"
]
}
]
}Create a Monthly Budget
Create a budget for the kubecost namespace which resets on the 1st of every month with a budget of $400.00 USD, and will send alerts via Slack and Microsoft Teams when spending has exceeded $100.00 of the spend limit:
{
"name": "budget-rule-2",
"values": {
"namespace": ["kubecost"]
},
"kind": "soft",
"interval": "monthly",
"intervalDay": 1,
"spendLimit": 400,
"actions": [
{
"percentage": 25,
"slackWebhooks": [
"<example Slack webhook>"
],
"msTeamsWebhooks": [
"<example Teams webhook>"
]
}
]
}For Development
Clone the repository:
git clone https://github.com/your-username/kubecost-mcp.git
cd kubecost-mcpInstall project dependencies:
pnpm installStart the development server with hot reloading enabled:
pnpm run devOnce the server is running, you can utilize the MCP server within Visual Studio Code or other MCP client.
Environment Variables
Variable | Required | Description |
| Yes | The base URL of your Kubecost instance |
| No* | API token for authentication |
| No* | Username for basic authentication |
| No* | Password for basic authentication |
*Either API token or username/password combination is required.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License
About
This project provides a Model Context Protocol (MCP) server for Kubecost, enabling AI assistants to interact with cost management data through natural language.
Topics
kubernetes devops ai cost-management mcp kubecost model-context-protocol mcp-server budget-api cost-analysis
Available Tools
8 toolscreate_budgetC
Create a new budget rule in Kubecost
Inputs: actions (required), interval (required), intervalDay (required), kind (required), +3 more.
delete_budgetC
Delete a budget rule from Kubecost
Inputs: budgetId (required).
get_assetsC
Get asset data from Kubecost
Inputs: window (required), aggregate, filters.
get_budgetC
Get detailed information about a specific budget rule
Inputs: budgetId (required).
get_cost_allocationC
Get cost allocation data from Kubecost
Inputs: window (required), accumulate, aggregate, filters.
health_checkB
Check if Kubecost API is healthy and accessible
Inputs: no named parameters.
list_budgetsB
List all budget rules in Kubecost
Inputs: no named parameters.
update_budgetC
Update an existing budget rule in Kubecost
Inputs: actions (required), budgetId (required), interval (required), intervalDay (required), +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose with no ambiguity. Budget tools (create, delete, get, list, update) are clearly separated from data retrieval tools (get_assets, get_cost_allocation) and the health_check utility. The descriptions reinforce these distinctions, making misselection unlikely.
All tools follow a consistent verb_noun pattern with snake_case throughout. Budget-related tools use consistent verbs (create, delete, get, list, update) paired with 'budget', while other tools maintain the same naming convention (get_assets, get_cost_allocation, health_check). There are no deviations in style.
With 8 tools, this is well-scoped for a Kubecost server. Each tool earns its place by covering budget management (5 tools), data retrieval (2 tools), and health checking (1 tool). This count is neither too thin nor overwhelming for the domain.
The tool set provides complete CRUD coverage for budget rules and includes essential data retrieval and health checks. A minor gap exists in not having tools for other Kubecost features like alerts or recommendations, but core workflows are well-covered and agents can work effectively with what's provided.
Related MCP Connectors
FinOps assistant: query AWS, GCP and Azure cost, commitments, budgets and reports.
Ask about AWS, Azure, GCP, OpenAI, Anthropic and Snowflake costs, budgets, and anomalies.
Query cloud, AI and SaaS spend across 25+ providers: costs, budgets, anomalies, unit economics.
Cloud, SaaS and AI spend in one system of record. Each saving applied for you or shipped as code.
Related MCP Servers
- FlicenseCqualityDmaintenanceA server that provides advanced mathematical and financial calculation capabilities for AI code assistants, enabling them to perform complex calculations like symbolic calculus, numerical methods, and financial analysis without implementing algorithms directly.1813 npm8-
- AlicenseCqualityDmaintenanceA command-line interface and API that allows users to analyze and visualize AWS cloud spending data by enabling Claude to query AWS Cost Explorer through natural language conversations.4128MIT
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to access and manage accounting data through the freee accounting API, supporting operations like transaction management, financial analysis, and account item management.547 npm1-
- AlicenseNot gradedqualityNot gradedmaintenanceAn intelligent AI assistant routing and management platform that integrates 107 production-grade AI assistants into a unified enterprise intelligence service center.MIT