Connect Cloudflare to Claude Code

Manage zones, DNS records, Workers, and analytics. Add Toolspoke to Claude Code once and it can use 12 Cloudflare actions. Your Cloudflare credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Cloudflare and connect it

    Add Cloudflare to a project in your Toolspoke workspace.

    API token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    API token
    My Profile → API Tokens → Create Token. Include Zone:Read, DNS:Edit, Cache Purge, Zone Settings:Edit, Workers Scripts:Read, and Account Analytics:Read for the full action set.
  3. Choose what Claude Code may do

    All 12 actions start on. Switch off any of the 5 actions that change something in Cloudflare, and Claude Code gets a refusal if it tries.

What you can ask Claude Code for

A few of the Cloudflare actions that only read, so they are safe to try first.

  • List the zones (domains) this API token can see, with their status, plan, and nameservers
  • List the Cloudflare accounts this API token can reach
  • List DNS records for a zone, optionally filtered by name or record type
  • List the Worker scripts deployed in an account, with their last-modified time and usage model

What Claude Code can do in Cloudflare

7 actions read, 4 write and one deletes or permanently changes something.

Reads

  • List zones

    List the zones (domains) this API token can see, with their status, plan, and nameservers. Call this first to find the zone id for the DNS, cache, and settings actions.

  • List accounts

    List the Cloudflare accounts this API token can reach. Use it to find the account id for the Workers actions.

  • Dns records

    List DNS records for a zone, optionally filtered by name or record type. Returns the record id needed by update_dns_record and delete_dns_record.

  • Zone settings

    Read the zone's configuration settings (SSL mode, cache level, security level, always-online, HTTP/3, and so on) as id/value pairs. Use it to find the setting_id for update_zone_setting.

  • List workers

    List the Worker scripts deployed in an account, with their last-modified time and usage model.

  • Worker status

    Check a Worker's health over a recent window: request, error, and subrequest counts broken down by invocation status, plus p50/p99 CPU time. Call this after a deploy or when a Worker is suspected of failing.

  • Zone analytics

    Daily traffic analytics for a zone from the GraphQL Analytics API: requests, bytes, cached share, unique visitors, threats, and page views per day. Use it to answer traffic, bandwidth, and cache-hit questions.

Writes

  • Create dns record

    Create a DNS record in a zone. Set proxied to true to route the hostname through Cloudflare's proxy (only valid for A, AAAA, and CNAME records).

  • Update dns record

    Update fields on an existing DNS record. Only the fields you pass are changed; get the record_id from dns_records first.

  • Purge cache

    Purge Cloudflare's edge cache for a zone. Prefer files, tags, hosts, or prefixes; everything=true drops the whole cache and forces every request back to the origin, so use it sparingly.

  • Update zone setting

    Change one zone setting, e.g. setting_id "ssl" with value "full", or "development_mode" with value "on". Read zone_settings first to see the current value and the accepted shape.

Deletes or permanently changes

  • Delete dns record

    DESTRUCTIVE: permanently removes one DNS record from a zone, the counterpart of create_dns_record. The zone itself is untouched, but the hostname stops resolving immediately. Confirm the record with dns_records before calling.

Cloudflare in Claude Code: questions

Does Claude Code see my Cloudflare credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Can I stop Claude Code from changing things in Cloudflare?

Yes. Each of the 12 actions can be switched off for a project. Turn off the 5 that change something and Claude Code can only read.

Will 12 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Cloudflare action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a Cloudflare call does not run in a sandbox, so it bills nothing.

Try Cloudflare in Claude Code

Free to start, and tool calls cost nothing on any plan.