cloudflare/mcp
MCP server for the Cloudflare API
What it solves
This project provides a token-efficient way for AI agents to interact with the massive Cloudflare API (which contains over 2,500 endpoints). Traditionally, exposing every endpoint as a separate tool would consume millions of tokens of context, overwhelming the agent's prompt. This server allows agents to manage the entire API without leaking the full specification into the prompt.
How it works
Instead of listing every API endpoint as a tool, the server uses a "Code Mode" pattern. The agent is provided with a few high-level tools (search, execute, docs, and whoami) that allow it to write and run JavaScript code on the server to find the correct API endpoints and then execute the requests. The API specification lives on the server side, keeping the agent's context window clean.
Who it’s for
Developers and AI agent users who want to automate Cloudflare services (like Workers, KV, R2, D1, DNS, and Firewall) using an LLM-powered agent.
Highlights
- Extreme Token Efficiency: Reduces token cost from millions to approximately 1,100 tokens by moving the API spec to the server.
- Dynamic Execution: Agents can search the API spec and execute requests using JavaScript.
- Flexible Authentication: Supports both OAuth and API tokens (user and account tokens).
- Broad Product Support: Works across the entire Cloudflare ecosystem, including GraphQL Analytics API.
- Skills Integration: Serves Cloudflare skills (e.g., Wrangler, Durable Objects) via the MCP Skills extension.
Related
- Project
- Dispatch
- Project
- Project
- Project