Skip to content
Development
Skill

/setup-gcx

Installs and configures gcx: contexts, authentication, connection to Grafana Cloud or on-premise Grafana, env var overrides for CI/CD, default datasources. Use for first-time setup, or when gcx fails with auth or connection errors (401, 403, connection refused, missing

From plugin
gcx
81024 skills1 agent

Claude Code

$ npx -y skills add grafana/gcx --skill setup-gcx --agent claude-code

SKILL.md

setup-gcx.SKILL.md
name: setup-gcx
description: >-
  Installs and configures gcx: contexts, authentication, connection to Grafana
  Cloud or on-premise Grafana, env var overrides for CI/CD, default datasources.
  Use for first-time setup, or when gcx fails with auth or connection errors
  (401, 403, connection refused, missing namespace).

Setup gcx

Three configuration paths: Grafana Cloud (Path A), on-premise (Path B), and environment variables for CI/CD (Path C). For the complete config reference (all `config set` paths, TLS options, namespace resolution rules, multi-context patterns), see [configuration.md](references/configuration.md).

Step 0: Install gcx

First, check whether gcx is already installed:

gcx --version

If the command is not found, build it from source. Requires [git](https://git-scm.com/) and a recent [Go](https://go.dev/) toolchain:

tmp=$(mktemp -d) && git clone --depth 1 https://github.com/grafana/gcx.git "$tmp" && (cd "$tmp" && go install ./cmd/gcx) && rm -rf "$tmp"

After installing, verify the binary is on PATH:

gcx --version

Configuration Model

gcx uses a context-based configuration model inspired by kubectl's kubeconfig. One or more layered YAML files (with the user file at `~/.config/gcx/config.yaml` by default) store named `stacks` (Grafana destination, credentials, provider config), named `cloud` entries (Grafana Cloud platform credentials and endpoints), and thin `contexts` that reference a stack and optional Cloud entry. One context is selected at a time; all commands operate against it unless overridden. Single-source legacy configs are migrated automatically after a safe preflight. When several layers participate, gcx converts them in memory and asks the user to migrate each layer explicitly rather than partially persisting the result.

Use `gcx config view` to inspect the current configuration at any time. Use `gcx config check` to validate that the active context is correct and can reach the server.

---

Path A: Grafana Cloud

Use this path when connecting to a Grafana Cloud instance (URLs ending in `.grafana.net`).

**No Grafana Cloud account yet?** Skip Steps 1 to 4 and run:

gcx signup cloud

It opens the Grafana Cloud sign-up page (in agent mode it prints the URL for the user to open). The user creates the account, verifies their email, creates a first stack, and approves "Connect gcx"; gcx then saves the connection to the `cloud` context and makes it current. A browser already signed in to Grafana Cloud skips sign-up and asks for one of that account's stacks, or goes straight to "Connect gcx" with one organization and one stack; the user then approves as usual. To create a separate account instead, the user signs out of Grafana Cloud in that browser first. Signup asks no questions, and it only saves a new connection, so it refuses a context or stack entry that already exists: do not run Step 1 first. If it fails once the browser step has started, run the `gcx login` command the error shows, not `gcx signup` again, which could start a second account. It saves no Grafana Cloud management credentials; for Cloud product APIs (SLOs, Synthetic Monitoring, k6), add a Cloud Access Policy token afterwards with `gcx cloud login --context cloud --cloud-token <token>`.

Step 1: Create a stack and context

gcx config set stacks.cloud.grafana.server https://myorg.grafana.net
gcx config set contexts.cloud.stack cloud

Replace `cloud` with any name you prefer (e.g., `prod`, `myorg-cloud`). Replace the server URL with your Grafana Cloud URL. The first command creates the stack entry; the second creates a context pointing at it.

Step 2: Authenticate

**Option A-1: Browser OAuth (recommended for Grafana Cloud)**

gcx login cloud --server https://myorg.grafana.net --oauth

Opens a browser for the user to approve. This works non-interactively and in agent mode — the agent issues the command, the browser opens, and the user approves. No token to create or paste. `gcx login` also sets the context as current and verifies connectivity, so Steps 1, 3, and 4 are handled for you; skip them when using this option.

**Option A-2: Service account token**

gcx config set stacks.cloud.grafana.token glsa_XXXXXXXXXXXXXXXX

Obtain a service account token from **Administration > Service accounts** in your Grafana Cloud instance. The token must have sufficient permissions for the operations you intend to run (Viewer for read-only, Editor or Admin for write operations).

The `grafana.token` field takes precedence over `grafana.user`/`grafana.password` when both are present.

Grafana Cloud product APIs use a separate credential. A Cloud Access Policy token has the widest compatibility and can be supplied during unified login:

gcx login cloud --server https://myorg.grafana.net \
  --token glsa_XXXXXXXXXXXXXXXX --cloud-token glc_XXXXXXXXXXXXXXXX --yes

For interactive use, the Cloud step of `gcx login` can keep an existing CAP or unexpired OAuth credential, accept a CAP, run the experimental direct Cloud OAuth flow, or skip. `gcx cloud login --context cloud` runs direct Cloud OAuth separately. OAuth retains expiry, granted scopes, and its coherent OAuth/API endpoint pair, but not every Cloud product command supports it yet; use a CAP for full compatibility.

Step 3: Switch to the context

gcx config use-context cloud

Step 4: Verify the connection

gcx config check

A successful check prints the active context name and server URL without errors. For Grafana Cloud, the stack ID (namespace) is auto-discovered from the server's `/bootdata` endpoint -- you do not need to set `grafana.stack-id` manually unless auto-discovery fails.

If the discovered stack ID conflicts with a manually configured `grafana.stack-id`, gcx raises a validation error - see [Namespace resolution issues](#namespace-resolution-issues).

---

Path B: On-Premise Grafana

Use

Read more
@grafana
Ships withgcx

gcx is Grafana in your terminal and your agentic coding environment. With gcx you don't guess, but check the actual data.

81024 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
810
Star history of grafana/gcx on GitHub, a chart by star-history.com

Other skills on gcx.

agento11y-instrument

agento11y-instrument

Instruments a developer's own LLM app or repairs missing generations and empty Performance charts in Grafana Agent Observability.…

@grafana@grafanaInstall Skill
agento11y-prod-setup

agento11y-prod-setup

Sets up production evaluation for a deployed AI agent in Agent Observability: online eval rules and guards (redact PII, block…

@grafana@grafanaInstall Skill
agento11y-test-starter

agento11y-test-starter

Builds a starter offline test suite for an AI agent before it ships: test cases from its code, scoring advice, and a runner stub.…

@grafana@grafanaInstall Skill
agento11y

agento11y

Inspects and manages Grafana Agent Observability resources via gcx: conversations, generations, experiments, evaluators, rules,…

@grafana@grafanaInstall Skill
create-dashboard

create-dashboard

Designs and creates Grafana dashboards with gcx, with `gcx dashboards snapshot` as a visual feedback loop. Use to build a new…

@grafana@grafanaInstall Skill
debug-with-grafana

debug-with-grafana

Investigates application problems and incidents with Grafana metrics, logs, and traces via gcx: errors, latency, regressions,…

@grafana@grafanaInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc13d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about setup-gcx.

Which coding agents can use setup-gcx?
setup-gcx installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.