# Cloudflare Workers MCP — Edge Functions for AI Agents > MCP server that gives AI agents access to Cloudflare Workers for deploying edge functions, managing KV storage, R2 buckets, and D1 databases. Build and deploy serverless code from chat. 1,500+ stars. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use Add to your `.mcp.json`: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["-y", "@cloudflare/mcp-server-cloudflare"], "env": { "CLOUDFLARE_API_TOKEN": "your-token" } } } } ``` Get your token at [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens). Restart Claude Code. --- ## Intro Cloudflare Workers MCP is a Model Context Protocol server that connects AI agents to the Cloudflare developer platform with 1,500+ GitHub stars. Deploy edge functions, manage KV key-value storage, R2 object storage, and D1 SQLite databases — all through natural language commands. Your AI agent can write, deploy, and manage serverless infrastructure without leaving the conversation. Best for developers using Cloudflare who want AI-assisted edge deployment. Works with: Claude Code, Cursor, any MCP client. Setup time: under 2 minutes. --- ## Available Tools ### Workers ``` "Deploy a new worker that returns the current time in JSON" "List all my deployed workers" "Show the code of my auth-worker" "Delete the old-api worker" ``` ### KV Storage ``` "Store user preferences in KV namespace 'settings'" "Read the value for key 'config:feature-flags'" "List all keys in the 'cache' namespace" ``` ### R2 Object Storage ``` "Upload this file to the 'assets' R2 bucket" "List all objects in the 'backups' bucket" "Generate a presigned URL for report.pdf" ``` ### D1 Database ``` "Create a D1 database called 'app-data'" "Run this SQL: CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)" "Query: SELECT * FROM users WHERE created_at > date('now', '-7 days')" ``` ## Use Cases ### Instant API Deployment ``` "Write a worker that proxies requests to our internal API with rate limiting, then deploy it" -> Agent writes the code, deploys to Cloudflare edge, returns the URL ``` ### Edge Data Management ``` "Store our feature flags in KV and create a worker endpoint to serve them" -> Agent creates KV entries and a worker that reads them ``` ### Key Stats - 1,500+ GitHub stars - Workers, KV, R2, D1 access - Deploy from conversation - 300+ edge locations globally - Official Cloudflare product ### FAQ **Q: What is Cloudflare Workers MCP?** A: An MCP server that gives AI agents access to Cloudflare Workers, KV, R2, and D1 for deploying and managing edge infrastructure via natural language. **Q: Is it free?** A: The MCP server is open-source. Cloudflare Workers free tier includes 100K requests/day. **Q: Can the agent deploy to production?** A: Yes, use separate API tokens with limited permissions for safety. --- ## Source & Thanks > Created by [Cloudflare](https://github.com/cloudflare). Licensed under MIT. > > [mcp-server-cloudflare](https://github.com/cloudflare/mcp-server-cloudflare) — stars 1,500+ --- ## Quick Start Add to `.mcp.json`: ```json { "mcpServers": { "cloudflare": { "command": "npx", "args": ["-y", "@cloudflare/mcp-server-cloudflare"], "env": { "CLOUDFLARE_API_TOKEN": "your-token" } } } } ``` --- ## Overview Cloudflare Workers MCP is the MCP server for Cloudflare's developer platform with 1,500+ GitHub stars. AI agents can deploy edge functions, manage KV storage, R2 object storage, and D1 databases. Best for developers using Cloudflare. --- ## Source & Thanks > Created by [Cloudflare](https://github.com/cloudflare). Licensed under MIT. --- Source: https://tokrepo.com/en/workflows/cloudflare-workers-mcp-edge-functions-ai-agents-d0283053 Author: Cloudflare