cloudflare-mcp
Provides comprehensive integration with the Cloudflare ecosystem, offering tools for DNS management, CDN cache purging, Workers compute, KV storage, D1 SQL databases, R2 object storage, Vectorize vector database, AI inference, Zero Trust tunnels, WAF rules, and Radar analytics.
Enables management of Cloudflare Workers, including deploying and querying serverless functions, interacting with KV namespaces, and executing D1 SQL queries.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cloudflare-mcplist my Cloudflare zones"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cloudflare-mcp v1.0.0
Universal Model Context Protocol (MCP) server for the complete Cloudflare ecosystem. Replaces 16 fragmented remote MCP endpoints with a single, high-performance local server.
Features (7 Unified Tools)
cf_dns: Zones, DNS records (A, CNAME, TXT, MX, etc.), CDN cache purgingcf_compute: Cloudflare Workers, KV Key-Value storage, serverless D1 SQL database executioncf_storage: R2 Object Storage buckets, Vectorize vector database queriescf_ai: Workers AI inference (Llama, DeepSeek, Embeddings), AI Gateway logs and telemetrycf_security: Zero Trust Tunnels (cloudflared), WAF firewall rules, Audit logscf_radar: Radar URL scanner, global traffic/attack analytics, GraphQL queriescf_api: Universal REST API gateway (access any of the 2,500+ Cloudflare endpoints directly)
Related MCP server: mcp-server-cloudflare
Configuration
Set your Cloudflare API Token in your environment or store it in ~/.secrets/cloudflare-token.txt:
export CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"
export CLOUDFLARE_ACCOUNT_ID="your-account-id" # Optional, automatically discovered if omittedInstallation in MCP Clients (Claude Desktop, OpenCode, Cursor, Windsurf)
Option 1: Instant via uvx (Recommended)
{
"mcpServers": {
"cloudflare": {
"command": "uvx",
"args": ["--from", "git+https://github.com/Steph-ux/cloudflare-mcp.git", "cloudflare-mcp"]
}
}
}Option 2: Via pip install
pip install git+https://github.com/Steph-ux/cloudflare-mcp.gitThen in your MCP config:
{
"mcpServers": {
"cloudflare": {
"command": "cloudflare-mcp"
}
}
}Option 3: Local Clone (Development)
{
"mcpServers": {
"cloudflare": {
"command": "python",
"args": ["D:\\Steph\\script\\cloudflare-mcp\\server.py"]
}
}
}Usage Examples
1. DNS Management
# List zones:
cf_dns(action='list_zones')
# Create DNS record:
cf_dns(
action='create_record',
zone_id='example.com',
type='A',
name='api',
content='192.168.10.1',
proxied=True
)
# Purge CDN cache:
cf_dns(action='purge_cache', zone_id='example.com', purge_everything=True)2. D1 SQL Database & Workers
# Query D1 SQL database:
cf_compute(
action='d1_query',
database_id='YOUR_D1_DATABASE_ID',
sql='SELECT * FROM users WHERE active = 1 LIMIT 10;'
)
# Store key-value in KV:
cf_compute(
action='kv_put',
namespace_id='YOUR_KV_NAMESPACE_ID',
key_name='session_token',
value='xyz123'
)3. R2 Object Storage
# List buckets:
cf_storage(action='list_r2')
# Create bucket:
cf_storage(action='create_r2', bucket_name='my-app-assets', location_hint='weur')4. Workers AI Inference
# Run Llama 3 on Cloudflare edge:
cf_ai(
action='run_model',
model='@cf/meta/llama-3.1-8b-instruct',
prompt='Write a python snippet for async retry logic.'
)5. Radar URL Scan & Security
# Scan URL for malware & phishing via Cloudflare Radar:
cf_radar(action='scan_url', url='https://target-to-scan.com')
# List active Zero Trust Tunnels:
cf_security(action='list_tunnels')6. Universal REST Gateway (cf_api)
# Call any specific Cloudflare v4 REST endpoint:
cf_api(method='GET', path='/user')Testing
pytest testsLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloudflare Workers MCP server: api-composition-gateway
Cloudflare Workers MCP server: api-landing
Cloudflare Workers MCP server: ai-gateway
Related MCP Servers
AlicenseAqualityAmaintenanceLets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things on your Cloudflare account.21,381 npm4,208Apache 2.0- AlicenseAqualityDmaintenanceMCP server to manage Cloudflare Workers, KV, R2, Pages, DNS, and cache from your IDE.1347 npm4MIT
- FlicenseNot gradedqualityDmaintenanceEnables managing Cloudflare domains, DNS records, SSL certificates, zone operations, analytics, and cache purging via MCP or CLI.9 npm-
- AlicenseBqualityBmaintenanceA local stdio MCP server that provides 69 tools for Cloudflare REST API v4, including DNS, Zones, Workers, KV, R2, D1, Pages, Queues, Tunnels, SSL, WAF, Email Routing, Logpush and Workers AI, authenticated by a single API token.6947 npm2MIT