Cloudflare MCP Server
Connect AI models to the Cloudflare API and developer documentation through Cloudflare's managed remote MCP server.
Overview
The Cloudflare API MCP server is a managed remote MCP server that exposes the entire Cloudflare API β over 2,500 endpoints across DNS, Workers, R2, Zero Trust, and every other product β plus Cloudflare developer documentation.
It uses the search-and-execute Code Mode pattern: instead of registering a separate tool for every API endpoint, the model searches the API and writes JavaScript against a typed representation of the OpenAPI spec, which runs inside an isolated Dynamic Worker sandbox.
Official Server:
Developed and maintained by Cloudflare. The Streamable HTTP endpoint is https://mcp.cloudflare.com/mcp.
Key Features
Full Cloudflare API
Access over 2,500 endpoints across DNS, Workers, R2, Zero Trust, and every Cloudflare product.
Code Mode
Model-written JavaScript runs against a typed API client in a sandbox, using about 1,000 tokens instead of over a million.
Documentation Search
Search Cloudflare developer documentation alongside the API.
OAuth or API Token
Authorize with OAuth and scoped permissions, or pass a Cloudflare API token as a bearer token for automation.
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
search | Find API endpoints to call | API Discovery |
execute | Run JavaScript against the Cloudflare API | API Execution |
docs | Search Cloudflare developer documentation | Documentation |
Detailed Usage
searchβΆ
Searches the Cloudflare API for endpoints that match a task.
use_mcp_tool({
server_name: "cloudflare-api",
tool_name: "search",
arguments: {
query: "update DNS record"
}
});
executeβΆ
Runs JavaScript against the typed Cloudflare API client in an isolated Dynamic Worker sandbox.
use_mcp_tool({
server_name: "cloudflare-api",
tool_name: "execute",
arguments: {
code: "// JavaScript that calls the typed Cloudflare API client"
}
});
docsβΆ
Searches Cloudflare developer documentation.
use_mcp_tool({
server_name: "cloudflare-api",
tool_name: "docs",
arguments: {
query: "Workers KV"
}
});
Product-Specific Servers
Cloudflare also runs optional servers for targeted use cases. The main API server already covers the full API, so these are only needed for specific workflows.
| Server | Purpose | URL |
|---|---|---|
| Documentation | Search Cloudflare reference documentation | https://docs.mcp.cloudflare.com/mcp |
| Container | Spin up a sandbox development environment | https://containers.mcp.cloudflare.com/mcp |
| Browser Run | Fetch pages, convert to markdown, take screenshots | https://browser.mcp.cloudflare.com/mcp |
| Digital Experience Monitoring | Analyze critical applications for your organization | https://dex.mcp.cloudflare.com/mcp |
| Cloudflare One CASB | Identify SaaS security misconfigurations | https://casb.mcp.cloudflare.com/mcp |
| Agents SDK Documentation | Search the Agents SDK documentation | https://agents.cloudflare.com/mcp |
Installation
{
"mcpServers": {
"cloudflare-api": {
"url": "https://mcp.cloudflare.com/mcp"
}
}
}
For Claude Code, run claude mcp add --transport http cloudflare-api https://mcp.cloudflare.com/mcp.
When you connect, you are redirected to Cloudflare to authorize via OAuth and select the permissions to grant.
Client Compatibility:
Use Streamable HTTP. Historical /sse URLs are aliases for the same handler, but the deprecated HTTP+SSE transport is no longer served.
Common Use Cases
1. Manage DNS and Zones
Ask the agent to find and call the right API endpoints for records, zones, and settings:
use_mcp_tool({
server_name: "cloudflare-api",
tool_name: "search",
arguments: {
query: "create DNS record"
}
});
2. Automate Workers and Infrastructure
Use execute to script multi-step changes across Workers, R2, and other services in one sandboxed call.
3. Answer Product Questions from Docs
Search current Cloudflare documentation instead of relying on training data:
use_mcp_tool({
server_name: "cloudflare-api",
tool_name: "docs",
arguments: {
query: "Durable Objects alarms"
}
});
Security
- OAuth authorization lets you grant only the scopes the agent needs
- API tokens for automation should follow least privilege and be rotated regularly
- Model-written code runs in an isolated Dynamic Worker sandbox
- Review changes before granting write permissions
Limitations
- Uses the search-and-execute pattern rather than one native tool per endpoint
- Product-specific servers are optional and narrower than the main API server
- Some accounts and products require specific token permissions
Resources
Sources
Related Articles & Guides
Accessibility Scanner MCP Server
Accessibility Scanner MCP servers enable AI models to perform WCAG compliance checks, capture annotated screenshots, and generate detailed accessibility reports.
Auth0 MCP Server
Auth0 MCP server enables AI models to interact with Auth0 identity and access management, including applications, APIs, actions, logs, and forms.
AWS MCP Server
Interact with Amazon Web Services through your AI assistant using the AWS API MCP Server.