Cloudflare Connector
Connect PraisonAI agents to Cloudflare for Workers, DNS, KV, D1, and observability using Cloudflare's official remote MCP server
Connect your PraisonAI agents to Cloudflare to inspect Workers deployments, check observability logs, review KV/D1 resources, and diagnose edge issues through Cloudflare’s official remote MCP server.
| Setting | Value |
|---|---|
| Catalog ID | cloudflare |
| Endpoint | https://mcp.cloudflare.com/mcp |
| Transport | Streamable HTTP (Remote) |
| Authentication | OAuth 2.1 (browser or --manual) |
from praisonaiagents import Agent, MCP
agent = Agent(
name="Edge Ops Assistant",
instructions="Inspect Cloudflare Workers and logs concisely.",
tools=MCP(
"https://mcp.cloudflare.com/mcp",
oauth=True,
server_name="cloudflare",
approval="always",
),
)
agent.start("List my active Cloudflare Workers and highlight any recent errors")The user asks about edge service health; PraisonAI connects to Cloudflare via OAuth 2.1, inspects Workers and logs, and reports anomalies.
graph LR
User["👤 User"] --> Agent["🤖 PraisonAI Agent"]
Agent --> Auth["🔐 Cloudflare OAuth 2.1"]
Auth --> CF["☁️ Cloudflare Remote MCP<br/>mcp.cloudflare.com/mcp"]
CF --> Result["✅ Workers, DNS & Logs"]
classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
classDef auth fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef ok fill:#10B981,stroke:#7C90A0,color:#fff
class User input
class Agent agent
class Auth auth
class CF,Result okHow It Works
PraisonAI discovers Cloudflare’s OAuth 2.1 endpoints automatically, stores your token locally at 0600 in ~/.praisonai/mcp-auth.json, and exposes Cloudflare’s remote tools across Python, CLI, and Dashboard.
sequenceDiagram
participant User
participant CLI as praisonai CLI
participant CFAuth as Cloudflare OAuth 2.1
participant Store as mcp-auth.json
participant CFMCP as Cloudflare MCP Server
participant Agent as PraisonAI Agent
User->>CLI: praisonai connectors add cloudflare --auth
CLI->>CFAuth: Run OAuth 2.1 PKCE consent
CFAuth-->>User: Approve Cloudflare account access
CFAuth-->>Store: Save OAuth token (0600)
User->>Agent: Check Workers status and logs
Agent->>Store: Load cached token
Agent->>CFMCP: Call Cloudflare MCP tools
CFMCP-->>Agent: Worker metadata and metrics
Agent-->>User: Diagnostics summaryStep-by-Step Setup
- Prerequisites
- A Cloudflare account with Workers, Pages, DNS, or storage resources you want to manage
- Install PraisonAI with MCP support
bash pip install "praisonai[mcp]" - Add and authenticate Cloudflare
CLI (Interactive OAuth)
bash praisonai connectors add cloudflare --authHeadless / SSH (–manual)
bash praisonai connectors add cloudflare --auth --manualPraisonAI Dashboard
Enable catalog connectors in your PraisonAIUI
config.yaml:yaml mcp: enabled: true allow: catalog: trueRun
praisonai dashboard, open Connectors / MCP, and click Connect on Cloudflare. - Verify and list available tools
bash praisonai mcp sync cloudflare - Run your agent
python from praisonaiagents import Agent, MCP agent = Agent( name="Cloudflare Inspector", instructions="Inspect Cloudflare Workers and ask before making any configuration changes.", tools=MCP( "https://mcp.cloudflare.com/mcp", oauth=True, server_name="cloudflare", approval="always", ), ) agent.start("List all Cloudflare accounts and Workers I have access to")
Scope Tools for Safety
Common Workflows
- Worker Error Investigation:
"Check recent error logs for the api-gateway Worker and summarize the top failure codes." - Resource Inventory:
"List all D1 databases and KV namespaces in my staging Cloudflare account."
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized on praisonai connectors test cloudflare | connectors test does not attach stored OAuth tokens | Verify with praisonai mcp sync cloudflare |
| Multiple Cloudflare accounts returned | Account not specified in prompt | Mention the exact Cloudflare account name or ID in instructions |
| Browser callback times out over SSH | Loopback port unreachable remotely | Run praisonai connectors auth cloudflare --manual |
Best Practices
Pin staging vs production account IDs in instructions
Explicitly tell your agent which Cloudflare account ID is staging vs production so it never inspects or mutates the wrong environment.
Keep approval='always' on infrastructure connectors
Require human approval before any DNS, firewall, KV write, or Worker redeployment call executes.
Refresh tokens cleanly after role changes
Run praisonai connectors logout cloudflare --yes then praisonai connectors auth cloudflare whenever your Cloudflare account permissions change.