Cloudflare DNS provider extension for npmctl.
Project description
npmctl-cloudflare
Cloudflare DNS provider plugin for npmctl
Extend npmctl with Cloudflare-backed DNS record management for declarative workflows, provider discovery, and DNS-aware automation.
npmctl-cloudflare is the Cloudflare DNS provider package for npmctl. Install it when you want desired-state DNS records or DNS diagnostics to resolve through Cloudflare instead of using only the base npmctl package.
Supported Python Versions
npmctl-cloudflare supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Why npmctl-cloudflare
- Adds Cloudflare DNS provider discovery to
npmctl - Lets DNS workflows live beside proxy and certificate desired state
- Keeps Cloudflare API tokens out of the core CLI package
- Supports operator diagnostics through
npmctl dns doctor - Provides client helpers for Cloudflare DNS record workflows
FAQ
What is npmctl-cloudflare?
Answer: npmctl-cloudflare is a plugin package that teaches npmctl how to talk to the Cloudflare DNS Records API for DNS record operations and DNS provider diagnostics.
When do I need npmctl-cloudflare?
Answer: You need npmctl-cloudflare when your npmctl workflow includes Cloudflare-managed DNS records or when you want npmctl to validate Cloudflare DNS connectivity and credentials.
Does npmctl-cloudflare work without npmctl?
Answer: No. npmctl-cloudflare is an extension package for npmctl, not a standalone CLI.
Can npmctl-cloudflare set DNS records?
Answer: Yes. The Cloudflare provider supports declarative A, AAAA, CNAME, TXT, MX, SRV, and CAA writes. MX records require priority.
What credentials are required?
Answer: Cloudflare API access requires CLOUDFLARE_API_TOKEN. For diagnostics, grant zone read and DNS read access. For record changes, grant DNS write access to the target zone.
Install
Install the base CLI and the Cloudflare provider package together:
pipx install npmctl
pipx inject npmctl npmctl-cloudflare
npmctl plugins list
With uv:
uv tool install npmctl
uv tool install npmctl-cloudflare
npmctl plugins list
Inside a virtual environment:
python -m venv .venv
. .venv/bin/activate
python -m pip install npmctl npmctl-cloudflare
npmctl plugins list
Configure Cloudflare
Set the required environment variable:
export CLOUDFLARE_API_TOKEN=your-cloudflare-api-token
Optional for tests, proxies, or alternate endpoints:
export CLOUDFLARE_API_BASE_URL=https://api.cloudflare.com/client/v4
Verify Plugin Discovery
Check that npmctl can discover the provider:
npmctl plugins list
npmctl dns doctor --provider cloudflare
Minimal DNS Workflow
Once the provider is installed and configured, npmctl can validate, plan, apply, or diagnose Cloudflare-backed DNS behavior through the base CLI:
npmctl validate desired-state/dns.yaml
npmctl plan desired-state/dns.yaml --owner site-a
npmctl apply desired-state/dns.yaml --owner site-a
npmctl dns providers
npmctl dns zones --provider cloudflare
npmctl dns records --provider cloudflare --zone example.com
Cloudflare API Surface
The provider follows the Cloudflare DNS Records API:
GET /zones: discover zones available to the token.GET /zones/{zone_id}/dns_records: list DNS records in one zone.POST /zones/{zone_id}/dns_records: create supported DNS records.PUT /zones/{zone_id}/dns_records/{dns_record_id}: overwrite an existing record.PATCH /zones/{zone_id}/dns_records/{dns_record_id}: partially update an existing record.DELETE /zones/{zone_id}/dns_records/{dns_record_id}: delete a record.
Programmatic Record Operations
The npmctl DNS provider contract requires zones() and records(zone). This package also exposes client helpers for API-backed record mutation:
from npmctl_cloudflare import CloudflareClient, CloudflareConfig
client = CloudflareClient(CloudflareConfig.from_env())
record = client.create_record("example.com", type="A", name="www", value="192.0.2.10", ttl=300)
client.patch_record("example.com", str(record.record_id), value="192.0.2.11")
client.delete_record("example.com", str(record.record_id))
CNAME and other supported record types use the same method. MX records pass
priority:
client.create_record("example.com", type="CNAME", name="app", value="target.example.net", ttl=300)
client.create_record("example.com", type="MX", name="@", value="mail.example.com", ttl=300, priority=10)
Safety Notes
- Only operate on zones that are authoritative in Cloudflare.
- Use least-privilege API tokens scoped to the intended zone.
- Keep
CLOUDFLARE_API_TOKENout of desired-state files and logs. - Cloudflare prevents CNAME records from coexisting with A or AAAA records on the same name.
- Use npmctl owner metadata for desired DNS records so apply remains owner-scoped.
More Documentation
- Related PyPI package: https://pypi.org/project/npmctl/
- Repository: https://github.com/groupsum/npmctl
- DNS provider docs: https://github.com/groupsum/npmctl/tree/master/docs/dns-providers.md
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file npmctl_cloudflare-0.3.10.tar.gz.
File metadata
- Download URL: npmctl_cloudflare-0.3.10.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac65e21ceb404dc90e162ee144db88163fff35f9da55f3bb9c5591abfce6ee98
|
|
| MD5 |
74f4d009b53e77a5aeea0e411b28f195
|
|
| BLAKE2b-256 |
9939ebd03d4a20ac9b8936e25d85090e448a54d8852628179de204ff5ab5e4d1
|
Provenance
The following attestation bundles were made for npmctl_cloudflare-0.3.10.tar.gz:
Publisher:
release.yml on groupsum/npmctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
npmctl_cloudflare-0.3.10.tar.gz -
Subject digest:
ac65e21ceb404dc90e162ee144db88163fff35f9da55f3bb9c5591abfce6ee98 - Sigstore transparency entry: 1572086133
- Sigstore integration time:
-
Permalink:
groupsum/npmctl@0ed62af559fadb57569bbc14e3482e96aa3d5eb7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/groupsum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ed62af559fadb57569bbc14e3482e96aa3d5eb7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file npmctl_cloudflare-0.3.10-py3-none-any.whl.
File metadata
- Download URL: npmctl_cloudflare-0.3.10-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
976351c0936125396d2dbba3c39d5ba06660c29cb5f23cd2244d6466eb6ab33c
|
|
| MD5 |
88eb70779936ac24a6d1cc3c752ec14c
|
|
| BLAKE2b-256 |
be677ff7e3d46449569d74a1f117e072604788ff66571b0fa87fb6c672163358
|
Provenance
The following attestation bundles were made for npmctl_cloudflare-0.3.10-py3-none-any.whl:
Publisher:
release.yml on groupsum/npmctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
npmctl_cloudflare-0.3.10-py3-none-any.whl -
Subject digest:
976351c0936125396d2dbba3c39d5ba06660c29cb5f23cd2244d6466eb6ab33c - Sigstore transparency entry: 1572086177
- Sigstore integration time:
-
Permalink:
groupsum/npmctl@0ed62af559fadb57569bbc14e3482e96aa3d5eb7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/groupsum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ed62af559fadb57569bbc14e3482e96aa3d5eb7 -
Trigger Event:
workflow_dispatch
-
Statement type: