Grafana MCP
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.
Potencia tu agente
Instalación del publicador. No es un endpoint de PlugMCP.
Host a copy with our keys and logs.
Aún no hay una versión empaquetada en el registro. Sigue el README del repositorio.
¿URL remota o un comando en tu máquina? En qué se diferencian las dos instalaciones
Ejecutar en PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
AbrirDel publicador
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.
An MCP server for the comprehensive discovery, editing, and testing of dashboards and folders in one or more Grafana clusters.
# Install and run with zero configuration (uses localhost:3000 by default)
uv sync
python main.py
# That's it! The server is ready to use with your local Grafana instance.
Discover and explore Grafana resources across clusters.
list_clusters() - List all configured Grafana cluster namescheck_cluster_health(cluster: str) - Check health and connectivity of a Grafana clustersearch(cluster: str, *, query: str = "", tags: list = [], starred: bool = False, folder_uids: list = [], dashboard_uids: list = [], dashboard_ids: list = [], type: str = "", limit: int = 1000, page: int = 1) - Search dashboards and folders with comprehensive filtering optionsread_dashboard(cluster: str, dashboard_uid: str) - Read any dashboard configuration and metadata (no restrictions)inspect_dashboard(cluster: str, dashboard_uid: str) - Detailed structural analysis of dashboard panels, variables, datasources, and layoutlist_folders(cluster: str, *, parent_uid: str = "") - List folders, optionally under a parent folderget_folder(cluster: str, folder_uid: str) - Get detailed folder information including hierarchy and permissionslist_datasources(cluster: str) - List all datasources in cluster with name, type, UID, and metadataCreate, modify, and manage Grafana resources with security controls.
create_dashboard(cluster: str, dashboard_json: dict, *, folder_uid: str = "") - Create new dashboard with automatic protection labelsupdate_dashboard(cluster: str, dashboard_uid: str, dashboard_json: dict) - Update existing dashboard (requires protection labels)delete_dashboard(cluster: str, dashboard_uid: str) - Delete dashboard (requires protection labels)copy_dashboard(source_cluster: str, source_uid: str, new_title: str, *, target_cluster: str = "", folder_uid: str = "", target_uid: str = "") - Copy dashboard with intelligent UID handling and auto-overwrite capabilitiescreate_folder(cluster: str, title: str, *, parent_uid: str = "") - Create new folder, optionally as subfolderupdate_folder(cluster: str, folder_uid: str, title: str, *, parent_uid: str = "") - Update/rename/move folder to different parentdelete_folder(cluster: str, folder_uid: str, *, force_delete_rules: bool = False) - Delete folder with optional alert rule cleanupValidate, test, and analyze dashboard quality and data accuracy.
validate_dashboard(cluster: str, dashboard_uid: str) - Comprehensive schema validation and best practices checkingcompare_dashboards(cluster: str, dashboard_uid_a: str, dashboard_uid_b: str, *, compare_cluster_b: str = "") - Compare two dashboards showing structural and configuration differencessnapshot_dashboard(cluster: str, dashboard_uid: str, *, snapshot_name: str = "", expires_hours: int = 24, time_from: str = "now-6h", time_to: str = "now") - Create snapshot with current data for inspection and testingtest_panel_render(cluster: str, dashboard_uid: str, panel_id: int, *, width: int = 1000, height: int = 500, time_from: str = "now-6h", time_to: str = "now", save_to_file: str = "") - Render panel as PNG for visual validationConfigure the MCP server using these environment variables:
# Cluster URLs (space-separated key=value pairs, defaults to "localhost=http://localhost:3000")
export GRAFANA_CLUSTERS="localhost=http://localhost:3000 dev=https://grafana.dev.example.com prod=https://grafana.prod.example.com"
# Cluster API tokens (space-separated key=value pairs, optional)
# Only required for clusters that need authentication
export GRAFANA_TOKENS="dev=glsa_yyy prod=glsa_zzz" # Note: localhost has no token (unauthenticated)
# Protection labels (space-separated, defaults to "MCP")
export GRAFANA_LABELS="MCP Claude"
# Folder restriction (defaults to "/" for root access)
export GRAFANA_FOLDER=/MCP
For local development, you can run Grafana in a Docker container without authentication:
# Run Grafana 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
# Configure MCP server for unauthenticated local access
export GRAFANA_CLUSTERS="localhost=http://localhost:3000"
# No GRAFANA_TOKENS needed!
# Or use the default configuration (no environment variables needed!)
# This defaults to localhost=http://localhost:3000 without authentication
# Run the MCP server
python main.py
You can mix authenticated and unauthenticated clusters:
# Local without auth, production with auth
export GRAFANA_CLUSTERS="localhost=http://localhost:3000 prod=https://grafana.prod.com"
export GRAFANA_TOKENS="prod=glsa_abc123" # Only prod needs a token
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.
Create Service Account:
Viewer, Editor, or AdminGenerate Token:
# Create service account
curl -X POST -H "Content-Type: application/json" \
-d '{"name": "mcp-server", "role": "Editor"}' \
http://admin:admin@localhost:3000/api/serviceaccounts
# Create token for the service account (use ID from previous response)
curl -X POST -H "Content-Type: application/json" \
-d '{"name": "mcp-token"}' \
http://admin:admin@localhost:3000/api/serviceaccounts/{id}/tokens
Tokens should be prefixed with glsa_ and used in the GRAFANA_TOKENS environment variable:
export GRAFANA_TOKENS="prod=glsa_abc123def456 dev=glsa_xyz789uvw012"
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.
Install dependencies:
uv sync
# or
pip install -e .
Set environment variables (see Configuration section above)
Run the MCP server:
python main.py
The server will validate your configuration and start the MCP server, making all tools available to MCP clients.
# List all configured clusters
clusters = list_clusters()
# Returns: ["localhost", "prod"]
# Explore folder hierarchy
root_folders = list_folders("prod") # List root-level folders
subfolders = list_folders("prod", parent_uid="folder123") # List subfolders
# Search for dashboards and folders
dashboards = search("prod", query="monitoring", tags=["production"])
folders_only = search("prod", type="dash-folder", query="team")
dashboards_only = search("prod", type="dash-db", starred=True)
# Create and manage folders
folder = create_folder("prod", "Team Alpha", parent_uid="parent123")
updated = update_folder("prod", "folder123", "New Name", parent_uid="new_parent")
# Copy a dashboard into a specific folder
new_dash = copy_dashboard("prod", "abc123def", "My New Dashboard", folder_uid="folder123")
# Create a dashboard with protection labels automatically added
result = create_dashboard("prod", {
"title": "Test Dashboard",
"panels": [...],
"tags": ["custom"] # MCP labels will be automatically added
}, folder_uid="folder123")
An MCP server for the comprehensive discovery, editing, and testing of dashboards and folders in one or more Grafana clusters.
Herramientas
Aún no hay lista de herramientas. Los servidores remotos la reciben tras la primera comprobación de estado.
Preguntas frecuentes
Copia en esta página la configuración stdio para Cursor, Claude Desktop, Claude Code o VS Code. Usa la instalación del publicador, no un proxy de PlugMCP.
Este registro no indica ninguna variable de entorno obligatoria.
Grafana se ejecuta localmente por stdio.
Última comprobación: 2026-10-27. An MCP server for the comprehensive discovery, editing, and testing of dashboards and folders in one or more Grafana clusters.