Cloudflare CLI (cf)
$ cf 官方出品 高风险Cloudflare cf CLI 与 Wrangler 形成互补,面向更广泛的 Cloudflare 公共 API(DNS 记录、Zones、Zero Trust、R2、D1、KV),内置命令检索(cf cli search)、Schema 检查(cf schema)与多 Profile 鉴权。
npm install -g @cloudflare/cli cf 通过动态 cf cli search 与 cf schema 按需查参数,避免一次性把数百个 Cloudflare MCP Schema 塞进上下文。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
天然面向 Agent 发现机制设计:cf cli search、cf schema、JSON 输出及官方配套 cf-cli Skill 显著降低参数幻觉。
- Runtime command discovery (
cf cli search) and schema introspection (cf schema) - Paired with official Cloudflare
cf-cliagent skill
支持命名 Profile 与细粒度 API Token,但线上 DNS、Zone 与安全策略变更具备直接的生产影响面。
- Named profile isolation and scoped
CLOUDFLARE_API_TOKEN - Direct control-plane mutations require user confirmation
通过 npm/npx 跨平台分发,复用标准 Cloudflare 鉴权体系。
- Installable via
@cloudflare/cli
在极低上下文占用的前提下覆盖广泛的 Cloudflare 控制面 API。
- On-demand schema lookup avoids context bloat
Cloudflare 官方出品,当前处于活跃 Beta 演进期。
- Official Cloudflare tool; marked beta with rapid iteration
内置自省式命令帮助输出,并配有官方 Cloudflare Skill 指南。
- Built-in
cf cli searchandcf schemahelp output
安全边界、鉴权与放权指南
将命名 Profile 存储在本地 CLI 配置中,或通过 CLOUDFLARE_API_TOKEN 环境变量传入。
CLI 免费开源;API 操作受对应 Cloudflare 账户套餐与资源配额限制。
# Cloudflare cf CLI Agent Rules - Run `cf cli search` and `cf schema` before constructing unfamiliar API calls. - Always pin `--profile` or verify `CLOUDFLARE_ACCOUNT_ID` before write calls. - Require human confirmation for DNS deletions, firewall rule drops, or billing changes.
Agent 高频安全命令配方
只读查询(安全推荐)
cf cli search "dns"
让 Agent 在执行前先按关键词检索精确的子命令路径。
cf schema zones
直接输出结构化参数与请求体定义,再构造实际命令。
受控写入与预演
cf zones list --profile staging
将操作严格锁定在隔离的测试账号 Profile 下。
核心优势
- +
cf cli search与cf schema直击 Agent 瞎编参数痛点。 - + 将控制面 API 与 Wrangler 的 Workers 构建发布流程清晰拆耦。
- + 支持多 Profile 账号隔离切换。
注意事项与踩坑点
- ! 仍处于 Beta 阶段,小版本间命令面可能持续演进。
- ! 若授予过宽的 API Token,全局 DNS/Zone 变更风险极高。