cloudflare-dns-mcp

cloudflare-dns-mcp

MCP server for managing Cloudflare DNS subdomains, enabling an LLM to check availability, claim, release, and list subdomains under a root domain.

Category
Visit Server

README

cloudflare-dns-mcp

An MCP server that lets an LLM check, claim, release, and list subdomains under a root domain, backed by the Cloudflare DNS API. Runs over stdio (local, default) or streamable HTTP (remote, behind a bearer token).

Tools

  • check_subdomain_availability — check whether <subdomain>.<root_domain> already has a DNS record.
  • request_domain — claim <subdomain>.<root_domain> by creating an A record pointing at an IPv4 address. Fails if the subdomain is already taken.
  • release_subdomain — delete the DNS record for <subdomain>.<root_domain>, freeing it up again.
  • list_subdomains — list every record under <root_domain> currently registered.

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Copy .env.example to .env and fill in your Cloudflare credentials:

cp .env.example .env
Variable Required Description
CLOUDFLARE_API_TOKEN_DNS yes Cloudflare API token with Zone:DNS:Edit permission for the target zone.
CLOUDFLARE_ZONE_ID yes Zone ID of the domain in Cloudflare.
CLOUDFLARE_ROOT_DOMAIN yes Root domain that subdomains are created under, e.g. example.com.
CLOUDFLARE_API_BASE_URL no Overrides the Cloudflare API base URL. Defaults to https://api.cloudflare.com/client/v4.

Running

By default the server runs over stdio, meant to be launched by an MCP client rather than run standalone:

python main.py

To run it as a standalone remote server over streamable HTTP instead, set MCP_TRANSPORT=http plus a shared-secret MCP_HTTP_TOKEN (see .env.example):

MCP_TRANSPORT=http MCP_HTTP_HOST=0.0.0.0 MCP_HTTP_PORT=8000 MCP_HTTP_TOKEN=a-long-random-secret python main.py

MCP_HTTP_TOKEN is required in HTTP mode — the server refuses to start without it, since it can create and delete DNS records and must not be exposed unauthenticated. Every request needs Authorization: Bearer <token>; requests without it (or with the wrong token) get a 401. Put a reverse proxy with TLS in front of it if it's reachable from the public internet.

Claude Code

claude mcp add cloudflare-dns /path/to/.venv/bin/python /path/to/main.py \
  --env CLOUDFLARE_API_TOKEN_DNS=your-token \
  --env CLOUDFLARE_ZONE_ID=your-zone-id \
  --env CLOUDFLARE_ROOT_DOMAIN=example.com

Or add it by hand to .mcp.json (project scope) or ~/.claude.json (user scope):

{
  "mcpServers": {
    "cloudflare-dns": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/main.py"],
      "env": {
        "CLOUDFLARE_API_TOKEN_DNS": "your-token",
        "CLOUDFLARE_ZONE_ID": "your-zone-id",
        "CLOUDFLARE_ROOT_DOMAIN": "example.com"
      }
    }
  }
}

If the server is running remotely over HTTP instead:

claude mcp add --transport http cloudflare-dns https://your-host/mcp \
  --header "Authorization: Bearer your-mcp-http-token"

or in .mcp.json:

{
  "mcpServers": {
    "cloudflare-dns": {
      "type": "http",
      "url": "https://your-host/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-http-token"
      }
    }
  }
}

opencode

Add to opencode.json (project) or ~/.config/opencode/opencode.json (global):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "cloudflare-dns": {
      "type": "local",
      "command": ["/path/to/.venv/bin/python", "/path/to/main.py"],
      "enabled": true,
      "environment": {
        "CLOUDFLARE_API_TOKEN_DNS": "your-token",
        "CLOUDFLARE_ZONE_ID": "your-zone-id",
        "CLOUDFLARE_ROOT_DOMAIN": "example.com"
      }
    }
  }
}

If the server is running remotely over HTTP instead, use type: "remote":

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "cloudflare-dns": {
      "type": "remote",
      "url": "https://your-host/mcp",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer your-mcp-http-token"
      }
    }
  }
}

Other MCP clients

Generic stdio client config:

{
  "mcpServers": {
    "cloudflare-dns": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/main.py"],
      "env": {
        "CLOUDFLARE_API_TOKEN_DNS": "...",
        "CLOUDFLARE_ZONE_ID": "...",
        "CLOUDFLARE_ROOT_DOMAIN": "example.com"
      }
    }
  }
}

Generic streamable HTTP client config:

{
  "mcpServers": {
    "cloudflare-dns": {
      "type": "http",
      "url": "https://your-host/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-http-token"
      }
    }
  }
}

Security

Never commit your .env file — it contains a Cloudflare API token that can edit DNS records for your zone. .gitignore already excludes it; only .env.example (with placeholder values) is tracked.

If you run the HTTP transport, MCP_HTTP_TOKEN is the only thing standing between the internet and DNS write access to your zone — treat it like the Cloudflare token itself (long/random, not committed, rotated if it ever leaks), and put it behind TLS.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured