Skip to main content
Glama
cortezcristian

Kubecost MCP Server

create_budget

Create budget rules in Kubecost to monitor and control Kubernetes cluster spending by setting spending limits and configuring alerts for cost overruns.

Instructions

Create a new budget rule in Kubecost

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYes
intervalYes
intervalDayYes
kindYes
nameYes
spendLimitYes
valuesYes

Implementation Reference

  • Executes the create_budget tool by calling the Kubecost client's createOrUpdateBudget method with the input budgetData and formats the success or error response.
    async (budgetData) => { try { const result = await this.kubecostClient.createOrUpdateBudget(budgetData); return { isError: false, content: [{ type: 'text', text: `Budget created successfully: ${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } }
  • Zod schema for validating the input parameters of the create_budget tool, defining the structure for budget creation data.
    { name: z.string(), values: z.object({ cluster: z.array(z.string()).optional(), namespace: z.array(z.string()).optional(), label: z.record(z.array(z.string())).optional(), }), kind: z.enum(['soft', 'hard']), interval: z.enum(['weekly', 'monthly']), intervalDay: z.number(), spendLimit: z.number(), actions: z.array(z.object({ percentage: z.number(), emails: z.array(z.string()).optional(), slackWebhooks: z.array(z.string()).optional(), msTeamsWebhooks: z.array(z.string()).optional(), })), },
  • src/index.ts:75-110 (registration)
    Registers the create_budget tool with the MCP server using this.tool, including name, description, input schema, and handler function.
    this.tool( 'create_budget', 'Create a new budget rule in Kubecost', { name: z.string(), values: z.object({ cluster: z.array(z.string()).optional(), namespace: z.array(z.string()).optional(), label: z.record(z.array(z.string())).optional(), }), kind: z.enum(['soft', 'hard']), interval: z.enum(['weekly', 'monthly']), intervalDay: z.number(), spendLimit: z.number(), actions: z.array(z.object({ percentage: z.number(), emails: z.array(z.string()).optional(), slackWebhooks: z.array(z.string()).optional(), msTeamsWebhooks: z.array(z.string()).optional(), })), }, async (budgetData) => { try { const result = await this.kubecostClient.createOrUpdateBudget(budgetData); return { isError: false, content: [{ type: 'text', text: `Budget created successfully: ${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cortezcristian/kubecost-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server