cloudflare-dns-mcp-server

cloudflare-dns-mcp-server

A token-efficient MCP server for managing Cloudflare DNS zones and records with full CRUD support and bulk operations. It can be deployed locally via stdio or as a Cloudflare Worker for remote HTTP access.

Category
访问服务器

README

cloudflare-dns-mcp-server

A best-of-breed MCP server for Cloudflare DNS management. Designed for extreme token efficiency, full CRUD coverage, and easy deployment as both a local MCP server and a Cloudflare Worker.

Features

  • 10 DNS tools covering zones, records, bulk operations, and BIND export
  • Token-efficient by default — concise output strips 60-80% of Cloudflare API bloat
  • Summary mode — get record counts + type distribution without fetching individual records
  • Random sampling — audit large zones without loading everything
  • Safety gates — deletes require explicit confirm: true
  • Dual transport — stdio for Claude Desktop, Streamable HTTP for remote access
  • Worker-ready — deploy to Cloudflare Workers with npm run deploy

Quick Start

1. Create a Cloudflare API Token

Go to Cloudflare API Tokens and create a token with:

  • Zone → Zone → Read
  • Zone → DNS → Edit
  • Scope: All zones (or specific zones you want to manage)

2. Install

git clone https://github.com/piersdd/cloudflare-platform-mcp.git
cd cloudflare-platform-mcp
npm install
npm run build

3. Configure Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "cloudflare-dns": {
      "command": "node",
      "args": ["/path/to/cloudflare-platform-mcp/dist/index.js"],
      "env": {
        "CLOUDFLARE_API_TOKEN": "your-api-token-here"
      }
    }
  }
}

Restart Claude Desktop. The server validates your token on startup.

Tools

Read Tools

Tool Description
cf_dns_list_zones List zones with optional name/status/account filters
cf_dns_get_zone Get zone by ID or domain name
cf_dns_list_records List records with filters, pagination, summary mode, random sampling
cf_dns_get_record Get a single record by ID
cf_dns_export_records Export zone as BIND zonefile

Write Tools

Tool Description
cf_dns_create_record Create any DNS record type (A, AAAA, CNAME, MX, TXT, SRV, CAA, etc.)
cf_dns_update_record Partial update (PATCH) — only changed fields
cf_dns_delete_record Delete with mandatory confirm: true safety gate
cf_dns_bulk_create Create up to 100 records in one call
cf_dns_bulk_update Update up to 100 records in one call

Token Efficiency

Every tool defaults to concise output. Here's what that means:

Concise (default) — only the fields an LLM needs:

{ "id": "abc123", "type": "A", "name": "www.example.com", "content": "203.0.113.10", "proxied": true, "ttl": "auto" }

Full Cloudflare response (with include_details=true) — includes zone_id, zone_name, meta, settings, proxiable, locked, etc. ~5x more tokens.

Efficiency Modes for cf_dns_list_records

Mode Tokens Use Case
summary_only=true ~50 "How many records? What types?"
random_sample=true ~200 "Show me a few records to check"
Filtered + concise ~500 "Show me all CNAME records"
Full details ~2500 "I need all metadata for debugging"

Example Prompts

"List all my Cloudflare zones"
"Show me the DNS records for example.com"
"How many DNS records does example.com have, broken down by type?"
"Create an A record for app.example.com pointing to 203.0.113.10 with proxy enabled"
"Set up email DNS for example.com with Google Workspace MX records"
"Switch the A record for api.example.com from 10.0.0.1 to 10.0.0.2"
"Delete the old staging CNAME record"
"Export all DNS records for example.com as a BIND file"
"Audit example.com for unproxied A records that might expose our origin IP"

HTTP Transport (Remote Access)

Run as an HTTP server instead of stdio:

TRANSPORT=http CLOUDFLARE_API_TOKEN=your-token node dist/index.js

The server starts on port 8787 (configurable via PORT env var). An API key is auto-generated and printed to stderr on first run. Set CLOUDFLARE_DNS_MCP_API_KEY to persist it.

Endpoints:

  • POST /mcp — MCP Streamable HTTP (requires X-API-Key header)
  • GET /health — Health check

Remote MCP Client Config

{
  "mcpServers": {
    "cloudflare-dns": {
      "url": "http://localhost:8787/mcp",
      "headers": {
        "X-API-Key": "your-mcp-api-key"
      }
    }
  }
}

Deploy as a Cloudflare Worker

The same codebase deploys to Cloudflare Workers for always-on remote access:

# Set secrets
npx wrangler secret put CLOUDFLARE_API_TOKEN
npx wrangler secret put CLOUDFLARE_DNS_MCP_API_KEY

# Deploy
npm run deploy

Your MCP server is now at https://cloudflare-dns-mcp.your-subdomain.workers.dev/mcp.

Public Exposure with Custom Domain

For production use behind a custom domain:

  1. Add a custom domain in the Cloudflare dashboard for your Worker
  2. TLS is automatic via Cloudflare's edge certificates
  3. Optionally put it behind Cloudflare Access for SSO authentication

Via Cloudflare Tunnel

For exposing a local instance:

cloudflared tunnel --url http://localhost:8787

Environment Variables

Variable Required Default Description
CLOUDFLARE_API_TOKEN Yes Cloudflare API token with Zone:Read + DNS:Edit
TRANSPORT No stdio stdio or http
PORT No 8787 HTTP server port (http transport only)
CLOUDFLARE_DNS_MCP_API_KEY No auto-generated API key for HTTP transport authentication

Development

npm run dev          # stdio mode with auto-reload
npm run dev:http     # HTTP mode with auto-reload
npm run build        # Compile TypeScript
npm run typecheck    # Type-check without emitting
npm run deploy       # Build + deploy to Workers

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选