Skip to Content

Grafana

Connect to Grafana to manage monitoring dashboards and alerts.

Key Features

  • Dashboard viewing, creation, and modification
  • Data source management and creation
  • Alert rule configuration and management
  • Prometheus metric query execution
  • System health checks
  • Dashboard search functionality

Basic Information

Authentication Method

Authenticate using API Key.

Input Parameters

  • API Key (required): API key generated in Grafana
  • Grafana URL (required): Grafana instance URL

Supported MCP Tools

Dashboard Management

get_dashboard_by_uid

Retrieve complete information for a specific dashboard identified by UID (including panels, variables, settings).

update_dashboard

Create or update a dashboard.

get_dashboard_panel_queries

Retrieve title, query strings, and data source information for each panel in a dashboard.

search_dashboards

Search dashboards using queries.

Alert Management

create_alert_rule

Create a new Grafana alert rule.

list_alert_rules

Retrieve a list of Grafana alert rules. Returns summary information including UID, title, current status, and labels.

get_alert_rule_by_uid

Retrieve the complete configuration and detailed status of a specific Grafana alert rule identified by unique ID (UID).

Data Source Management

list_datasources

Retrieve a list of available Grafana data sources. Can filter by data source type.

get_datasource_by_uid

Retrieve detailed information for a specific data source using UID.

get_datasource_by_name

Retrieve detailed information for a specific data source using name.

create_datasource

Create a new Grafana data source.

Prometheus Queries

query_prometheus

Query Prometheus using PromQL expressions. Supports both instant and range queries.

list_prometheus_metric_metadata

Retrieve a list of Prometheus metric metadata. Returns metadata for metrics collected from current targets.

list_prometheus_metric_names

Retrieve a list of metric names from Prometheus data source. Supports filtering with regular expressions and pagination.

list_prometheus_label_names

Retrieve a list of label names from Prometheus data source. Can filter by series selector and time range.

list_prometheus_label_values

Retrieve values for a specific label name in Prometheus. Can filter by series selector and time range.

System Management

check_health

Check the health status of the Grafana instance. Returns commit hash, database status, and version information.

Usage Example

For example,

  • When you input the prompt “Show me the list of currently registered dashboards”,
  • The LLM will call the search_dashboards tool through MCP to retrieve the dashboard list.
  • Then, it responds in the chat based on the tool call results.

API Key Generation Method

  1. Log in to the Grafana instance with administrator privileges.
  2. Create a new API key in Configuration > API Keys.
  3. Set the necessary permissions.

Precautions

  • Keep your generated API Key secure.
  • It’s recommended to grant only the minimum necessary permissions.
  • Using HTTPS for Grafana URL is recommended.
  • Large dashboard JSON can consume context window, so be careful.
  • The Prometheus metric metadata endpoint is an experimental feature.
Last updated on