Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install assistant-mcp@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin assistant-mcp v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install assistant-mcp

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/assistant-mcp/

Extract the ZIP to .github/skills/ in your repo. The folder name must match assistant-mcp for Copilot to auto-discover it.

Skill Files (4)

SKILL.md 4.8 KB
---
name: assistant-mcp
license: Apache-2.0
description: Connect AI coding agents (Claude Code, Cursor, VS Code, OpenAI Codex) to Grafana Cloud via the `mcp-grafana` Model Context Protocol server. Installs the server with `go install`, generates a Grafana service-account token, wires `~/.claude/settings.json` or `~/.cursor/mcp.json` with the `command` + `env` block, runs `--disable-write` for safer read-only sessions, switches to SSE transport for team-shared / VS Code setups, and verifies with `/mcp` + a `list_datasources` round-trip. Use when connecting Claude Code to Grafana, setting up MCP for Grafana, configuring the Grafana MCP server, using Grafana tools in Cursor/VS Code, querying Grafana from an AI agent, sharing the MCP server across a team — even when the user says "give my agent Grafana access", "let Claude see my metrics", or "Cursor + Grafana" without saying "MCP".
---

# Grafana Cloud MCP Server Setup

The Grafana MCP server exposes Grafana Cloud capabilities as tools that AI agents can call via the Model Context Protocol. Agents can then query metrics, search dashboards, manage alerts, investigate incidents, and interact with Fleet Management without leaving the coding environment.

Transports: `stdio` (agent spawns the server as a subprocess, simplest), or `SSE` (server runs independently, agents connect via HTTP — see [references/sse-transport.md](references/sse-transport.md)).

## Common Workflows

### Connecting Claude Code to Grafana (stdio)

```bash
# 1. Install the server
go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest

# 2. Verify the binary
mcp-grafana --version
# If "command not found": ensure $GOPATH/bin (or $HOME/go/bin) is on PATH.
```

3. **Get a service-account token**: Grafana Cloud → Administration → Service Accounts → create with `Viewer` role (add `Editor` only if you need writes) → generate token. Note the Grafana URL (e.g. `https://myorg.grafana.net`).

4. **Wire `~/.claude/settings.json`** (or project-local `.claude/settings.json`):

   ```json
   {
     "mcpServers": {
       "grafana": {
         "command": "mcp-grafana",
         "args": ["--disable-write"],
         "env": {
           "GRAFANA_URL": "https://myorg.grafana.net",
           "GRAFANA_API_KEY": "glsa_xxxx"
         }
       }
     }
   }
   ```

   `--disable-write` is the safer default — drop it once you've verified the read path works.

5. **Restart Claude Code, then verify**:

   ```
   /mcp
   ```

   The `grafana` server should appear with its tool list. Then ask:

   ```
   What data sources are configured in my Grafana instance?
   ```

   A clean response = working. If the tool call fails:
   - Check `GRAFANA_URL` has no trailing slash
   - Confirm the API key hasn't expired
   - Re-run with `mcp-grafana --debug` to see raw request/response

### Connecting Cursor

