KosmoKrator

cloud

Cloudflare CLI for AI Agents

Use the Cloudflare CLI from KosmoKrator to call Cloudflare tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

7 functions 6 read 1 write Bearer token auth

Cloudflare CLI Setup

Cloudflare can be configured headlessly with `kosmokrator integrations:configure cloudflare`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure cloudflare --set access_token="$CLOUDFLARE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor cloudflare --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token CLOUDFLARE_ACCESS_TOKEN Secret secret yes API Token
url CLOUDFLARE_URL URL url no API Base URL

Call Cloudflare Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call cloudflare.cloudflare_list_zones '{
  "name": "example_name",
  "status": "example_status",
  "page": 1,
  "per_page": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:cloudflare cloudflare_list_zones '{
  "name": "example_name",
  "status": "example_status",
  "page": 1,
  "per_page": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs cloudflare --json
kosmo integrations:docs cloudflare.cloudflare_list_zones --json
kosmo integrations:schema cloudflare.cloudflare_list_zones --json
kosmo integrations:search "Cloudflare" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Cloudflare.

cloudflare.cloudflare_list_zones

Read read

List all Cloudflare zones (domains). Returns zone IDs, names, status, and plan info. Use this to discover zone identifiers needed for DNS and analytics operations.

Parameters
name, status, page, per_page

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_list_zones '{"name":"example_name","status":"example_status","page":1,"per_page":1}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_list_zones '{"name":"example_name","status":"example_status","page":1,"per_page":1}' --json

cloudflare.cloudflare_get_zone

Read read

Get detailed information about a specific Cloudflare zone, including its ID, name, status, nameservers, and plan.

Parameters
zone_id

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_get_zone '{"zone_id":"example_zone_id"}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_get_zone '{"zone_id":"example_zone_id"}' --json

cloudflare.cloudflare_list_dns_records

Read read

List DNS records for a Cloudflare zone. Returns record IDs, types, names, content, TTL, and proxy status.

Parameters
zone_id, type, name, content, page, per_page

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_list_dns_records '{"zone_id":"example_zone_id","type":"example_type","name":"example_name","content":"example_content","page":1,"per_page":1}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_list_dns_records '{"zone_id":"example_zone_id","type":"example_type","name":"example_name","content":"example_content","page":1,"per_page":1}' --json

cloudflare.cloudflare_create_dns_record

Write write

Create a new DNS record in a Cloudflare zone. Supports A, AAAA, CNAME, MX, TXT, NS, SRV, and other record types.

Parameters
zone_id, type, name, content, ttl, proxied

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_create_dns_record '{"zone_id":"example_zone_id","type":"example_type","name":"example_name","content":"example_content","ttl":1,"proxied":true}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_create_dns_record '{"zone_id":"example_zone_id","type":"example_type","name":"example_name","content":"example_content","ttl":1,"proxied":true}' --json

cloudflare.cloudflare_list_page_rules

Read read

List page rules for a Cloudflare zone. Returns rule IDs, targets, actions, and priority.

Parameters
zone_id, status, page, per_page

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_list_page_rules '{"zone_id":"example_zone_id","status":"example_status","page":1,"per_page":1}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_list_page_rules '{"zone_id":"example_zone_id","status":"example_status","page":1,"per_page":1}' --json

cloudflare.cloudflare_get_analytics

Read read

Get analytics dashboard data for a Cloudflare zone. Returns HTTP requests, bandwidth, threats, and pageview metrics over a time range.

Parameters
zone_id, since, until, continuous

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_get_analytics '{"zone_id":"example_zone_id","since":"example_since","until":"example_until","continuous":"example_continuous"}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_get_analytics '{"zone_id":"example_zone_id","since":"example_since","until":"example_until","continuous":"example_continuous"}' --json

cloudflare.cloudflare_get_current_user

Read read

Get details of the currently authenticated Cloudflare user. Returns user ID, email, username, and account info.

Parameters
none

Generic CLI call

kosmo integrations:call cloudflare.cloudflare_get_current_user '{}' --json

Provider shortcut

kosmo integrations:cloudflare cloudflare_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

cloudflare.cloudflare_list_zones

List all Cloudflare zones (domains). Returns zone IDs, names, status, and plan info. Use this to discover zone identifiers needed for DNS and analytics operations.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_list_zones --json
ParameterTypeRequiredDescription
name string no Filter by zone name (e.g., "example.com").
status string no Filter by status: active, pending, initializing, moved, deleted, deactivated.
page integer no Page number for pagination (default: 1).
per_page integer no Number of zones per page (default: 20, max: 50).

cloudflare.cloudflare_get_zone

Get detailed information about a specific Cloudflare zone, including its ID, name, status, nameservers, and plan.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_get_zone --json
ParameterTypeRequiredDescription
zone_id string yes The zone identifier (e.g., "023e105f4ecef8ad9ca31a8372d0c353").

cloudflare.cloudflare_list_dns_records

List DNS records for a Cloudflare zone. Returns record IDs, types, names, content, TTL, and proxy status.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_list_dns_records --json
ParameterTypeRequiredDescription
zone_id string yes The zone identifier.
type string no Filter by record type: A, AAAA, CNAME, MX, TXT, NS, SRV, etc.
name string no Filter by record name (e.g., "www.example.com").
content string no Filter by record content (e.g., an IP address).
page integer no Page number for pagination (default: 1).
per_page integer no Number of records per page (default: 20, max: 100).

cloudflare.cloudflare_create_dns_record

Create a new DNS record in a Cloudflare zone. Supports A, AAAA, CNAME, MX, TXT, NS, SRV, and other record types.

Operation
Write write
Schema command
kosmo integrations:schema cloudflare.cloudflare_create_dns_record --json
ParameterTypeRequiredDescription
zone_id string yes The zone identifier.
type string yes DNS record type: A, AAAA, CNAME, MX, TXT, NS, SRV, etc.
name string yes DNS record name (e.g., "www.example.com" or "@" for the zone root).
content string yes DNS record content (e.g., "192.0.2.1" for an A record).
ttl integer no Time to live in seconds. Use 1 for automatic ("Auto" TTL). Default: 1.
proxied boolean no Whether the record is proxied through Cloudflare (orange cloud). Default: false.

cloudflare.cloudflare_list_page_rules

List page rules for a Cloudflare zone. Returns rule IDs, targets, actions, and priority.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_list_page_rules --json
ParameterTypeRequiredDescription
zone_id string yes The zone identifier.
status string no Filter by status: active, disabled.
page integer no Page number for pagination (default: 1).
per_page integer no Number of rules per page (default: 20).

cloudflare.cloudflare_get_analytics

Get analytics dashboard data for a Cloudflare zone. Returns HTTP requests, bandwidth, threats, and pageview metrics over a time range.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_get_analytics --json
ParameterTypeRequiredDescription
zone_id string yes The zone identifier.
since string no Start time: ISO 8601 date or relative offset like "-30d", "-7d", "-24h". Default: "-30d".
until string no End time: ISO 8601 date or "now". Default: "now".
continuous string no Whether to include continuous data ("true" or "false"). Default: "true".

cloudflare.cloudflare_get_current_user

Get details of the currently authenticated Cloudflare user. Returns user ID, email, username, and account info.

Operation
Read read
Schema command
kosmo integrations:schema cloudflare.cloudflare_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.