Connect Cloudflare to Codex
Manage zones, DNS records, Workers, and analytics. Add Toolspoke to Codex once and it can use 12 Cloudflare actions. Your Cloudflare credential stays in Toolspoke, and you choose which actions Codex may call.
Set it up in Codex
Three steps, the first one once for every toolkit you will ever add.
Add Toolspoke to Codex
~/.codex/config.toml
[mcp_servers.toolspoke] url = "https://toolspoke.com/mcp"Codex signs in to Toolspoke on its own the first time it connects, so there is no key to paste.
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.
Choose what Codex may do
All 12 actions start on. Switch off any of the 5 actions that change something in Cloudflare, and Codex gets a refusal if it tries.
What you can ask Codex 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 Codex 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 Codex: questions
Does Codex see my Cloudflare credential?
No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Codex only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.
Can I stop Codex 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 Codex can only read.
Will 12 actions crowd Codex's context?
No. Toolspoke shows Codex five bridge tools, plus a guide where a toolkit has one, and Codex searches for the Cloudflare action it needs when it needs it. Adding more toolkits does not add more tools to its list.
Does the same work in ChatGPT?
ChatGPT and Codex share one OpenAI account. In ChatGPT, add a custom MCP connector in its settings and paste the same address.
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.
Cloudflare in your other apps
More infrastructure toolkits for Codex
Try Cloudflare in Codex
Free to start, and tool calls cost nothing on any plan.