home / mcp / grafana mcp server
Provides access to Grafana dashboards, datasources, alerts, incidents, and more via the MCP protocol.
Configuration
View docs{
"mcpServers": {
"0xteamhq-mcp-grafana": {
"command": "npx",
"args": [
"@leval/mcp-grafana"
],
"env": {
"GRAFANA_URL": "https://your-grafana-instance.com",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "glsa_xxxxxxxxxxxx"
}
}
}
}You can run a dedicated MCP server that lets AI assistants interact with Grafana dashboards, datasources, alerts, incidents, and more. This Grafana MCP server is implemented in TypeScript/JavaScript and exposes a set of tools that your AI can call to manage Grafana resources safely through the MCP (Model Context Protocol).
Install and start the MCP server, then connect your MCP client. You will provide Grafana connection details via environment variables, and the MCP server will expose 43 tools for dashboard, datasource, Prometheus, Loki, incidents, alerts, on-call, and other Grafana operations. Use an MCP client of your choice (Claude Desktop, Claude Code, Cursor, Zed, Codex, etc.) and configure it to launch the MCP server as a local stdio process. Once connected, you can ask natural language questions like, βShow me dashboards matching CPU usage,β or βList all data sources and their types,β and the MCP server will execute the corresponding Grafana actions and return structured results.
Prerequisites: Node.js and npm must be installed on your machine. You will run the MCP server locally or install it globally for one-off usage.
Option 1: Install globally and run the MCP Grafana server.
npm install -g @leval/mcp-grafana
npx @leval/mcp-grafanaCreate a configuration file or set environment variables to point the MCP server at your Grafana instance and authorize access.
GRAFANA_URL=https://your-grafana-instance.com
GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_xxxxxxxxxxxx
# Optional for debugging
DEBUG=trueIf you are developing locally, clone the project, install dependencies, and build before running.
git clone https://github.com/levalhq/mcp-grafana.git
cd mcp-grafana
npm install
npm run buildSearch for dashboards by name or content across Grafana.
Retrieve the complete JSON of a dashboard by its UID.
Fetch metadata about a dashboard, such as title and last updated.
Extract specific properties from a dashboard, like panel titles.
Create or update a Grafana dashboard programmatically.
List all configured Grafana datasources.
Get details for a datasource by its UID.
Retrieve a datasource configuration by name.
Execute PromQL queries against configured Prometheus data.
List available Prometheus metric names.
List label names for Prometheus metrics.
Get values for a specific Prometheus label.
Describe metadata for a Prometheus metric.
Run LogQL queries against Loki logs.
Get statistics about Loki log streams.
List label names available in Loki logs.
Show values for a Loki log label.
Analyze logs to identify recurring error patterns.
List active Grafana incidents.
Get details for a specific incident.
Create a new incident with given details.
Add notes or updates to an existing incident.