Grafana MCP server

Integrates with Grafana to enable searching dashboards, fetching datasource information, querying Prometheus metrics, and managing incidents through both stdio and SSE transport modes.
Back to servers
Provider
Grafana Labs
Release date
Mar 18, 2025
Language
Go
Stats
757 stars

The Grafana MCP server enables access to your Grafana instance and ecosystem through the Model Context Protocol (MCP). This server lets AI assistants interact with your Grafana dashboards, data sources, incidents, alerts, and more.

Installation

Prerequisites

Create a service account in Grafana with appropriate permissions and generate a service account token. You'll need this token for configuration.

Installation Options

Using Docker

docker pull mcp/grafana
docker run -p 8000:8000 -e GRAFANA_URL=http://localhost:3000 -e GRAFANA_API_KEY=<your service account token> mcp/grafana

Download Binary

Download the latest release from the releases page and place it in your $PATH.

Build from Source

If you have Go installed:

GOBIN="$HOME/go/bin" go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest

Configuration

Claude Desktop Configuration

If using the binary:

{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": [],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_API_KEY": "<your service account token>"
      }
    }
  }
}

If using Docker:

{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-p",
        "8000:8000",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_API_KEY",
        "mcp/grafana"
      ],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_API_KEY": "<your service account token>"
      }
    }
  }
}

VSCode Configuration

For using a remote MCP server with VSCode, include in your .vscode/settings.json:

"mcp": {
  "servers": {
    "grafana": {
      "type": "sse",
      "url": "http://localhost:8000/sse"
    }
  }
}

Debug Mode

Enable debug mode for detailed logging of HTTP requests and responses:

If using the binary:

{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": ["-debug"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_API_KEY": "<your service account token>"
      }
    }
  }
}

If using Docker:

{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-p",
        "8000:8000",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_API_KEY",
        "mcp/grafana",
        "-debug"
      ],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_API_KEY": "<your service account token>"
      }
    }
  }
}

Features and Tools

The MCP server provides access to various Grafana features through tools:

Dashboard Management

  • Search for dashboards
  • Get dashboard by UID
  • Update or create dashboards
  • Get panel information (titles, queries, datasource details)

Data Source Operations

  • List and fetch datasource information
  • Query Prometheus and Loki datasources

Metadata Querying

  • Query Prometheus metadata (metrics, labels)
  • Query Loki metadata (labels, statistics)

Incident Management

  • Search, create, update, and close incidents
  • Start and view Sift investigations

Alerting

  • List and fetch alert rule information
  • Get alert rule statuses
  • List contact points

Grafana OnCall

  • List and manage schedules
  • Get shift details
  • Get current on-call users
  • List teams and users

Administrative Functions

  • List teams

You can disable categories of tools using flags like --disable-oncall when starting the server.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later