Skip to main content
← Back to Articles
mcpgrafanacursorideobservabilitydevopssetup2026

Grafana MCP Server Setup for Cursor IDE (2026): Query Dashboards & Alerts from Chat

Connect Grafana to Cursor IDE with the official mcp-grafana server: service account token, Docker or Go binary setup, and prompts for querying dashboards, Prometheus/Loki data, and alerts.

By Web MCP GuideJuly 23, 20269 min read


Grafana MCP Server Setup for Cursor IDE (2026)

The Grafana MCP server (mcp-grafana, maintained by Grafana Labs) lets Cursor's AI search your dashboards, query connected Prometheus and Loki data sources, and check alert rule status directly from chat — so "is anything on fire right now" doesn't require tabbing over to a browser. You'll need a Grafana service account token and either Docker or Go installed to run it.

Unlike most MCP servers covered on this site, mcp-grafana isn't a Node package — it's a Go binary, distributed as a standalone executable or a Docker image. If you've been running everything through npx so far, this one setup step is different, and it's worth knowing before you try npx @grafana/mcp-grafana and get a "package not found" error for a package that was never published under that name.

What You Get


  • Search and read dashboards — find the right dashboard by name or content without clicking through folders

  • Query Prometheus and Loki data sources — run instant or range queries against whatever's already connected to your Grafana instance

  • Check alert rules — see which alerts are firing, pending, or resolved, and what their current state is

  • List data sources and their configuration — useful when you're not sure which data source backs a given panel
  • The practical use case is faster incident triage: instead of opening Grafana, finding the right dashboard, and reading a graph, you ask Cursor "what's the current error rate on the checkout service" and it queries the data source directly.

    Prerequisites


  • Cursor IDE 0.43 or later

  • A Grafana instance (Grafana Cloud or self-hosted), with Viewer-level access at minimum

  • Either Docker, or Go 1.21+ if you'd rather build the binary yourself

  • Admin or Editor rights to create a service account, or someone who can create one for you
  • Create a Grafana Service Account Token

    Grafana deprecated plain API keys in favor of service accounts a while back, and mcp-grafana expects the latter.

    1. In Grafana, go to Administration → Users and access → Service accounts
    2. Click Add service account, give it a name like cursor-mcp
    3. Assign it a role — Viewer is enough for read-only dashboard and alert queries; give it Editor only if you specifically want the AI able to modify dashboards
    4. Open the new service account and click Add service account token
    5. Copy the token immediately — Grafana Cloud tokens typically start with a prefix like glsa_, and like most tokens, it won't be shown again

    Note your Grafana URL too — https://yourorg.grafana.net for Grafana Cloud, or your internal URL (e.g. http://localhost:3000 or an internal DNS name) for self-hosted.

    Run the Server: Docker (Simplest)

    {
    "mcpServers": {
    "grafana": {
    "command": "docker",
    "args": [
    "run", "--rm", "-i",
    "-e", "GRAFANA_URL",
    "-e", "GRAFANA_SERVICE_ACCOUNT_TOKEN",
    "mcp/grafana"
    ],
    "env": {
    "GRAFANA_URL": "https://yourorg.grafana.net",
    "GRAFANA_SERVICE_ACCOUNT_TOKEN": "glsa_xxxxxxxxxxxxxxxxxxxx"
    }
    }
    }
    }

    Check the current image name and tag on Docker Hub or the grafana/mcp-grafana GitHub repo before pasting this in — image names and the exact environment variable used for the token have shifted between releases (some versions read GRAFANA_API_KEY instead of GRAFANA_SERVICE_ACCOUNT_TOKEN for the same value), so match whatever the README for the version you're pulling actually documents.

    Run the Server: Go Binary (No Docker)

    go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest

    Then point Cursor at the installed binary:

    {
    "mcpServers": {
    "grafana": {
    "command": "mcp-grafana",
    "env": {
    "GRAFANA_URL": "https://yourorg.grafana.net",
    "GRAFANA_SERVICE_ACCOUNT_TOKEN": "glsa_xxxxxxxxxxxxxxxxxxxx"
    }
    }
    }
    }

    If Cursor can't find the mcp-grafana command, confirm $(go env GOPATH)/bin is on your PATHgo install puts the binary there, not in a location Cursor searches by default.

    Restart Cursor fully after either setup so the new server registers.

    Verify the Connection

    List the dashboards in my Grafana instance

    or

    Are any alerts currently firing?

    A response naming real dashboards or alert states means it's working. An empty or generic-sounding answer usually means the token's role doesn't have visibility into the folders or data sources you expected — check the service account's permissions before assuming the MCP config is wrong.

    Prompts for Real Incidents

    Quick health check:

    Check the current error rate and p99 latency for the payments service and tell me if either looks abnormal compared to typical

    Alert triage:

    List any alerts in a firing state right now, grouped by severity, and summarize what each one is monitoring

    Digging into logs during an incident:

    Query Loki for error-level logs from the checkout-service in the last 30 minutes and summarize the most common error message

    Dashboard discovery:

    Find the dashboard that shows database connection pool usage — I don't remember which folder it's in

    Because the model needs to know which data source a query should target, prompts that name the service or dashboard explicitly work more reliably than vague ones — "the payments service" beats "the important one."

    Data Source UIDs Trip People Up

    Grafana identifies each data source by a UID, not its display name, and the MCP server's query tools generally expect that UID under the hood even though your prompt can reference the name. If Cursor queries the wrong data source or comes back empty, check that there isn't a naming collision — for example two Prometheus instances both labeled "Prometheus" in different folders. Renaming data sources to be unambiguous (prod-prometheus, staging-prometheus) avoids most of this confusion.

    Grafana Cloud vs. Self-Hosted

    The setup is identical apart from the URL and network reachability. Grafana Cloud just works once the token and URL are right. Self-hosted Grafana behind a VPN or internal network means the machine running Cursor (and, if you're using the Docker approach, the Docker daemon) needs actual network access to that instance — a token that's valid but unreachable produces a timeout, not an auth error, which is a useful distinction when debugging.

    Troubleshooting

    "401 Unauthorized" or "403 Forbidden"
    The service account role is too low for the operation, or the token was copied with extra whitespace. Re-generate the token and paste carefully rather than debugging the role first — a malformed token is the more common cause.

    Timeout with no error message
    Almost always a network reachability issue for self-hosted instances, not a bad token. Confirm you can reach GRAFANA_URL from the same machine running Cursor — curl -I $GRAFANA_URL should return something, not hang.

    Docker container exits immediately
    Run the same docker run command directly in a terminal without Cursor to see the actual error — Cursor's MCP panel often just shows "disconnected" without surfacing the underlying Docker error.

    Queries return data but it's for the wrong data source
    See the UID note above — check for duplicate data source names across folders or Grafana Cloud stacks.

    Frequently Asked Questions

    Q: Do I need Grafana Cloud, or does this work with a self-hosted instance?
    A: Both. The only difference is the GRAFANA_URL value and making sure the machine running the MCP server can actually reach it — self-hosted instances behind a VPN need that network path open.

    Q: Can the AI create or edit dashboards, or is this read-only?
    A: It depends on the service account's role. A Viewer-role token limits the server to read operations — searching dashboards, running queries, checking alerts. An Editor-role token opens up write operations if the server version you're running supports them; start with Viewer unless you specifically want write access.

    Q: Why isn't there an npx option like the other MCP servers on this site?
    A: mcp-grafana is written in Go, not Node.js, so it doesn't ship as an npm package. Docker or a native Go binary are the two supported paths — there's no functional downside, it's just a different install step than the JavaScript-based servers most guides here cover.

    Q: Does this work with Datadog or other monitoring tools too?
    A: No — this server is specific to Grafana and whatever data sources are connected to your Grafana instance (commonly Prometheus and Loki). A Datadog MCP integration, where it exists, is a separate server with its own setup.

    Related Guides


  • Docker MCP Server Setup Guide (2026)

  • Terraform MCP Server: Cursor IDE Setup (2026)

  • AWS MCP Server: Cursor IDE Setup (2026)

  • Cloudflare MCP Server: Cursor IDE Setup (2026)
  • ---


    Related guides