MCP + CLI · version 1.0.1

Cloudflare Domains Toolkit

A guarded Cloudflare Registrar MCP server and a companion DNS CLI. Let an AI check and prepare a domain purchase, approve the exact live price yourself, then manage the domain’s DNS from a focused command-line tool.

Node.jsTypeScriptMCPCloudflare Registrar APICloudflare DNS APIZodCommandermacOS Keychain

The full source, tests, and documentation live in the public repository. MIT licensed. Issues and pull requests are off: fork it and make it yours.

Join the Flavio Copes newsletter

Join the newsletter to access my complete download library of books and courses. I’ll also email you when I publish new software, and about building products with AI and my courses. You can unsubscribe anytime.

Your email is stored on a secure server in the EU. Every email has an unsubscribe link. Unsubscribing stops future emails; you can keep using the public download library.

Why I built this

An AI is genuinely useful when you are naming a project. It can explore ideas, check exact domains, and compare current prices faster than a long dashboard session. The problem begins when a helpful tool can also create a real charge.

I built the MCP server to put the financial boundary in code. The AI can search and prepare a quote, but the server repeats the live checks, enforces a $20 complete-initial-charge limit, and asks the MCP client to show the exact domain and price to a person before registration.

Registration is only half the job. The companion CLI covers what comes next: list zones, inspect records, and make deliberate DNS changes without turning the MCP server into a broad Cloudflare administration tool.

From domain idea to working DNS

Let AI prepare. Approve the purchase. Connect the domain.

  1. Search for domain ideas.
  2. Check live availability and price.
  3. Create a five-minute guarded quote.
  4. Approve it, then manage DNS with the CLI.

Features

Client-neutral MCP tools

Use the same local stdio server from Cursor, Codex, or another MCP client instead of maintaining client-specific automation scripts.

Authoritative availability

Check one exact domain against the registry and return current availability, registration price, renewal price, and any rejection reason.

Domain idea search

Turn a phrase or partial name into Cloudflare-supported suggestions, while keeping discovery results separate from purchase decisions.

Short-lived quotes

Create a five-minute, single-use quote containing the exact domain, currency, term, initial charge, renewal price, and auto-renew state.

Human approval in the client

Use standard MCP elicitation to display the exact billable purchase after the final live price check and require an explicit true response.

Hard $20 limit

Calculate the complete initial charge in integer cents and reject any purchase above $20, including extensions with multi-year minimums.

Price-change protection

Recheck availability, price, and minimum term before approval. Any difference invalidates the quote and requires a new one.

Local secret storage

Read the token from macOS login Keychain or a process environment supplied by another operating system or secret manager.

Safe defaults

Reject premium and non-USD purchases, keep quotes in memory, disable auto-renewal, and never retry an ambiguous registration automatically.

Companion DNS CLI

Use cf-domains to list zones and records, create records, update selected fields, and delete only after a negative-default confirmation.

Separate least-privilege tokens

Keep billable Registrar permission apart from Zone and DNS permissions, with distinct macOS Keychain service names and portable secret-provider fallbacks.

Automated verification

Run focused domain, money, quote, approval, and replay tests plus a real MCP handshake and tool-discovery smoke test.

Use cases

Name a new product

Brainstorm domain options with an AI, then confirm the final candidate against live Cloudflare registry data.

Check availability from chat

Ask whether a domain is available without opening Cloudflare or giving an AI access to a browser session.

Compare real prices

See registration and renewal costs before deciding which extension fits a small project.

Approval-gated registration

Let an agent prepare the purchase while keeping the final domain and price decision in your own client UI.

Learn MCP architecture

Study a compact server with typed tools, stdio transport, external API calls, elicitation, and destructive-action boundaries.

Build another guarded tool

Reuse the quote, recheck, approval, and adapter patterns for another local AI workflow with real-world consequences.

Connect a purchased domain

Inspect the new zone, add its website or verification records, and review the exact Cloudflare result from the terminal.

Give an AI readable DNS tools

Let many coding agents call a small, documented CLI instead of handing them a general-purpose raw Cloudflare API script.

Tech stack

Local runtime

Node.js

Runs the stdio child process, uses native fetch for Cloudflare requests, and reads macOS Keychain through the system security command.

Application boundaries

TypeScript

Keeps Registrar responses, quote state, money rules, approval details, and registration workflows explicit.

Client protocol

MCP SDK

Provides the stdio transport, tool discovery, tool calls, capability negotiation, results, and form elicitation.

Tool validation

Zod

Validates domain, quote ID, currency, and total cents before application code handles a request.

Registry and purchase boundary

