/ Verzeichnis / Playground / prometheus-mcp-server
● Community pab1it0 ⚡ Sofort

prometheus-mcp-server

von pab1it0 · pab1it0/prometheus-mcp-server

Query Prometheus in natural language — PromQL instant + range queries, target inspection, metric metadata, for AI-assisted SRE.

prometheus-mcp-server (pab1it0) exposes 6 tools over the Prometheus HTTP API. Supports PromQL queries, range queries, metrics discovery, and target health. Works with basic auth, bearer tokens, mTLS, and custom headers.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

prometheus.replay ▶ bereit
0/0

Installieren

Wählen Sie Ihren Client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "prometheus": {
      "command": "uvx",
      "args": [
        "prometheus-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "prometheus": {
      "command": "uvx",
      "args": [
        "prometheus-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "prometheus": {
      "command": "uvx",
      "args": [
        "prometheus-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "prometheus": {
      "command": "uvx",
      "args": [
        "prometheus-mcp-server"
      ],
      "_inferred": true
    }
  }
}

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "prometheus",
      "command": "uvx",
      "args": [
        "prometheus-mcp-server"
      ]
    }
  ]
}

Continue nutzt ein Array von Serverobjekten statt einer Map.

~/.config/zed/settings.json
{
  "context_servers": {
    "prometheus": {
      "command": {
        "path": "uvx",
        "args": [
          "prometheus-mcp-server"
        ]
      }
    }
  }
}

In context_servers hinzufügen. Zed lädt beim Speichern neu.

claude mcp add prometheus -- uvx prometheus-mcp-server

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: prometheus-mcp-server

How to diagnose a latency spike with Prometheus + Claude

👤 On-call SREs ⏱ ~10 min intermediate

Wann einsetzen: A service p99 alert fires — you need context without memorizing PromQL.

Voraussetzungen
  • Prometheus URL reachable — Set PROMETHEUS_URL in the MCP config; add auth if protected
Ablauf
  1. Scope the spike
    Query http request p99 latency for service X in the last hour, 30-second resolution. Compare to the last 7 days baseline.✓ Kopiert
    → Range query result showing the spike
  2. Find correlated metrics
    For the spike window, what other metrics for service X moved >2 sigma? CPU, memory, GC, queue depth?✓ Kopiert
    → Candidate culprit metrics
  3. Narrow by label
    Break down the spike by pod/host labels. Is it one pod or fleet-wide?✓ Kopiert
    → Per-label decomposition

Ergebnis: A hypothesis tied to specific metrics in under 5 minutes.

Fallstricke
  • Query returns no data — Check label names with list_metrics — label casing and delimiters vary between exporters
Kombinieren mit: kubectl

Generate a weekly SLO compliance report from Prometheus

👤 SRE leads ⏱ ~25 min intermediate

Wann einsetzen: Friday SLO review — you want numbers not vibes.

Ablauf
  1. Define the SLIs
    For service X, compute this week's availability (success/total ratio) and latency (requests under threshold / total) as numbers.✓ Kopiert
    → Two ratios with burn rate
  2. Compare to SLO
    Availability SLO = 99.9%, latency SLO = 95%. Am I above or below? Project error budget exhaustion.✓ Kopiert
    → Verdict + days of budget remaining

Ergebnis: Defensible SLO report with numbers not 'mostly fine'.

Kombinieren mit: google-sheets

Audit Prometheus scrape target health with Claude

👤 Platform engineers ⏱ ~15 min intermediate

Wann einsetzen: You suspect half your targets are down but haven't checked.

Ablauf
  1. Get targets
    Call get_targets. Group by job; which have any DOWN instances?✓ Kopiert
    → Table of job → up/down counts
  2. Investigate
    For the worst offender, show the lastError for the DOWN instances. Likely cause?✓ Kopiert
    → Actionable cause per target

Ergebnis: Rescued scrapes in minutes.

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

prometheus + kubectl

Pair metric anomalies with pod state

For the service with the latency spike, correlate Prometheus data with kubectl describe on its pods.✓ Kopiert
prometheus + sentry

Metric spike + error spike correlation

Sentry shows errors doubled at 14:00 — what Prometheus metrics moved at the same time?✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
health_check Verify connectivity 1 API call
execute_query query: promql, time? Instant snapshot 1 query
execute_range_query query, start, end, step Time-series analysis 1 query (may be expensive)
list_metrics match?: str Discovery when you don't know the metric name 1 API call
get_metric_metadata metric: str Understand units before computing 1 API call
get_targets Scrape health 1 API call

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
Prometheus scales with your server; expensive queries can stress it
Tokens pro Aufruf
Range queries with many series can hit 10k+ tokens
Kosten in €
Free
Tipp
Use step wisely on range queries; 10s resolution over 24h is 8640 samples per series

Sicherheit

Rechte, Secrets, Reichweite

Minimale Scopes: read-only access to Prometheus API
Credential-Speicherung: Bearer token or basic auth in env; mTLS cert paths if used
Datenabfluss: Your Prometheus URL only

Fehlerbehebung

Häufige Fehler und Lösungen

Query returns empty with no error

Metric/label name doesn't exist. Use list_metrics with a match prefix to verify

Range query times out

Reduce time range or increase step. Prometheus query engine has per-query resource limits

401 with bearer token

Token lacks read permission on /api/v1; check reverse proxy if Prometheus is behind one

Prüfen: curl -H 'Authorization: Bearer $T' $PROMETHEUS_URL/api/v1/status/config

Alternativen

prometheus-mcp-server vs. andere

AlternativeWann stattdessenKompromiss
Grafana MCPYou already visualize in Grafana and want dashboard/alert opsHeavier; more features than you may need
Datadog MCPDatadog is your metrics storePaid; different query language

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen