- Home
- MCP servers
- Grafana
Grafana
- typescript
1
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
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).
How to use
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.
How to install
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-grafana
Environment setup for Grafana access
Create 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=true
Local development workflow
If 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 build
Available tools
search_dashboards
Search for dashboards by name or content across Grafana.
get_dashboard_by_uid
Retrieve the complete JSON of a dashboard by its UID.
get_dashboard_summary
Fetch metadata about a dashboard, such as title and last updated.
get_dashboard_property
Extract specific properties from a dashboard, like panel titles.
update_dashboard
Create or update a Grafana dashboard programmatically.
list_datasources
List all configured Grafana datasources.
get_datasource_by_uid
Get details for a datasource by its UID.
get_datasource_by_name
Retrieve a datasource configuration by name.
query_prometheus
Execute PromQL queries against configured Prometheus data.
list_prometheus_metric_names
List available Prometheus metric names.
list_prometheus_label_names
List label names for Prometheus metrics.
list_prometheus_label_values
Get values for a specific Prometheus label.
list_prometheus_metric_metadata
Describe metadata for a Prometheus metric.
query_loki_logs
Run LogQL queries against Loki logs.
query_loki_stats
Get statistics about Loki log streams.
list_loki_label_names
List label names available in Loki logs.
list_loki_label_values
Show values for a Loki log label.
find_error_pattern_logs
Analyze logs to identify recurring error patterns.
list_incidents
List active Grafana incidents.
get_incident
Get details for a specific incident.
create_incident
Create a new incident with given details.
add_activity_to_incident
Add notes or updates to an existing incident.