Skip to main content
Glama
grafana-blind-alerts-mcp

grafana-blind-alerts-mcp

by softenq

grafana-blind-alerts-mcp

Read-only Model Context Protocol (MCP) server that helps SRE/DevOps teams and AI coding assistants find blind Grafana alert rules — rules marked health=ok and state=Normal whose queries return zero series and can never fire when an incident actually happens.

Based on the two-stage blind-alert methodology documented by Softenq:
Grafana alerting audit: 16 of 209 alert rules could never fire

Why health=ok Still Leaves Blind Spots

Grafana marks an alert rule health=ok as long as Prometheus or Loki returns HTTP 200, even if data.result is empty ([]). Empty results happen for two completely different reasons:

  1. zero_by_design: an absent() guard on a healthy target, a threshold comparison (temp > 80, state="failed") currently satisfied across live hosts, or a lazy error counter not yet emitted after a restart.

  2. orphaned_or_unverified: a renamed or removed metric, a lost scrape job or host label after a migration, or a dead expression hidden behind ... or vector(0) / unless.

This read-only MCP server probes each rule's bound datasource through Grafana's proxy API and classifies zero-series rules automatically, failing closed (orphaned_or_unverified) whenever an expression cannot be verified or when any branch of a compound query points to a missing metric or target.

Related MCP server: grafana-mcp-observability

Tools

Tool

What it does

list_grafana_alert_rules

Reads /api/v1/provisioning/alert-rules and extracts folder UIDs, datasource UIDs, and primary PromQL/LogQL queries.

audit_blind_alert_rules

Queries each rule's bound Prometheus/Loki datasource proxy, detects zero-series rules (including composite unless / or vector(0) masks), and classifies them into zero_by_design vs orphaned_or_unverified.

classify_zero_series_rule

Strips state filters (state, status, phase, severity) while keeping target identity labels (job, instance, host, node, cluster, namespace) to verify whether the base series or Loki stream exists.

Quick Start

Requirements: Python >=3.10 and a Grafana Viewer / read-only Service Account token.

export GRAFANA_URL="https://grafana.example.com"
export GRAFANA_TOKEN="your_readonly_viewer_token"
uvx grafana-blind-alerts-mcp

Or run from a local checkout:

uv --directory /path/to/grafana-blind-alerts-mcp run grafana-blind-alerts-mcp

Optional environment variable:

  • LAZY_METRICS: comma-separated counter names that only appear on first failure/run (target labels such as job/instance are still verified when present).

Claude Desktop / Cursor / Claude Code Config

{
  "mcpServers": {
    "grafana-blind-alerts": {
      "command": "uvx",
      "args": ["grafana-blind-alerts-mcp"],
      "env": {
        "GRAFANA_URL": "https://grafana.example.com",
        "GRAFANA_TOKEN": "your_readonly_viewer_token"
      }
    }
  }
}

Development & Tests

uv run --with mcp --with httpx --with pytest pytest -v

Maintained by Softenq (contact@softenq.com). Licensed under the MIT License.

Available Tools

3 tools
audit_blind_alert_rulesA

Audit Grafana alert rules to find broken zero-series (blind) rules.

Separates rules that are intentionally silent (zero_by_design, e.g. absent() guards or live threshold filters) from broken rules whose underlying metric or target no longer exists (orphaned_or_unverified).

Args: folder: Optional case-insensitive substring to filter by folderUID. limit: Maximum number of rules to inspect (default 200).

Inputs: limit, folder. Returns: result

classify_zero_series_ruleB

Classify a single PromQL or LogQL alert expression without threshold filters.

Args: expr: Full PromQL or LogQL expression returning zero series. datasource_uid: Grafana datasource UID bound to the rule. datasource_type: Either 'prometheus' or 'loki'.

Inputs: expr (required), datasource_uid (required), datasource_type. Returns: result

list_grafana_alert_rulesA

List Grafana-managed alert rules with datasource UIDs and primary queries.

Args: folder: Optional case-insensitive substring to filter by folderUID.

Inputs: folder. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 3 tools

    Disambiguation5/5

    The three tools have clearly distinct scopes: listing alert rules, auditing rules in bulk, and classifying a single alert expression. The boundary between bulk auditing and single-rule classification is explicit through their arguments and descriptions.

    Naming Consistency5/5

    All tools use consistent snake_case with a leading action verb: list_, audit_, and classify_. The noun phrases are readable and follow the same general verb_noun convention.

    Tool Count5/5

    Three tools is well-scoped for a focused Grafana blind-alert auditing server. Each tool serves a distinct part of the workflow: discovery, bulk analysis, and single-expression classification.

    Completeness4/5

    The surface covers the core lifecycle of listing rules, auditing them for zero-series issues, and classifying individual expressions. Minor gaps exist, such as no dedicated tool for fetching a specific rule's details or datasource metadata, but these are not blocking for the stated purpose.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Enables AI agents to query Prometheus metrics and Loki logs for intelligent alert investigation and troubleshooting. Provides service discovery, metric querying, log searching, and correlation tools to help identify root causes of issues.
      9
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query Grafana dashboards, alerts, and datasources for observability insights and incident investigation.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to query Grafana datasources (Prometheus/Loki metrics and SQL databases like ClickHouse/Postgres/MySQL) and search or inspect dashboards through natural language, using read-only access to Grafana's API.
      6
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Enables assistants to read-only explore and analyze Grafana dashboards and data sources, execute queries against Prometheus and Azure Log Analytics, and run guided investigation workflows.
      7
      2
      -