Cloudflare MCP Gateway
A centralized MCP (Model Context Protocol) gateway that aggregates multiple Cloudflare MCP services into a single unified server. Configure which services you need via environment variables and access them all through one MCP connection.
Features
- Unified Access: Single MCP server for multiple Cloudflare services
- Configurable Services: Enable only the services you need via
ENABLED_SERVICES - Dual Transport Support: Works with both stdio (Claude Desktop) and streamable HTTP (web clients)
- Tool Namespacing: Automatic prefixing prevents tool name collisions (e.g.,
bindings_kv_get,radar_scan) - Graceful Degradation: Continues operating if some upstream services are unavailable
Supported Services
| Service ID | Name | Description |
|---|---|---|
docs |
Documentation | Get up to date reference information on Cloudflare |
bindings |
Workers Bindings | Build Workers applications with storage, AI, and compute primitives |
builds |
Workers Builds | Get insights and manage your Cloudflare Workers Builds |
observability |
Observability | Debug and get insight into your application's logs and analytics |
radar |
Radar | Get global Internet traffic insights, trends, URL scans, and other utilities |
containers |
Containers | Spin up a sandbox development environment |
browser |
Browser Rendering | Fetch web pages, convert them to markdown and take screenshots |
logpush |
Logpush | Get quick summaries for Logpush job health |
ai-gateway |
AI Gateway | Search your logs, get details about the prompts and responses |
autorag |
AutoRAG | List and search documents on your AutoRAGs |
auditlogs |
Audit Logs | Query audit logs and generate reports for review |
dns-analytics |
DNS Analytics | Optimize DNS performance and debug issues based on current set up |
dex |
Digital Experience Monitoring | Get quick insight on critical applications for your organization |
casb |
CASB | Quickly identify any security misconfigurations for SaaS applications |
graphql |
GraphQL Analytics | Get analytics data using Cloudflare's GraphQL API |
Installation
# Using pip
pip install cf-mcp-gateway
# Using uv
uv pip install cf-mcp-gateway
Quick Start
1. Get Cloudflare Credentials
You'll need:
- API Token: Create one at Cloudflare Dashboard
- Account ID: Found in your Cloudflare dashboard URL or account settings
2. Configure Environment
Create a .env file or set environment variables:
# Required
CLOUDFLARE_API_TOKEN=your-api-token
CLOUDFLARE_ACCOUNT_ID=your-account-id
ENABLED_SERVICES=docs,bindings,observability
# Optional
TRANSPORT=stdio # or streamable-http
LOG_LEVEL=info
3. Run the Gateway
# Using the CLI
cf-mcp-gateway
# Or as a Python module
python -m cf_mcp_gateway
Usage with MCP Clients
Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"cloudflare": {
"command": "python",
"args": ["-m", "cf_mcp_gateway"],
"env": {
"CLOUDFLARE_API_TOKEN": "your-api-token",
"CLOUDFLARE_ACCOUNT_ID": "your-account-id",
"ENABLED_SERVICES": "docs,bindings,observability,radar",
"TRANSPORT": "stdio"
}
}
}
}
Cursor
Add to your Cursor MCP settings:
{
"mcpServers": {
"cloudflare": {
"command": "cf-mcp-gateway",
"env": {
"CLOUDFLARE_API_TOKEN": "your-api-token",
"CLOUDFLARE_ACCOUNT_ID": "your-account-id",
"ENABLED_SERVICES": "docs,bindings,observability"
}
}
}
}
Streamable HTTP (Remote/Web Access)
Start the gateway with HTTP transport:
CLOUDFLARE_API_TOKEN=xxx \
CLOUDFLARE_ACCOUNT_ID=yyy \
ENABLED_SERVICES=docs,bindings,radar \
TRANSPORT=streamable-http \
GATEWAY_HOST=0.0.0.0 \
GATEWAY_PORT=3000 \
cf-mcp-gateway
The server exposes:
POST /mcp- MCP JSON-RPC endpointGET /health- Health check endpoint
Configuration Reference
Required Environment Variables
| Variable | Description |
|---|---|
CLOUDFLARE_API_TOKEN |
Your Cloudflare API token |
CLOUDFLARE_ACCOUNT_ID |
Your Cloudflare account ID |
ENABLED_SERVICES |
Comma-separated list of service IDs to enable |
Optional Environment Variables
| Variable | Default | Description |
|---|---|---|
TRANSPORT |
stdio |
Transport mode: stdio or streamable-http |
GATEWAY_HOST |
0.0.0.0 |
HTTP bind host (streamable-http only) |
GATEWAY_PORT |
3000 |
HTTP port (streamable-http only) |
LOG_LEVEL |
info |
Logging level: debug, info, warning, error |
Tool Naming Convention
Tools from upstream services are prefixed with their service ID to avoid collisions:
bindings_kv_get- Get value from KVbindings_kv_put- Put value to KVbindings_r2_list- List R2 objectsradar_url_scan- Scan a URLdocs_search- Search Cloudflare documentation
Architecture
┌─────────────────┐ ┌─────────────────────────────────┐
│ MCP Client │────▶│ Cloudflare MCP Gateway │
│ (Claude, etc.) │ │ │
└─────────────────┘ │ ┌─────────────────────────┐ │
│ │ Tool Aggregator │ │
│ │ - Namespacing │ │
│ │ - Request routing │ │
│ └─────────────────────────┘ │
└──────────────┬──────────────────┘
│
┌─────────────┬─────────────┬─────┴─────┬─────────────┬─────────────┐
▼ ▼ ▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ docs │ │bindings │ │ radar │ │ builds │ │ logpush │ │ ... │
└─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘
License
MIT License - see LICENSE file for details.
Metadata
Release files for cf-mcp-gateway 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cf_mcp_gateway-1.0.0.tar.gz | 9.2 kB | Without provenance | Details for cf_mcp_gateway-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cf_mcp_gateway-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cf_mcp_gateway-1.0.0-py3-none-any.whl |
Total release size: 22.0 kB
Release files / cf_mcp_gateway-1.0.0.tar.gz
| Download URL | cf_mcp_gateway-1.0.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54974739b2f41d79a2b10c9cdb856338a5462509fda460425026a6c6bc487b26
|
|
BLAKE2b-256 checksum How to use checksums |
5caaaebb7ffd555ce3e72af7c28dde37d9307da71e5ab48f90a473a5d4cfd5e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / cf_mcp_gateway-1.0.0-py3-none-any.whl
| Download URL | cf_mcp_gateway-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cdfe91b19b4961e1c6f3e539eb7b78e1c1ca992482e446ab6a232299630b71d
|
|
BLAKE2b-256 checksum How to use checksums |
83ef5845864eff86ece0eac0c007a2d4f9abef68de52917485682a7bdbfee1e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for cf-mcp-gateway 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.