Skip to main content
Glama

infracost_upload

Upload cost estimation data from Infracost CLI to Infracost Cloud for centralized tracking and reporting of infrastructure expenses.

Instructions

Upload Infracost JSON output to Infracost Cloud for centralized cost tracking and reporting. Requires infracost CLI to be installed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to Infracost JSON file to upload

Implementation Reference

  • Main handler for infracost_upload tool: checks CLI installation, executes upload via helper, returns MCP response.
    async handleUpload(args: z.infer<typeof UploadSchema>) { const isInstalled = await checkInfracostInstalled(); if (!isInstalled) { throw new Error( 'Infracost CLI is not installed. Please install it from https://www.infracost.io/docs/' ); } const result = await executeUpload(args); if (!result.success) { throw new Error(result.error || 'Upload command failed'); } return { content: [ { type: 'text', text: result.output || 'Upload completed successfully', }, ], }; }
  • Executes the core logic: runs `infracost upload --path <path>` CLI command and captures output/error.
    export async function executeUpload(options: UploadOptions): Promise<CommandResult> { try { const args = ['upload', '--path', resolve(options.path)]; const { stdout, stderr } = await execFileAsync('infracost', args, { maxBuffer: 10 * 1024 * 1024, }); return { success: true, output: stdout, error: stderr || undefined, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', }; } }
  • Zod schema defining input: path to Infracost JSON file.
    export const UploadSchema = z.object({ path: z.string().describe('Path to Infracost JSON file'), });
  • src/index.ts:719-722 (registration)
    Dispatch in CallToolRequest handler: parses args and calls tools.handleUpload.
    case 'infracost_upload': { const validatedArgs = UploadSchema.parse(args); return await tools.handleUpload(validatedArgs); }
  • src/index.ts:176-190 (registration)
    Tool specification returned by ListTools: name, description, input schema.
    { name: 'infracost_upload', description: 'Upload Infracost JSON output to Infracost Cloud for centralized cost tracking and reporting. Requires infracost CLI to be installed.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to Infracost JSON file to upload', }, }, required: ['path'], }, },

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/phildougherty/infracost_mcp'

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