HUB
Sign inSign up

awkto/cloudflare-dns-manager

By awkto

•Updated 8 months ago

Modern web-based GUI for managing Cloudflare DNS zones

Buildkit cacheImage
0

1.8K

awkto/cloudflare-dns-manager repository overview

⁠Cloudflare DNS Manager

A web-based GUI for managing Cloudflare DNS zones. View, add, edit, and delete DNS records against the Cloudflare API.

Cloudflare Python Flask Docker

⁠Features

  • View all DNS records in a Cloudflare zone
  • Create, edit, and delete records: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA
  • Admin password + bearer API token authentication
  • Web-based configuration with Test Connection before save
  • Dark mode, search, and per-type filtering
  • Optional MCP (Model Context Protocol) server for AI agents
  • Docker image published to Docker Hub, triggered by git tags

⁠Quick Start with Docker

docker run -d -p 5000:5000 \
  -e CF_API_TOKEN=your-cloudflare-api-token \
  -e CF_DNS_ZONE=your-domain.com \
  --name cloudflare-dns-manager \
  awkto/cloudflare-dns-manager:latest

Open http://localhost:5000 in your browser and set an admin password on first visit.

⁠Architecture

  • Backend: Python Flask, Cloudflare API v4 (REST)
  • Frontend: Vanilla HTML/CSS/JavaScript
  • Auth: Password-protected web UI + bearer API_TOKEN for scripts
  • Storage: config persisted in a host-mounted data/ directory

⁠Cloudflare API Token

Create a token at https://dash.cloudflare.com/profile/api-tokens⁠ with:

  • Zone · Zone · Read
  • Zone · DNS · Edit

Scope it to the specific zone(s) you want to manage.

⁠Deployment

⁠Docker Compose
version: '3.8'

services:
  cloudflare-dns-manager:
    image: awkto/cloudflare-dns-manager:latest
    container_name: cloudflare-dns-manager
    ports:
      - "5000:5000"
    environment:
      - CF_API_TOKEN=${CF_API_TOKEN}
      - CF_DNS_ZONE=${CF_DNS_ZONE}
    volumes:
      - ./data:/app/data
    restart: unless-stopped
⁠Local Python
git clone https://github.com/awkto/cloudflare-dns.git
cd cloudflare-dns
pip install -r requirements.txt
python app.py

⁠Environment Variables

VariableDescription
CF_API_TOKENCloudflare API token with Zone:DNS:Edit
CF_DNS_ZONEZone name (e.g. example.com)
MCP_ENABLEDtrue to expose the MCP SSE endpoints

Credentials entered in the Settings UI are written to /app/data/.env and persist across restarts.

⁠API

MethodEndpointDescription
GET/api/healthHealth check
GET/api/config/statusIs Cloudflare configured?
GET/POST/api/configRead / write configuration
POST/api/config/testVerify credentials
GET/api/recordsList all DNS records
POST/api/recordsCreate a DNS record
PUT/api/records/<type>/<name>Update a DNS record
DELETE/api/records/<type>/<name>Delete a DNS record

Swagger UI is available at /apidocs/.

All endpoints under /api/ (except /api/health and auth endpoints) require either a session cookie or an Authorization: Bearer <API_TOKEN> header. The app generates the API_TOKEN on first boot and exposes it in Settings → API Token.

⁠Record Value Formats
  • A / AAAA / CNAME / TXT / NS: single value (e.g. 192.0.2.1, target.example.com)
  • MX: priority exchange — e.g. 10 mail.example.com
  • SRV: priority weight port target — e.g. 10 5 5060 sipserver.example.com
  • CAA: flags tag value — e.g. 0 issue "letsencrypt.org"

TTL of 1 means Cloudflare "automatic".

⁠MCP (Model Context Protocol)

When MCP_ENABLED=true (or toggled on in Settings), the server exposes:

EndpointDescription
GET /mcp/sseSSE transport (Bearer auth)
POST /mcp/messagesJSON-RPC messages (Bearer auth)
GET /mcpdocsInteractive tool documentation

Tools: list_records, create_record, update_record, delete_record, health_check.

⁠Claude Code Configuration
{
  "mcpServers": {
    "cloudflare-dns": {
      "type": "url",
      "url": "https://your-host/mcp/sse",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

⁠Release Pipeline

Tag-triggered:

git tag v1.2.3 && git push origin v1.2.3

The GitHub Actions workflow at .github/workflows/docker-publish.yml:

  1. Builds a multi-arch (amd64, arm64) Docker image
  2. Pushes latest and <version> tags to Docker Hub
  3. Updates the Docker Hub repo description from this README
  4. Creates a GitHub Release with auto-generated notes

Required repository secrets:

  • DOCKER_USERNAME — Docker Hub username
  • DOCKER_PASSWORD — Docker Hub access token (not account password)

⁠License

MIT

Tag summary
Recent tags
Content type
Image
Digest
sha256:6e58a3995…
Size
56.5 MB
Last updated
8 months ago
docker pull awkto/cloudflare-dns-manager:latest