home / mcp / grafana mcp server

Grafana MCP Server

Provides programmatic access to Grafana resources and actions via MCP across dashboards, datasources, incidents, alerts, OnCall, and more.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "grafana-mcp-grafana": {
      "command": "mcp-grafana",
      "args": [
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "<Grafana URL>",
        "GRAFANA_ORG_ID": "<org-id>",
        "GRAFANA_PASSWORD": "<password>",
        "GRAFANA_USERNAME": "<username>",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<service account token>"
      }
    }
  }
}

You run an MCP server that acts as a bridge between Grafana and clients or AI assistants. It exposes Grafana data, dashboards, incidents, alerts, and related resources through a programmable API, letting you search, query, and manage Grafana data from tools and automation.

How to use

Connect your MCP client to Grafana through the two documented ways: a local stdio server you run on your machine, or a Docker-based approach that spawns a container to provide the MCP interface. The server handles data access, querying, and management operations across dashboards, datasources, incidents, alerting, and more.

How to install

Prerequisites: you need Go installed for building from source, or you can use the prebuilt binaries or Docker images. If you plan to run locally in STDIO mode, you will use a binary named mcp-grafana or run it via Docker with an explicit stdio transport.

Install and run using the documented STDIO approach with a locally installed binary or via Docker. Below are concrete steps that mirror the supported options.

{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": [],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>",
        // Optional: specify organization ID if needed
        "GRAFANA_ORG_ID": "1"
      }
    }
  }
}

If you prefer running the MCP server via Docker in STDIO mode, use the following configuration as a guide. It keeps stdin open and passes through the necessary Grafana connection details.

{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "mcp/grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>",
        "GRAFANA_USERNAME": "<your username>",
        "GRAFANA_PASSWORD": "<your password>",
        "GRAFANA_ORG_ID": "1"
      }
    }
  }
}

Additional sections

Configuration notes show how to enable or disable tool categories, how to manage RBAC permissions, and how to run in various transports. The server supports several transports, including stdio, SSE, and streamable HTTP, and you can disable entire categories of tools to reduce the context window you send to the client.

Security and TLS are configurable. Client TLS settings control how the MCP server authenticates to Grafana, while server TLS settings apply when using the streamable HTTP transport.

Debug mode can be enabled to get detailed HTTP request/response logs between the MCP server and Grafana, which helps with troubleshooting.

Health checks are available when using SSE or streamable HTTP transports. The endpoint reports readiness for integration with load balancers and monitoring systems.

Notes and tips

If you see a spawn error like Error: spawn mcp-grafana ENOENT in client apps, provide the full path to the mcp-grafana binary to ensure the client can locate the executable.

Use the provided tooling configuration to tailor which capabilities you expose. You can disable categories such as OnCall, navigation, or Sift tools if you do not need them.