Cloudflare MCP Skill
Interact with Cloudflare services via MCP: Workers, KV, R2, D1, Hyperdrive, Observability, Builds, Audit, Container Sandbox.
File-based Pipeline (Pass Paths Only)
When integrating troubleshooting/changes into multi-step workflows, persist all evidence and artifacts to disk, passing only paths between agents/sub-agents.
Recommended directory structure (within project):
runs/<workflow>/active/<run_id>/
- Input: (symptoms/objectives), (account/worker/resource/time_range, etc.)
- Evidence:
02-analysis/observability.md
, ,
- Plan: (write operation plan; must write here and await confirmation first)
- Output: (conclusion + evidence chain + tool call summary + next steps)
- Logs: (summary of each tool call)
Permission Tiers (Core Principles)
| Tier | Purpose | Tool Scope | Risk Control |
|---|
| Diagnose | Read-only/query/troubleshoot | Observability, Builds, Browser, Audit | Default entry point, no write operations |
| Change | Create/modify/delete resources | Workers Bindings (KV/R2/D1) | Requires user confirmation, post-execution verification |
| Super Admin | Highest privileges | All + Container Sandbox | Only in isolated environments/test accounts |
Tool Reference
Diagnose Tier (Read-only)
Observability
| Tool | Purpose |
|---|
query_worker_observability
| Query logs/metrics (events, CPU, error rate) |
| Discover available fields |
| Explore field values |
Builds
| Tool | Purpose |
|---|
workers_builds_list_builds
| List build history |
| Get build details |
workers_builds_get_build_logs
| Get build logs |
Browser Rendering (Page Capture)
| Tool | Purpose |
|---|
| Fetch page HTML |
| Convert to Markdown |
| Take page screenshot |
Audit Logs
| Tool | Purpose |
|---|
| Pull change history by time range |
Change Tier (Write Operations)
Account
| Tool | Purpose |
|---|
| List accounts |
| Set active account |
Builds (Settings)
| Tool | Purpose |
|---|
workers_builds_set_active_worker
| ⚠️ Set active worker (requires confirmation) |
KV
| Tool | Purpose |
|---|
| List namespaces |
| Get details |
| Create (⚠️ requires confirmation) |
| Update (⚠️ requires confirmation) |
| Delete (⚠️ requires confirmation) |
R2
| Tool | Purpose |
|---|
| List buckets |
| Get details |
| Create (⚠️ requires confirmation) |
| Delete (⚠️ requires confirmation) |
D1
| Tool | Purpose |
|---|
| List databases |
| Get details |
| Execute SQL |
| Create (⚠️ requires confirmation) |
| Delete (⚠️ requires confirmation) |
Hyperdrive
| Tool | Purpose |
|---|
| List configs |
| Get details |
| Create (⚠️ requires confirmation) |
| Edit (⚠️ requires confirmation) |
| Delete (⚠️ requires confirmation) |
Workers
| Tool | Purpose |
|---|
| List workers |
| Get worker details |
| Get source code |
Super Admin Tier (Container Sandbox)
| Tool | Purpose |
|---|
| Initialize container (~10 min lifecycle) |
| Execute command |
| Write file |
| Read file |
| List files |
| Delete file |
Container Notes: No persistent state, short lifespan, only for temporary tasks (running tests/reproducing issues/parsing data).
Security Rules (Must Follow)
Read Operations
- Define scope first: account / worker / resource ID
- No account? Run first
- Conclusions must have evidence chain: logs/screenshots/audit records
Write Operations (Three-step Flow)
1. Plan: Read current state first (list/get)
2. Confirm: Output precise change (name/ID/impact scope), await user confirmation
3. Execute: create/delete/update
4. Verify: audit logs + observability confirm no new errors
Prohibited Actions
- ❌ Execute create/delete/update without confirmation
- ❌ Delete production resources (unless user explicitly says "delete production xxx")
- ❌ Use Super Admin privileges in non-isolated environments
- ❌ Use container sandbox as persistent environment
Operation Workflows
Troubleshooting Flow (Typical)
1. Clarify symptoms → worker name/time range/error type
2. query_worker_observability to pull logs/metrics
3. If build-related → workers_builds_get_build_logs
4. If page-related → get_url_screenshot to reproduce
5. Trace changes → auditlogs_by_account_id
6. Summarize: root cause + evidence + fix recommendations
Resource Management Flow
1. accounts_list → set_active_account
2. List resources (kv_namespaces_list / r2_buckets_list / d1_databases_list)
3. Plan changes → present to user
4. Execute after confirmation
5. Verify: audit logs + observability shows no errors
Output Format
- Language: English
- Structure: Conclusion → Key data/evidence → Tool call summary → Next steps
- Write operations: Must clearly list operations to be executed and impact scope
Example output:
✅ Investigation complete: worker `api-gateway` experienced 5xx spike between 18:00-18:30
Root cause: New code deployed threw TypeError when processing /v2/users
Evidence:
- Logs: 18:02 first occurrence of "Cannot read property 'id' of undefined"
- Audit: 18:00 user dev@example.com deployed new version
- Metrics: error_rate jumped from 0.1% to 12%
Recommendation: Roll back to previous version, or fix /v2/users handler
Error Handling
| Situation | Action |
|---|
| Account not set | Run → first |
| Resource doesn't exist | Verify ID/name is correct, list available resources |
| Insufficient permissions | Explain required permissions, suggest checking API token scope |
| Observability query too long | Split into smaller time ranges, ask more specific questions |
Scenario Examples
See scenarios.md for 20 real-world development scenarios.