---
name: cloudflare
description: Work on Cloudflare through its MCP server, Wrangler or dashboard steps - add a domain, DNS records, zone settings (HTTPS, HSTS, TLS), DNSSEC, redirects, Workers and their custom domains, deploy tokens. Use for DNS, hosting or registrar work on Cloudflare, or when another skill hands over a Cloudflare job.
---

# Cloudflare

Roles: DNS, hosting (Workers serve sites and code), and registrar for domains bought at Cloudflare.

Cloudflare's dashboard and API change. When you can browse, check developers.cloudflare.com before a step you're unsure of. When you can't, go with what you know, say so, and check each screen with the person.

## Connect

Pick the first way that works for the person:

1. **Cloudflare's MCP server**, if the agent supports MCP: name `cloudflare`, address `https://mcp.cloudflare.com/mcp`, connected the way the `setup-tools` skill describes for the agent in use. Cloudflare's Claude Code plugin includes the same server. Check: its `whoami` tool answers with their account. Ask for the permissions in [Sign-in permissions](#sign-in-permissions) below, no more and no fewer.
2. **Wrangler**, Cloudflare's command-line tool, for Workers only: it can't change DNS or zone settings. Needs Node 22.12 or newer (`setup-tools`). Run it pinned, `npx --yes wrangler@4.164.0 COMMAND`. Before the person agrees, tell them: `login` opens the browser and gives Wrangler wide access to their account, kept on their machine until `logout`; `npx` downloads Wrangler and about ninety packages and runs their install scripts. Check: `whoami` shows the account ID they expect. End with `logout`.
3. **The dashboard**, dash.cloudflare.com: the person clicks, you give the clicks one per line and check the result from outside (`dig`, `curl`).

## Sign-in permissions

The MCP server signs in with OAuth, and what it can do depends on what the sign-in asks for. Asking for everything fails: Cloudflare refuses the request. Asking for nothing gets its defaults, which can only read the account. Ask for exactly these:

| Permission | Scopes | Used for |
|---|---|---|
| Account and user, read | `account:read`, `user:read` | finding the account and its ID |
| Zones | `zone.read`, `zone.write` | adding the domain, DNSSEC |
| DNS | `dns.read`, `dns.write` | reading and changing records |
| Zone settings | `zone-settings.read`, `zone-settings.write` | HTTPS, minimum TLS, HSTS |
| SSL and certificates | `ssl-and-certificates.read`, `ssl-and-certificates.write` | checking the certificate, retrying its validation |
| Redirects | `dynamic-redirect.read`, `dynamic-redirect.write` | redirecting one name to another |
| Workers scripts and routes | `workers-scripts.read`, `workers-scripts.write`, `workers-routes.read`, `workers-routes.write` | creating the Worker and attaching the domain |
| Offline access | `offline_access` | staying signed in between sessions |

How to ask for them depends on the agent. Where its login takes scopes, pass them; in Codex (the app, CLI and IDE extension share the setting):

```bash
codex mcp login cloudflare --scopes offline_access,user:read,account:read,zone.read,zone.write,dns.read,dns.write,zone-settings.read,zone-settings.write,ssl-and-certificates.read,ssl-and-certificates.write,dynamic-redirect.read,dynamic-redirect.write,workers-scripts.read,workers-scripts.write,workers-routes.read,workers-routes.write
```

Elsewhere, the person picks them on Cloudflare's consent screen. Afterwards, check: a read of the zones list works, and the tool list includes the write tools. If a call fails for lack of permission, sign in again with the missing scope rather than working around it; some agents then show the connection as "expired" when it is only short of a permission.

Two things this sign-in can't do: read API tokens (so the deploy token's permissions and end date come from the person), and turn off Web Analytics (a dashboard step in [zone.md](zone.md)).

Before the person signs in, tell them plainly:

- These permissions cover every domain and Worker in the account, not only this one. You'll use them for this domain only, show each change first, and make it on their yes.
- The sign-in lasts until it's revoked. When the work is done they can remove the server from the agent, and revoke the connection at Cloudflare (look up where; the dashboard moves).
- If they'd rather not grant write access, the dashboard way works for every job: they click, you check.

If they ask what a permission is for, answer from the table.

With the MCP server: show the person each change, make it on their yes, then read it back. The account ID comes from `GET /accounts`, the zone ID from `GET /zones?name=DOMAIN`.

API tokens are made by the person in the dashboard, never by you: a token you create comes back to you in plain text and stays in the conversation and its logs.

## Jobs

- [workers.md](workers.md): create a Worker, attach a domain to it, turn off its `workers.dev` address, make a deploy token for it.
- [zone.md](zone.md): add a domain, read and change DNS records, redirect one name to another, HTTPS settings, DNSSEC.

**Account security**, human steps: two-factor login under My Profile > Authentication.
