Grafana CLI
$ gcx Official Med RiskGrafana CLI (gcx) is Grafana Labs' official CLI for Grafana, Grafana Enterprise, and Grafana Cloud—managing dashboards, SLOs, IRM, contexts, and Grafana Assistant. Built with -o json, --agent mode (forces JSON and disables color), --jq filtering, --limit, and keychain-backed credential storage.
brew install gcx gcx excels at local GitOps dashboard pulls (resources pull), --agent/--jq scripting, and CI tokens; Grafana MCP fits interactive natural-language query sessions inside chat hosts.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Features -o json, dedicated --agent mode (JSON + no-color), built-in --jq, --limit, and official agent skills support.
--agentforces JSON output and disables terminal ANSI colors- Built-in
--jqand--limitbound and filter large payloads
Defaults to OS keychain credential storage with path-bound references, supports GCX_KEYCHAIN=off and GRAFANA_TOKEN for CI isolation.
- Keychain-backed token storage prevents plaintext leakage by default
--contextisolates staging vs production Grafana instances
Single Go binary distributed via Homebrew (brew install gcx), go install, and GitHub Releases for macOS, Linux, and Windows.
- Available via
brew install gcxand native releases
Unifies Grafana OSS, Enterprise, and Cloud workflows (dashboards, SLOs, IRM, Assistant) in one CLI.
- Covers
resources,slo,irm,assistant, andcontext
Official Grafana Labs CLI (grafana/gcx) under Apache-2.0 license.
- First-party Grafana Labs open-source project
Thorough Grafana Cloud CLI docs covering keychain policies, flags, billing notes, and agent integrations.
- Official docs at
grafana.com/docs/grafana-cloud/send-data/gcx/
Security, Auth & Guardrails
Stores tokens in OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager) referenced by ~/.config/gcx/config.yaml (override with GCX_KEYCHAIN=off for CI), or reads GRAFANA_SERVER and GRAFANA_TOKEN env vars.
Apache-2.0 open-source CLI; works with free OSS Grafana or paid Grafana Cloud tiers (Assistant/k6/Synthetic usage may bill).
# Grafana CLI (gcx) Agent Rules - Always pass `-o json` (or `--agent`) and explicit `--context <name>` to prevent cross-environment mistakes. - In containers or headless CI, set `GCX_KEYCHAIN=off` and supply `GRAFANA_SERVER` + `GRAFANA_TOKEN`. - Require explicit approval before pushing dashboards, deleting SLOs, or invoking billable Assistant/Synthetic actions.
Agent-Ready Command Recipes
Safe Read-Only Queries
gcx resources pull dashboards -o json --agent
Exports dashboard definitions in machine-readable JSON with ANSI color disabled.
gcx context list -o json --limit 20 --jq '.[].name'
Lists configured Grafana CLI contexts and filters context names natively.
Controlled Writes & Previews
GCX_KEYCHAIN=off gcx context current -o json
Inspects the active Grafana server context without relying on a desktop OS keychain.
Strengths for Agents
- +
--agent,-o json,--jq, and--limitmakegcxfast and token-efficient for agents. - + Secure OS keychain storage by default with clean
GCX_KEYCHAIN=offfallback for headless CI.
Caveats & Pitfalls
- ! Copying
~/.config/gcx/config.yamlacross machines does not transfer keychain-bound tokens. - ! Some Grafana Cloud commands (Assistant, Synthetic Monitoring, k6) trigger usage-based cloud charges.