Menu

AI

Cloudflare MCP Server: Tools, Setup and Security

How Cloudflare's MCP server covers its whole API with four tools using Code Mode, how to connect with OAuth or an API token, and what to lock down first.

By: Irina ShvayaOctober 28, 2026

Cloudflare MCP Server: Tools, Setup and Security

This profile is part of our MCP server directory, within The MCP Guide. Profiles are checked against each vendor's own documentation. Need a server built? See MCP development.

The Cloudflare MCP server lets an AI agent search and call the entire Cloudflare API, from DNS records and Workers to R2, KV and Zero Trust settings. Cloudflare publishes and hosts it at https://mcp.cloudflare.com/mcp.

Checked against: Cloudflare's MCP servers documentation on 28 October 2026. eSEOspace did not install or test this server.

Key Takeaways

  • One remote server covers the whole Cloudflare API with four tools: docs, search, execute and whoami.
  • Cloudflare's "Code Mode" has the agent write JavaScript against the API spec. Cloudflare says this uses about 1,000 tokens however many endpoints exist.
  • You sign in with OAuth and pick permissions, or pass a Cloudflare API token as a bearer token.
  • Smaller product-specific servers exist for docs, containers, Browser Run and more. Several older ones are deprecated.
  • Cloudflare's docs page does not list a separate MCP price.

At a glance

ItemDetail
PublisherCloudflare
Official?Yes
HostingRemote: https://mcp.cloudflare.com/mcp
TransportStreamable HTTP
Sign-inOAuth (recommended) or API token
Read or writeBoth. Limited by the permissions you grant
PriceNo separate MCP price listed
Source codecloudflare/mcp on GitHub
StatusNot labeled preview or GA

What it can do

The cloudflare/mcp README lists four tools:

ToolWhat it does
docsSearches Cloudflare developer documentation
searchRuns JavaScript against the API spec to find endpoints
executeRuns JavaScript that calls cloudflare.request() on those endpoints
whoamiReturns the user or account the connection is signed in as

Cloudflare says this covers "2500 endpoints in 1k tokens." The README names Workers, KV, R2, D1, Pages, DNS, Firewall, Load Balancers, Stream, Images, AI Gateway, Vectorize, Access and Gateway among supported products. The execute tool also handles the GraphQL Analytics API.

Example requests from the README include "List all my Workers" and "Add an A record for api.example.com pointing to 192.0.2.1."

You can turn Code Mode off with ?codemode=false. The server then registers one tool per endpoint, such as get_workers_scripts. Cloudflare warns this raises the token cost to about 244,000 tokens.

The server also serves Cloudflare's skills (Wrangler, Durable Objects, Agents SDK and more) through the MCP Skills extension. See Skills over MCP for how that works.

Cloudflare's docs list optional product servers too, including a Documentation server (https://docs.mcp.cloudflare.com/mcp), Container server, Browser Run server, Digital Experience Monitoring server and Cloudflare One CASB server. The mcp-server-cloudflare repository marks older servers such as Observability, Radar and Workers Builds as deprecated.

How to connect it

OAuth (recommended). Add the URL to your client. Cloudflare redirects you to authorize and choose permissions. The README's sample config:

{
  "mcpServers": {
    "cloudflare-api": {
      "type": "http",
      "url": "https://mcp.cloudflare.com/mcp"
    }
  }
}

API token. For CI/CD or automation, create a Cloudflare API token and send it as a bearer token with the same URL. User tokens and account tokens both work. For account tokens, Cloudflare says to include "Account Resources : Read" so the server can find your account ID. Tokens with Client IP Address Filtering are not supported yet.

Cloudflare's AI Playground also accepts server URLs.

Security notes

  • Grant only what you need. OAuth asks you to select permissions. If a call needs a scope you skipped, the server asks the client to re-authorize with that scope added. Clients that follow the spec get a 403 insufficient_scope challenge.
  • The agent writes code. In Code Mode the agent writes and runs JavaScript against your account. Cloudflare runs that code in isolated Workers, but the API calls still act on real resources.
  • Results are capped. search and execute results are cut at about 6,000 tokens by default, with cuts marked --- TRUNCATED ---. Passing truncate: false removes the cap, so only do that when output goes to a file.
  • Old URLs fail closed. On the product-specific servers, the retired /sse URLs now return 410 Gone.

Use a scoped API token, not a global key, for automation. Read about secret leakage in MCP and the MCP security hub. Teams on Cloudflare Zero Trust can also put servers behind an MCP gateway.

Alternatives

Next step

Start with OAuth and the smallest set of permissions your task needs, such as DNS read for one zone. Our MCP readiness audit can map the right scopes for your team. Browse more profiles in the server directory.

Frequently asked questions

Do I need more than one Cloudflare MCP server?

Usually not. Cloudflare's docs say the main server "is the only MCP server you need to work with Cloudflare." Product servers are optional for focused, typed tools.

What is Code Mode?

It is Cloudflare's pattern where the agent writes code to search the API spec and make calls, instead of loading one tool per endpoint. Cloudflare says this keeps context use near 1,000 tokens.

Can I use the Cloudflare MCP server in CI/CD?

Yes. Cloudflare documents passing an API token as a bearer token for automation. Tokens with IP address filtering are not supported yet.

Does the Cloudflare MCP server cost extra?

Cloudflare's MCP docs page makes no pricing or plan statement. Normal charges for the Cloudflare products you use still apply.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.