Same Grafana token. Settings → Features → MCP Servers (or edit `~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": ["--disable-write"],
      "env": {
        "GRAFANA_URL": "https://myorg.grafana.net",
        "GRAFANA_API_KEY": "glsa_xxxx"
      }
    }
  }
}
```

Verify the same way — Cursor surfaces MCP servers in its agent panel; run a query like "list dashboards tagged kubernetes".

### Sharing the server across a team (SSE)

Switch from `stdio` to `SSE` so the server runs once and many agents connect to it. Full setup with VS Code config in [references/sse-transport.md](references/sse-transport.md).

## Security considerations

- API keys belong in env vars or a secrets manager — never in committed files.
- Use `--disable-write` for shared environments and CI; only lift it on the specific machine where the agent should be allowed to mutate Grafana.
- Scope service-account permissions to the minimum: `Viewer` is enough for queries and dashboard reads. Only grant `Editor` when the agent needs to create dashboards or annotations.
- Rotate tokens periodically via Administration → Service Accounts.

## References

- [`references/tools.md`](references/tools.md) — full list of MCP tools exposed (query / dashboard / alerting / Fleet Management / annotations) and how to discover the live set
- [`references/sse-transport.md`](references/sse-transport.md) — SSE setup for team sharing and VS Code, with stdio-vs-SSE decision matrix + common failure modes
- [`references/a2a.md`](references/a2a.md) — Agent-to-Agent (A2A) protocol for delegating reasoning to the Grafana Assistant (vs direct tool calls via MCP)

## External resources

- [Grafana MCP server (github.com/grafana/mcp-grafana)](https://github.com/grafana/mcp-grafana)
- [Model Context Protocol specification](https://spec.modelcontextprotocol.io/)
- [Grafana Cloud API documentation](https://grafana.com/docs/grafana-cloud/developer-resources/api-reference/)
- [Grafana Assistant documentation](https://grafana.com/docs/grafana-cloud/machine-learning/assistant/)
references/
a2a.md 1.1 KB
# Grafana Assistant A2A (Agent-to-Agent)

The Grafana Assistant supports the Agent-to-Agent (A2A) protocol for programmatic agent integration. External agents discover Grafana agents via the standard Agent Card endpoint:

```
GET https://<GRAFANA_ASSISTANT_HOST>/.well-known/agent.json
```

Returns an Agent Card describing the supervisor agent's capabilities. Use this when building agents that need to delegate observability reasoning (e.g. a multi-agent system where one agent specializes in Grafana queries while another handles other domains).

This is distinct from the MCP server in the parent skill:

| MCP server | A2A protocol |
|---|---|
| Direct tool access — agent calls `query_prometheus` etc. | Agent delegates a higher-level task ("investigate the spike") to the Assistant |
| Caller does its own reasoning | Assistant does the reasoning, returns a synthesized answer |
| `stdio` or SSE transport | HTTP, well-known endpoint |

For most coding-agent integration, MCP is what you want. A2A is for orchestrator agents delegating to specialized Assistant agents.
sse-transport.md 1.2 KB
# SSE transport — for team sharing or VS Code

Default transport is `stdio` (agent spawns the server as a subprocess). For shared / long-lived servers, run as SSE.

## Run as SSE server

```bash
GRAFANA_URL=https://myorg.grafana.net \
GRAFANA_API_KEY=glsa_xxxx \
mcp-grafana --transport sse --port 3001
```

Point agents at `http://localhost:3001/sse`.

## VS Code MCP extension config

In `settings.json`:

```json
{
  "mcp.servers": {
    "grafana": {
      "type": "sse",
      "url": "http://localhost:3001/sse"
    }
  }
}
```

## When to pick SSE over stdio

| stdio | SSE |
|---|---|
| Single user, single machine | Multiple users / shared dev container |
| Agent spawns + tears down per session | Long-lived server, multiple agents connect |
| Credentials live in agent config | Credentials live in the SSE process env |

## Common failure modes

| Symptom | Likely cause |
|---|---|
| Agent can't reach `http://localhost:3001/sse` | Server isn't running, or port conflict — `lsof -i :3001` |
| 401 on every tool call | `GRAFANA_API_KEY` wasn't passed to the SSE process env |
| SSE connection drops after a few minutes | Firewall / proxy timing out idle HTTP streams — set keep-alive on the proxy |
tools.md 1.8 KB
# Available MCP tools

Tools exposed by the Grafana MCP server once connected. The agent calls these by name; this reference is what's available.

## Contents

- [Query tools](#query-tools)
- [Dashboard tools](#dashboard-tools)
- [Alerting + incident tools](#alerting--incident-tools)
- [Fleet Management tools](#fleet-management-tools)
- [Annotation tools](#annotation-tools)

## Query tools

- `query_prometheus` — run PromQL queries against Grafana Cloud Metrics
- `query_loki` — run LogQL queries against Grafana Cloud Logs
- `query_tempo` — run TraceQL queries against Grafana Cloud Traces
- `list_datasources` — enumerate configured data sources

## Dashboard tools

- `search_dashboards` — find dashboards by name, tag, or folder
- `get_dashboard` — retrieve full dashboard JSON
- `create_dashboard` — create or update a dashboard (requires Editor role + writes not disabled)

## Alerting + incident tools

- `list_alert_rules` — list firing and pending alerts
- `get_alert_rule` — details for a specific alert rule
- `list_incidents` — list active incidents (requires IRM)

## Fleet Management tools

Available if `grafana-collector-app` is installed:

- `list_collectors` — list Alloy collectors and their health
- `list_pipelines` — list remote configuration pipelines
- `get_pipeline` — fetch pipeline YAML

## Annotation tools

- `list_annotations` — search dashboard annotations by time range
- `create_annotation` — add an annotation to a dashboard

## How the agent discovers tools

Once connected, run `/mcp` in Claude Code (or the equivalent in Cursor / VS Code) to see the live list. The list above is the canonical set as of the current `mcp-grafana` release; new tools are added in releases, see [github.com/grafana/mcp-grafana releases](https://github.com/grafana/mcp-grafana/releases).

License (Apache-2.0)

View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/grafana/skills/blob/main/LICENSE