/ Annuaire / Playground / prometheus-mcp-server
● Communauté pab1it0 ⚡ Instantané

prometheus-mcp-server

par 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.

Pourquoi l'utiliser

Fonctionnalités clés

Démo en direct

Aperçu en pratique

prometheus.replay ▶ prêt
0/0

Installer

Choisissez votre 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
    }
  }
}

Ouvrez Claude Desktop → Settings → Developer → Edit Config. Redémarrez après avoir enregistré.

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

Cursor utilise le même schéma mcpServers que Claude Desktop. La config projet l'emporte sur la globale.

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

Cliquez sur l'icône MCP Servers dans la barre latérale Cline, puis "Edit Configuration".

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

Même format que Claude Desktop. Redémarrez Windsurf pour appliquer.

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

Continue utilise un tableau d'objets serveur plutôt qu'une map.

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

Ajoutez dans context_servers. Zed recharge à chaud à la sauvegarde.

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

Une seule ligne. Vérifiez avec claude mcp list. Supprimez avec claude mcp remove.

Cas d'usage

Usages concrets : prometheus-mcp-server

How to diagnose a latency spike with Prometheus + Claude

👤 On-call SREs ⏱ ~10 min intermediate

Quand l'utiliser : A service p99 alert fires — you need context without memorizing PromQL.

Prérequis
  • Prometheus URL reachable — Set PROMETHEUS_URL in the MCP config; add auth if protected
Déroulement
  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.✓ Copié
    → 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?✓ Copié
    → Candidate culprit metrics
  3. Narrow by label
    Break down the spike by pod/host labels. Is it one pod or fleet-wide?✓ Copié
    → Per-label decomposition

Résultat : A hypothesis tied to specific metrics in under 5 minutes.

Pièges
  • Query returns no data — Check label names with list_metrics — label casing and delimiters vary between exporters
Combiner avec : kubectl

Generate a weekly SLO compliance report from Prometheus

👤 SRE leads ⏱ ~25 min intermediate

Quand l'utiliser : Friday SLO review — you want numbers not vibes.

Déroulement
  1. Define the SLIs
    For service X, compute this week's availability (success/total ratio) and latency (requests under threshold / total) as numbers.✓ Copié
    → 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.✓ Copié
    → Verdict + days of budget remaining

Résultat : Defensible SLO report with numbers not 'mostly fine'.

Combiner avec : google-sheets

Audit Prometheus scrape target health with Claude

👤 Platform engineers ⏱ ~15 min intermediate

Quand l'utiliser : You suspect half your targets are down but haven't checked.

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

Résultat : Rescued scrapes in minutes.

Combinaisons

Associez-le à d'autres MCPs pour un effet X10

prometheus + kubectl

Pair metric anomalies with pod state

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

Metric spike + error spike correlation

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

Outils

Ce que ce MCP expose

OutilEntréesQuand appelerCoût
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

Coût et limites

Coût d'exécution

Quota d'API
Prometheus scales with your server; expensive queries can stress it
Tokens par appel
Range queries with many series can hit 10k+ tokens
Monétaire
Free
Astuce
Use step wisely on range queries; 10s resolution over 24h is 8640 samples per series

Sécurité

Permissions, secrets, portée

Portées minimales : read-only access to Prometheus API
Stockage des identifiants : Bearer token or basic auth in env; mTLS cert paths if used
Sortie de données : Your Prometheus URL only

Dépannage

Erreurs courantes et correctifs

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

Vérifier : curl -H 'Authorization: Bearer $T' $PROMETHEUS_URL/api/v1/status/config

Alternatives

prometheus-mcp-server vs autres

AlternativeQuand l'utiliserCompromis
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

Plus

Ressources

📖 Lire le README officiel sur GitHub

🐙 Voir les issues ouvertes

🔍 Parcourir les 400+ serveurs MCP et Skills