☁️ 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 devThen open http://localhost:5173, connect to http://localhost:8787/sse
You should see:
cost-hellocost-analyze-csv-url
Deploy to Cloudflare
npx wrangler login
npx wrangler deployYour 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
