Cloudflare DNS MCP Server

Cloudflare DNS MCP Server

Enables AI assistants to manage Cloudflare DNS zones and records, including listing, creating, updating, and deleting DNS records through natural language.

Category
访问服务器

README

Cloudflare DNS MCP Server

npm version License: MIT MCP Compatible

A powerful Model Context Protocol (MCP) server for managing Cloudflare DNS zones and records via API. This server enables AI assistants like Claude to manage DNS records directly through Cloudflare's API.

Features

  • 🌐 Zone Management: List and inspect DNS zones
  • 📝 DNS Records: Create, read, update, and delete DNS records
  • 🔍 Smart Filtering: Filter records by type, name, or zone
  • ☁️ Cloudflare Proxy: Support for Cloudflare's proxy features
  • 🛡️ Secure: Environment-based authentication
  • ⚡ Fast: Direct API integration with minimal overhead

Quick Start

Run the server directly with npx (requires Node.js 18+):

npx @artik0din/mcp-cloudflare-dns

Or install locally:

npm install -g @artik0din/mcp-cloudflare-dns
mcp-cloudflare-dns

Environment Variables

Create a .env file in your working directory:

Variable Required Description
CLOUDFLARE_API_TOKEN ✅ Your Cloudflare API token with Zone:Read and DNS:Edit permissions
CLOUDFLARE_ZONE_ID ❌ Default zone ID (can be provided per request)

Getting Your Cloudflare API Token

  1. Go to Cloudflare Dashboard > My Profile > API Tokens
  2. Click "Create Token"
  3. Use "Custom Token" with these permissions:
    • Zone Resources: Include All zones (or specific zones)
    • Permissions: Zone:Read, DNS:Edit

MCP Client Configuration

Claude Desktop

Add this to your Claude Desktop configuration:

{
  "mcpServers": {
    "cloudflare-dns": {
      "command": "npx",
      "args": ["@artik0din/mcp-cloudflare-dns"],
      "env": {
        "CLOUDFLARE_API_TOKEN": "your_api_token_here",
        "CLOUDFLARE_ZONE_ID": "your_zone_id_here"
      }
    }
  }
}

Other MCP Clients

Use the command npx @artik0din/mcp-cloudflare-dns with the appropriate environment variables set.

Available Tools

cloudflare_list_zones

List all DNS zones accessible to your API token.

Parameters: None

Example:

List all my Cloudflare zones

cloudflare_get_zone

Get detailed information about a specific DNS zone.

Parameters:

  • zoneId (string, required): Zone ID to get details for

Example:

Get details for zone abc123def456

cloudflare_list_dns_records

List DNS records for a specific zone with optional filtering.

Parameters:

  • zoneId (string, optional): Zone ID (uses default if not provided)
  • type (string, optional): Filter by record type (A, AAAA, CNAME, MX, TXT, etc.)
  • name (string, optional): Filter by record name

Example:

List all A records for my zone
List DNS records of type MX for zone abc123def456
Show all records for www.example.com

cloudflare_create_dns_record

Create a new DNS record in a zone.

Parameters:

  • type (string, required): Record type (A, AAAA, CNAME, MX, TXT, etc.)
  • name (string, required): Record name (e.g., www.example.com or @)
  • content (string, required): Record content (IP, hostname, text, etc.)
  • zoneId (string, optional): Zone ID (uses default if not provided)
  • ttl (number, optional): TTL in seconds (1 = auto, 120-7200)
  • priority (number, optional): Priority for MX records
  • proxied (boolean, optional): Enable Cloudflare proxy
  • comment (string, optional): Comment for the record

Example:

Create an A record for www pointing to 1.2.3.4
Create a CNAME record for blog pointing to www.example.com with TTL 3600
Add an MX record for @ pointing to mail.example.com with priority 10

cloudflare_update_dns_record

Update an existing DNS record.

Parameters:

  • recordId (string, required): DNS record ID to update
  • type (string, optional): New record type
  • name (string, optional): New record name
  • content (string, optional): New record content
  • zoneId (string, optional): Zone ID (uses default if not provided)
  • ttl (number, optional): New TTL in seconds
  • priority (number, optional): New priority for MX records
  • proxied (boolean, optional): Enable/disable Cloudflare proxy
  • comment (string, optional): New comment

Example:

Update record abc123 to point to IP 5.6.7.8
Change the TTL of record def456 to 3600 seconds
Enable proxy for record ghi789

cloudflare_delete_dns_record

Delete a DNS record.

Parameters:

  • recordId (string, required): DNS record ID to delete
  • zoneId (string, optional): Zone ID (uses default if not provided)

Example:

Delete DNS record abc123
Remove record def456 from zone ghi789

Security Considerations

  • API Token Security: Never commit your API token to version control
  • Minimal Permissions: Use API tokens with minimal required permissions
  • Zone Restrictions: Consider restricting API tokens to specific zones
  • Regular Rotation: Rotate API tokens regularly
  • Environment Variables: Always use environment variables for credentials

Development

# Clone the repository
git clone https://github.com/artik0din/mcp-cloudflare-dns.git
cd mcp-cloudflare-dns

# Install dependencies
npm install

# Build the project
npm run build

# Run locally
npm start

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Credits

Built with the Model Context Protocol SDK and Cloudflare API.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选