云成本优化工具

一个基于Cloudflare Workers的实验性MCP服务器,用于分析云成本CSV并提供AWS、GCP和Azure的可操作优化建议。

  • by sadesh123
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 sadesh123/Cloud-Cost-Explorer-MCP

使用说明

☁️ Cloud Cost Optimizer — MCP Server

An experimental MCP (Model Context Protocol) server built on Cloudflare Workers, designed to analyze cloud cost CSVs and provide actionable optimization recommendations for AWS — and later, GCP and Azure.

This repo accompanies the blog “Building Your First MCP Server”, showing how to deploy an MCP server, test it with MCP Inspector, and integrate it into ChatGPT.


Quick Start

1. Create project

npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
cd my-mcp-server
npm install
npm run dev

Then open http://localhost:5173, connect to
http://localhost:8787/sse

You should see:

  • cost-hello
  • cost-analyze-csv-url

Deploy to Cloudflare

npx wrangler login
npx wrangler deploy

Your server will be available at: https://your-worker.workers.dev/sse

You can now connect it to ChatGPT or any other MCP client.

Tools

cost-hello

A minimal MCP tool returning a greeting message and example structured output.
Used to verify the server’s JSON-RPC setup.

cost-analyze-csv-url

Fetches and analyzes a cloud cost CSV directly from a URL (no file upload).

  • Reads CSV from GitHub raw or S3
  • Parses it safely using forgiving logic
  • Aggregates spend by service
  • Produces structured JSON output with top services and recommendations
  • Displays a simple inline widget (cost-widget)

Key Implementation Details

  • Cloudflare Workers-compatible — no Node file I/O
    → uses fetch(url) for CSV retrieval
  • Forgiving CSV parsing — handles empty lines, extra commas, and quote mismatches
  • Dynamic UI widget (text/html+skybridge) for structured cost insights
  • SSE streaming via /sse