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.
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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。