skills/cloudflare-mcp-setup/SKILL.md
One-time setup of the Cloudflare agent surface for Claude Code on a fresh machine. Wires the cloudflare-api MCP (Code Mode, bearer token from .env), the bundled cloudflare/skills plugin (skills + slash commands + 4 product MCPs), and OAuths the cloudflare-observability MCP for log queries. Idempotent. Use when onboarding a new machine, when cloudflare-api MCP is missing, or after running /ro:cloudflare-setup for the first time.
npx skillsauth add RonanCodes/ronan-skills cloudflare-mcp-setupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Wires the full Cloudflare agent surface in three lanes: knowledge (skills), capability (Code Mode), and logs (observability). Run when:
claude mcp list does not include cloudflare-apiToolSearch/ro:cloudflare-setup just succeeded for the first time and you want the agent surface tooThis skill is the second step for a fresh machine. Run /ro:cloudflare-setup first to mint the API tokens; this skill assumes CLOUDFLARE_API_TOKEN already exists in ~/.claude/.env.
/ro:cloudflare-mcp-setup # full interactive setup
/ro:cloudflare-mcp-setup --verify # list which CF MCPs are connected + auth status
/ro:cloudflare-mcp-setup --smoke-test <worker> # skip install, just verify against a named worker
/ro:cloudflare-mcp-setup --include-bindings-builds # also OAuth bindings + builds MCPs (default skips)
This is the same model documented in the golden-stack canon at [[ai-agent-stack]] § Layer 8.
| Lane | What it gives you | Mechanism | Auth |
|------|-------------------|-----------|------|
| 1. Knowledge | 10 contextual cloudflare:* skills auto-loaded by context, plus 2 slash commands | Markdown context, no API calls | None |
| 2. Capability (full CRUD) | 2,500+ CF API endpoints in 2 tools (~1K tokens) via Code Mode | Agent writes JS against typed SDK, executes in CF sandbox | Bearer token from ~/.claude/.env |
| 3. Capability (logs/metrics) | Workers Observability queries | Dedicated MCP per product surface | OAuth (separate scope) |
Knowledge and the two capability lanes compose; you do not have to pick one.
Before doing anything, verify:
# 1. Check token exists in env
grep -E '^CLOUDFLARE_API_TOKEN=' ~/.claude/.env | head -1
# Expected: a non-empty value. If missing, run /ro:cloudflare-setup first.
# 2. Check the manual MCP is not already wired
claude mcp list 2>&1 | grep -E '^cloudflare-api:'
# If "✓ Connected" appears, skip Step 1.
# 3. Check the plugin is not already installed
ls ~/.claude/plugins/cache/cloudflare/ 2>/dev/null
# If non-empty, skip Step 2.
Adds the MCP at user scope so it's available in every project. Reuses the existing token (the same one wrangler and /ro:cf-ship already use). No new token needed.
# Source .env in a subshell to expand $CLOUDFLARE_API_TOKEN at shell-time only
# (the token value never appears in the tool output)
. ~/.claude/.env && claude mcp add --transport http -s user cloudflare-api \
https://mcp.cloudflare.com/mcp \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
Verify:
claude mcp list 2>&1 | grep cloudflare-api
# Expected: cloudflare-api: https://mcp.cloudflare.com/mcp (HTTP) - ✓ Connected
Security note.
claude mcp get cloudflare-apiwill print the bearer token in plaintext. Avoid running it in a screen-sharing session. To rotate the token: regenerate atdash.cloudflare.com/profile/api-tokens, update~/.claude/.env, thenclaude mcp remove cloudflare-api -s userand re-run Step 1.
The plugin bundles 10 skills, 2 slash commands, and 4 product-specific MCPs (cloudflare-docs, cloudflare-bindings, cloudflare-builds, cloudflare-observability). Slash commands cannot be triggered by a tool call, so the user has to type these in Claude Code:
/plugin marketplace add cloudflare/skills
/plugin install cloudflare@cloudflare
Expected output:
✓ Successfully added marketplace: cloudflare
✓ Installed cloudflare. Run /reload-plugins to apply.
Verify the plugin landed:
ls ~/.claude/plugins/cache/cloudflare/cloudflare/
# Expected: a versioned subdirectory like 1.0.0/
MCPs added or installed mid-session connect immediately but their tool schemas do not surface in ToolSearch until next session start. Adding three new MCPs from the plugin compounds this. Restart now:
exit
claude
After restart, ToolSearch should find tools matching mcp__cloudflare-api__* and mcp__plugin_cloudflare_cloudflare-docs__*. The OAuth-required MCPs (bindings, builds, observability) will show up as mcp__plugin_cloudflare_<name>__authenticate until you complete the OAuth flow.
Workers Observability sits on a separate API scope, so even though the bearer token is good for everything else it cannot read logs. The observability MCP handles this via OAuth.
The agent calls mcp__plugin_cloudflare_cloudflare-observability__authenticate which returns a URL. Open it:
# Agent will produce the URL; on macOS, this opens the browser:
open "<authorization-url-from-the-tool-result>"
Click "Authorize" on the page. The browser redirects to localhost:<port>/callback and the OAuth listener inside Claude Code completes the flow. The MCP's tools (query_worker_observability, observability_keys, workers_list, etc.) become available in the next ToolSearch query.
Fallback if the redirect page errors out (connection refused, blank page): copy the full URL from the address bar of the failed redirect tab and pass it to mcp__plugin_cloudflare_cloudflare-observability__complete_authentication with the callback_url param.
Defaulted to skip because:
cloudflare-bindings is redundant with the cloudflare-api MCP via Code Mode for D1/KV/R2 CRUDcloudflare-builds is only useful if you deploy via Workers Builds (CI inside CF) instead of wrangler from local or GitHub ActionsPass --include-bindings-builds to OAuth them anyway. Same flow as Step 4.
Verify the setup against a real worker (use --smoke-test <worker-name> to jump straight here on subsequent runs).
The agent runs four checks in order, all using mcp__cloudflare-api__execute:
MCP_SMOKE_TEST plain_text var, verify it landed, remove it, verify it's goneThen one check via observability:
Pass criteria: all 5 return without auth errors. Record the worker name and timestamp; if the same worker passes a future re-run after a token rotation, the rotation worked.
Reference smoke test that ran successfully on 2026-04-26 against connections-helper:
| Check | MCP | Auth | Result | |---|---|---|---| | Worker metadata | cloudflare-api | bearer | ✅ | | Deployments list | cloudflare-api | bearer | ✅ | | Settings + bindings | cloudflare-api | bearer | ✅ | | Code Mode write round-trip | cloudflare-api | bearer | ✅ | | Logs / observability query | cloudflare-observability | OAuth | ✅ |
If this is the first time this machine has been wired up, the decision is already in canon at [[ai-agent-stack]] § Layer 8. No /stack-update call needed unless a step here changed (e.g. CF added a new MCP, or the install command changed).
If something HAS changed, run:
/stack-update "noted change in CF MCP setup: <one-line>"
The skill auto-routes to ai-agent-stack.md based on mcp + cloudflare keywords.
/ro:cloudflare-setup (that mints the API tokens; this skill assumes they exist)/ro:cf-ship for deploys (that encodes the pre-flight checklist; this skill is for ad-hoc agent ops)wrangler (still the canonical Workers CLI)~/.claude/.env (no new env vars; reuses existing CLOUDFLARE_API_TOKEN)--verify)Lists every CF-related MCP and its auth status. Useful as a health check after machine setup or after a Claude Code update:
claude mcp list 2>&1 | grep -iE 'cloudflare|^plugin:cloudflare'
Expected post-setup state:
plugin:cloudflare:cloudflare-docs: https://docs.mcp.cloudflare.com/mcp (HTTP) - ✓ Connected
plugin:cloudflare:cloudflare-bindings: https://bindings.mcp.cloudflare.com/mcp (HTTP) - ! Needs authentication
plugin:cloudflare:cloudflare-builds: https://builds.mcp.cloudflare.com/mcp (HTTP) - ! Needs authentication
plugin:cloudflare:cloudflare-observability: https://observability.mcp.cloudflare.com/mcp (HTTP) - ✓ Connected
cloudflare-api: https://mcp.cloudflare.com/mcp (HTTP) - ✓ Connected
(Bindings + builds showing "Needs authentication" is expected and fine; they're deferred.)
| Symptom | Likely cause | Fix |
|---|---|---|
| claude mcp add fails: command not found | Claude Code CLI not on PATH | Reinstall Claude Code; verify which claude |
| cloudflare-api: ... ! Needs authentication after Step 1 | Token expired or wrong scope | Rotate token in CF dashboard; update .env; re-run Step 1 |
| mcp__cloudflare-api__execute returns 10000: Authentication error on the observability endpoint specifically | Bearer token lacks Workers Observability scope (this is expected) | Use the cloudflare-observability MCP (Step 4) for log queries; do not broaden the bearer token |
| Tools not in ToolSearch after restart | MCP connected but Claude Code's deferred-tool registry was cached | Force-restart: pkill -f claude-code then claude |
| OAuth tab shows "connection refused" after authorize | Claude Code's local OAuth listener wasn't up | Use the complete_authentication tool fallback (Step 4) |
| Plugin install prompt: marketplace not found | /plugin marketplace add step skipped | Re-run Step 2's first command |
claude mcp get cloudflare-api in a recorded or screen-shared session. It prints the token in plaintext.cloudflare/skills plugin via npx skills add. The Claude Code marketplace flow (/plugin marketplace add) is the canonical path; the npx flow puts files in a different directory and bypasses plugin lifecycle hooks.[[ai-agent-stack]] § Layer 8 in llm-wiki-researchconnections-helperdevelopment
--- name: worktree description: Coordinate multiple agents on one repo via a worktree-lock pool, so two agents never clobber each other's working tree. Acquire the first free slot (main, then beta/gamma… worktrees, created on demand), work there on your own branch, release when you've pushed. Use before modifying any repo that might be in use by another agent (factory, dataforce, etc.), or whenever you're told a repo is being worked on. Backed by `ro worktree`. category: development argument-hin
testing
--- name: ship description: Ship a feature branch the local-CI-first way — run the full local gate, push, open a PR, squash-merge, then deploy, without waiting on GitHub Actions. Use when a branch is ready for main and you want it merged and deployed now. Reads CI policy from `ro ci` (default skips remote CI because GitHub Actions billing keeps hitting limits). Sibling to /ro:gh-ship (waits on GitHub checks) and /ro:cf-ship (the deploy half). Triggers on "ship it", "ship this", "merge and deploy
testing
--- name: setup-logging description: Set up (or audit) the observability stack in a TanStack Start + Cloudflare Workers app so it is "diagnosable by default" — structured logging (logtape) with a request context carrying trace_id + userId + tenant/orgId, a trace_id propagated FE→BE→logs→Sentry→PostHog, Cloudflare Workers observability enabled, and Sentry + PostHog wired. Two modes: `setup` (wire it into an app) and `audit` (check an existing app + report gaps). Use when scaffolding a new app, wh
development
Manage credentials INSIDE the active ~/.claude/.env file — read which token/account to use for a given app (Simplicity vs Dataforce vs Ronan-personal), add or update a secret WITHOUT it passing through the chat (an interactive Terminal window prompts for it), and track secrets that were exposed in a transcript so they get rotated. Sibling to /ro:context (which switches WHICH env file is active). Use when the user wants to add an API key/token/secret, asks "which credential do I use for X", needs the env organized/labelled, or a secret was pasted into the chat and should be rotated.