Grafana MCP Server

by christian-schlichtherle

247 downloads Not rated yet
GitHub

About

An MCP server for the comprehensive discovery, editing, and testing of dashboards and folders in one or more Grafana clusters.

Explore

+ Dashboard Protection: When creating Grafana dashboards, the MCP server labels them to mark itself as the origin
+ Selective Modification: Only dashboards with required protection labels can be updated or deleted
+ Unrestricted Reading: No restrictions for reading dashboards, allowing enhancement of existing dashboards by copying them
+ Folder Restrictions: Configurable access control to specific folders and subfolders
+ Multi-Cluster Support: Manage dashboards across multiple Grafana instances
+ Comprehensive Search: Full support for Grafana's search API with filtering options

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Grafana MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository


uv sync
python main.py

Configure the MCP server using these environment variables:

bash

export GRAFANA_TOKENS="dev=glsa_yyy prod=glsa_zzz" # Note: localhost has no token (unauthenticated)

For local development, you can run Grafana in a Docker container without authentication:


docker run -d \
  -p 3000:3000 \
  -e "GF_AUTH_ANONYMOUS_ENABLED=true" \
  -e "GF_AUTH_ANONYMOUS_ORG_ROLE=Admin" \
  -e "GF_AUTH_BASIC_ENABLED=false" \
  --name grafana \
  grafana/grafana:latest

export GRAFANA_CLUSTERS="localhost=http://localhost:3000"

You can mix authenticated and unauthenticated clusters:

bash

For production or authenticated Grafana clusters, you need to create service account tokens. Service accounts are the recommended way to authenticate with Grafana's HTTP API (API keys are deprecated).

Note: Skip this section if you're only using local unauthenticated Grafana instances.

The MCP server automatically adds the Bearer token to all requests:

Authorization: Bearer glsa_abc123def456

For more information, see the official Grafana documentation on service accounts.

1. Install dependencies:

   uv sync

python

clusters = list_clusters()

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "grafana mcp server": {
            "grafana": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/ABSOLUTE/PATH/TO/grafana-mcp",
                    "run",
                    "main.py"
                ],
                "env": {
                    "GRAFANA_CLUSTERS": "local=http://localhost:3000 dev=https://dev.example.com/grafana",
                    "GRAFANA_TOKENS": "dev=glsa_abc123xyz"
                }
            }
        }
    }
}

McpServers

{
    "grafana": {
        "command": "uv",
        "args": [
            "--directory",
            "/ABSOLUTE/PATH/TO/grafana-mcp",
            "run",
            "main.py"
        ],
        "env": {
            "GRAFANA_CLUSTERS": "local=http://localhost:3000 dev=https://dev.example.com/grafana",
            "GRAFANA_TOKENS": "dev=glsa_abc123xyz"
        }
    }
}

This repository provides an MCP (Model Context Protocol) server for the comprehensive discovery, editing, and testing
of dashboards and folders in one or more Grafana clusters.
Its security model is based on labels and folders.

Quick Start

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.