Blog · 2026-03-04

Cloudflare's New MCP Server: Manage Your Entire Infrastructure from Cursor

Cloudflare just shipped something that changes how vibe coders deploy and manage their apps: a single MCP server that gives AI agents access to their entire API — over 2,500 endpoints — using only 2 tools and ~1,000 tokens.

Instead of manually clicking through the Cloudflare dashboard to configure DNS, deploy Workers, manage D1 databases, or set up security rules, you can now do it all through natural language prompts in Cursor, Claude Code, or any MCP-compatible tool.

What is the Cloudflare MCP Server?

MCP (Model Context Protocol) is the standard way AI agents connect to external tools. Cloudflare's new MCP server uses a technique called Code Mode — instead of registering thousands of individual tools (one per API endpoint), it exposes just two:

  • search() — lets the AI explore Cloudflare's OpenAPI spec to find the right endpoints
  • execute() — lets the AI run code against the Cloudflare API
  • The AI writes JavaScript code that gets executed in a secure sandboxed Worker. This means your AI agent can discover what it needs and act on it, all within a single conversation.

    Why This Matters for Vibe Coders

    If you're building apps with Cursor, Lovable, or Bolt and deploying to Cloudflare, you probably spend time switching between your code editor and the Cloudflare dashboard. With the MCP server, you can:

  • Set up DNS records — "Add an A record pointing gptsters.com to my Worker"
  • Deploy Workers — "Deploy this function as a Cloudflare Worker"
  • Manage D1 databases — "Create a new D1 database and add these tables"
  • Configure security — "Enable DDoS protection and set up WAF rules"
  • Check analytics — "Show me traffic stats for the last 7 days"
  • All from within Cursor. No dashboard switching. No CLI commands. Just describe what you want.

    How to Set It Up

    Step 1: Add the MCP config

    Add this to your Cursor MCP settings (.cursor/mcp.json or global settings):

    json
    {
      "mcpServers": {
        "cloudflare-api": {
          "url": "https://mcp.cloudflare.com/mcp"
        }
      }
    }

    Step 2: Authenticate

    When you first use it, Cloudflare will redirect you to authorize and select which permissions to grant. You choose exactly what the AI can access — DNS only, Workers only, everything, etc.

    Step 3: Start prompting

    Open Cursor's chat and try:

  • "List all my Cloudflare zones"
  • "Add a CNAME record for www pointing to my-app.pages.dev"
  • "Show me the Workers deployed on my account"
  • "Create a D1 database called my-app-db"
  • The AI discovers the right API endpoints automatically and executes them.

    Real Example: Setting Up a New Project

    Here's what a typical vibe coding deploy flow looks like with the MCP server:

    You: "I just built a Next.js app. Set up Cloudflare for it: create a D1 database called my-saas-db, add DNS records for mysaas.com pointing to my Worker, and enable DDoS protection."

      The AI agent:
    • Calls search() to find the D1 creation endpoint
    • Calls execute() to create the database
    • Calls search() to find DNS record endpoints
    • Calls execute() to add the A/AAAA records
    • Calls search() to find DDoS protection endpoints
    • Calls execute() to enable DDoS rules

    Six tool calls. What used to take 15 minutes of dashboard clicking now takes 30 seconds of waiting.

    The Token Efficiency

    This is the technical breakthrough: a traditional MCP server for the Cloudflare API would need to register all 2,500+ endpoints as individual tools. That would consume 1.17 million tokens of context window — more than any AI model can handle.

    Code Mode reduces this to ~1,000 tokens. The AI discovers capabilities on-demand by searching the spec, rather than loading everything upfront. This means you can have the Cloudflare MCP alongside GitHub, Supabase, and other MCP servers without running out of context.

    What About Security?

    Good question. The MCP server:

  • Uses OAuth 2.1 — you explicitly approve which permissions the AI gets
  • Runs code in V8 sandboxed isolates — no file system access, no env var leaks
  • External fetches are disabled by default — the AI can only call the Cloudflare API
  • Follows the principle of least privilege — the agent only gets capabilities you granted
  • This is significantly safer than giving an AI your API token directly.

    Our Take

    We built gptsters.com on Cloudflare Workers with D1, and we've been managing DNS, deployments, and database migrations manually through the CLI. The MCP server would have saved us hours of setup time.

    For vibe coders deploying to Cloudflare, this is a no-brainer addition to your Cursor setup. The zero-config approach (just add the URL, authenticate, and go) means there's no reason not to try it.

    Bottom line: If you're already using Cursor or Claude Code for building apps, add the Cloudflare MCP server. It turns deployment and infrastructure management from a separate task into part of your natural coding conversation.

    Further Reading

  • Set up your vibe coding environment
  • How to deploy to Cloudflare Workers
  • Compare AI coding tools
  • Cloudflare's blog post on Code Mode
  • Related