Skip to main content
Glama
cortezcristian

Kubecost MCP Server

get_assets

Retrieve asset cost and allocation data from Kubecost for specified time periods, with options to aggregate results and apply filters for detailed cost analysis.

Instructions

Get asset data from Kubecost

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aggregateNo
filtersNo
windowYes

Implementation Reference

  • src/index.ts:199-221 (registration)
    MCP tool registration for "get_assets" including description, Zod input schema, and inline async handler that delegates to KubecostClient.getAssets and formats response as JSON text.
    this.tool( 'get_assets', 'Get asset data from Kubecost', { window: z.string(), aggregate: z.string().optional(), filters: z.record(z.string()).optional(), }, async (params) => { try { const result = await this.kubecostClient.getAssets(params); return { isError: false, content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { isError: true, content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }] }; } } );
  • Core handler logic in KubecostClient.getAssets method: makes authenticated HTTP GET request to Kubecost /model/assets API endpoint with query params and returns parsed AssetResponse data.
    async getAssets(params: { window: string; aggregate?: string; filters?: Record<string, string>; }): Promise<AssetResponse> { const response = await this.client.get('/model/assets', { params }); return response.data; }
  • TypeScript interface defining the structure of the AssetResponse returned by the getAssets API call, used for type safety in the tool implementation.
    export interface AssetResponse { data: { name: string; properties: { cluster: string; type: string; provider: string; providerId: string; account: string; project: string; service: string; category: string; labels: Record<string, string>; }; window: { start: string; end: string; }; totals: { cost: number; adjustment: number; totalCost: number; }; }[]; }

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