Cloudflare Registrar API

Supplies domain suggestions, authoritative availability, pricing, extension metadata, and registration workflows.

DNS command interface

Commander and Prompts

Provide explicit subcommands and flags, readable help, password input, and negative-default confirmation before deletion.

Zone and record boundary

Cloudflare DNS API

Lists accessible zones and performs allow-listed create, partial update, and delete operations on DNS records.

Verification

Node test runner

Covers the safety policy with fake Registrar clients, exact money tests, and no real registration calls.

CLI

The included cf-domains command is the practical companion for DNS work after registration. It uses a separate Zone/DNS token and confirms deletion unless you deliberately pass --yes.

cf-domains auth login

Verify a DNS-scoped token and save it in the macOS login Keychain.

cf-domains zones

List every Cloudflare zone available to the configured token.

cf-domains records example.com

Inspect records and copy the exact ID needed for an update or deletion.

cf-domains add example.com --type A --name www --content 203.0.113.10 --proxied

Create a normalized DNS record using explicit fields.

cf-domains update example.com record-id --content 203.0.113.11

Patch only the fields supplied on the command line.

cf-domains delete example.com record-id

Ask for confirmation before deleting one exact DNS record.

Screenshots and demos

Codex showing the final MCP approval form for buying hostingpicker.dev through Cloudflare Registrar for $12.20 USD with auto-renewal disabled
Codex showing the final MCP approval form for buying hostingpicker.dev through Cloudflare Registrar for $12.20 USD with auto-renewal disabled. Open the full-size image.

What’s included

  • Cloudflare Domains Toolkit version 1.0.1 with two complete sanitized source packages
  • Registrar MCP server with typed TypeScript source and client-neutral stdio transport
  • Four typed MCP tools for search, check, quote, and approval-gated purchase
  • Cloudflare Registrar adapter with structured API errors
  • Exact domain validation and integer-cent price calculations
  • Five-minute quote storage, replay prevention, and live price rechecks
  • macOS login Keychain helper plus portable environment-variable support
  • Companion cf-domains CLI for zones and DNS record list, create, update, and delete
  • Separate Keychain identities and permission guidance for Registrar and DNS tokens
  • Cursor and Codex configuration templates with placeholders only
  • Automated unit tests, MCP smoke test, and read-only live-check script
  • A README with the build story, architecture, decisions, customization, deployment, configuration, and security guides, plus AGENTS.md for coding agents
  • The complete creation story and the real hostingpicker.dev MCP approval screenshot

Documentation

The documentation lives in the repository, in one README: setup and usage, why I built it, how it was built, architecture, configuration, deployment, customization, security, the technical decisions, and the changelog. AGENTS.md gives coding agents the project context and operating rules.

Read the README on GitHub →

Why use this

  • Start with a working financial-action boundary instead of trusting an AI prompt to behave
  • Reuse standard MCP elicitation for a real human approval inside supported clients
  • Study a small codebase where protocol, policy, API, secrets, domains, and money stay separate
  • Give Cursor and Codex the same tools without duplicating client-specific scripts
  • Get the companion DNS CLI in the same repository instead of building a second tool after registration
  • Adapt a tested quote and recheck workflow for another guarded API action
  • Own and modify the complete source with no hosted service or subscription

Customize it

Use the working source as a foundation. Keep it small, change it for your own workflow, or turn it into a different product.

  1. Add batch availability checks so one prompt can compare a short list without changing the one-domain purchase boundary.
  2. Add Linux Secret Service or Windows Credential Manager behind the existing configuration adapter.
  3. Expose registration status as another read-only MCP tool for workflows that remain in progress or require action.
  4. Add a DNS plan mode that prints an allow-listed change without sending it to Cloudflare.
  5. Package client presets for another MCP host and document exactly how it handles destructive tools and elicitation.
  6. Reuse the quote, live recheck, and approval pattern for another billable API where an agent should prepare but a person must decide.

MIT license

The repository includes an MIT LICENSE file. You can use, copy, change, publish, distribute, sublicense, or sell the code, including as part of a commercial product.

Keep the copyright and license notice with copies or substantial portions of the code. Third-party dependencies and assets keep their own licenses.

Keep learning

AI Workshop

Explore a practical MCP workflow where AI prepares an action and a person keeps the final authority.

Explore AI Workshop →

Join the newsletter to access my complete download library of books and courses. I’ll also email you when I publish new software, and about building products with AI and my courses. You can unsubscribe anytime.

Your email is stored on a secure server in the EU. Every email has an unsubscribe link. Unsubscribing stops future emails; you can keep using the public download library.