HashiCorp Consul
$ consul 官方出品 高风险HashiCorp Consul CLI(consul)用于查询和管理 Consul 服务目录、健康检查、KV 存储、ACL 与服务网格配置,在 kv export、config read 与 acl ... -format=json 中输出 JSON,并支持 CONSUL_HTTP_TOKEN 认证。
brew install hashicorp/tap/consul consul 通过单文件 Go 二进制直接与本地或远端 Consul HTTP Agent 通信,无需 MCP 封装。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
kv export、config read 与 acl 命令支持 JSON,但 members 与 catalog services 等早期命令仅输出纯文本。
- JSON on
kv export,config read, andacl -format=json; plain text onmembers
细粒度 ACL 令牌(CONSUL_HTTP_TOKEN)权限隔离良好,但递归删除 KV 风险较高且缺少 --dry-run。
- Supports
CONSUL_HTTP_TOKENACL scoping; lacks universal--dry-run
单文件静态 Go 二进制,可通过 Homebrew 与官方包跨平台安装。
- Single Go binary via
brew install hashicorp/tap/consul
适合快速运维排查,但纯 JSON 自动化场景下 Consul /v1/* REST API 往往更一致。
- Quick operator CLI; REST API offers fuller JSON parity
HashiCorp 官方仓库(hashicorp/consul),采用 BSL-1.1 协议维护。
- Official
hashicorp/consulrepository
具备完善的 HashiCorp 官方命令手册与 --help。
- Official docs at developer.hashicorp.com/consul
安全边界、鉴权与放权指南
从环境变量读取 CONSUL_HTTP_ADDR、CONSUL_HTTP_TOKEN、CONSUL_NAMESPACE 以及 TLS 证书配置(CONSUL_CACERT)。
CLI 二进制按 BSL-1.1 免费提供;连接您自有的 Consul 集群。
# Consul CLI Agent Rules - Verify `CONSUL_HTTP_ADDR` and use a read-only `CONSUL_HTTP_TOKEN` during investigation. - Remember `consul kv export` returns base64-encoded values and `members` emits plain text (use `/v1/catalog/...` HTTP API if full JSON is needed). - Never run `consul kv delete -recurse` or `consul force-leave` without explicit human approval.
Agent 高频安全命令配方
只读查询(安全推荐)
consul kv export app/config/
将匹配的 KV 键与 Base64 编码的值导出为 JSON 数组。
consul config read -kind service-defaults -name web
输出当前生效的 Consul 配置条目 JSON。
核心优势
- + 单文件 Go 二进制,原生支持
CONSUL_HTTP_TOKENACL 权限隔离。 - +
consul kv export与consul config read原生输出标准 JSON。 - + 通过标准
CONSUL_*环境变量即可配置 mTLS 客户端证书。
注意事项与踩坑点
- !
consul members与consul catalog services等旧命令不支持-format=json。 - !
kv put、kv delete与config write缺少--dry-run预演模式。