Get the FREE Ultimate OpenClaw Setup Guide →

prometheus

MCP server from bcfmtolgahan/prometheus-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio bcfmtolgahan-prometheus-mcp-server python -m prometheus_mcp_server \
  --env PROMETHEUS_MCP_URL="http://localhost:9090 (or your Prometheus URL)"

How to use

Prometheus MCP Server provides a comprehensive suite of MCP tools to interact with a Prometheus-backed monitoring stack. It exposes 38 tools that cover core querying, alert/rule management, target inspection, metadata discovery, health and status checks, SRE golden signals, analytics, and related PromQL helpers. You can use these tools via Claude Desktop integration, HTTP transport, or programmatic calls to perform tasks such as querying PromQL, validating and explaining queries, retrieving alerts or rules, inspecting targets and metrics, calculating error rates and latency percentiles, and performing anomaly detection or capacity forecasting. For example, you can query current metrics with prometheus_query, fetch active alerts with prometheus_get_alerts, validate a PromQL expression with prometheus_validate_query, or analyze service health with prometheus_analyze_service. The server also supports integrating with Alertmanager for silences and can operate over multiple transports (stdio for Claude Desktop, HTTP/SSE for cloud deployments).

To use Claude Desktop, configure the MCP server in your Claude Desktop config, referencing the prometheus entry and its URL. For programmatic use, call the corresponding MCP tools via your preferred client, passing the appropriate parameters (e.g., job names, time windows, metric names). When deploying to Kubernetes or cloud environments, you can run the server as an HTTP server or via Docker, and connect to Prometheus via PROMETHEUS_MCP_URL for real-time data access.

How to install

Prerequisites:

  • Python 3.10+ installed on the host
  • internet access to install dependencies
  • Prometheus accessible at a URL (e.g., http://localhost:9090)
  1. Create a Python virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate  # on macOS/Linux
venv\Scripts\activate     # on Windows
  1. Install the MCP server package:
pip install prometheus-mcp-server
  1. Run the MCP server (example):
prometheus-mcp-server --url http://localhost:9090 --transport stdio
  1. Optional: Run via Python module (alternative invocation):
python -m prometheus_mcp_server --url http://localhost:9090 --transport http
  1. Claude Desktop setup (example):
  • Add to Claude Desktop configuration (e.g., ~/.config/claude/claude_desktop_config.json):
{
  "mcpServers": {
    "prometheus": {
      "command": "prometheus-mcp-server",
      "args": ["--url", "http://localhost:9090"]
    }
  }
}
  1. Docker deployment (optional):
docker run -p 8000:8000 \
  -e PROMETHEUS_MCP_URL=http://prometheus:9090 \
  ghcr.io/bcfmtolgahan/prometheus-mcp-server:latest

Additional notes

  • Environment variables: PROMETHEUS_MCP_URL (Prometheus instance URL), PROMETHEUS_MCP_TRANSPORT (stdio, http, sse), PROMETHEUS_MCP_HOST, PROMETHEUS_MCP_PORT, and authentication-related vars if needed.
  • Dangerous tools: Some tools can delete data or alter state (e.g., prometheus_delete_series, prometheus_reload_config). Enable with --enable-dangerous-tools when required.
  • Transport options: stdio is ideal for local Claude Desktop usage; http/sse are suitable for Kubernetes, cloud deployments, and CI pipelines.
  • TLS and retry behavior: Production deployments should configure TLS and consider retries, timeouts, and connection pooling as described in the documentation.
  • Health checks: Use prometheus_health_check and prometheus_get_status to monitor server health and configuration status as part of your observability stack.

Related MCP Servers

Sponsor this space

Reach thousands of developers