Get the FREE Ultimate OpenClaw Setup Guide →

prometheus

A Model Context Protocol (MCP) server that enables AI agents and LLMs to query and analyze Prometheus metrics through standardized interfaces.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio pab1it0-prometheus-mcp-server uvx prometheus-mcp-server \
  --env PROMETHEUS_URL="<your-prometheus-url>"

How to use

This MCP server exposes a set of tools to query and explore your Prometheus metrics through the MCP interface. Tools include health_check for container status, execute_query to run instant PromQL queries, execute_range_query for range-based queries with start/end/step, list_metrics to discover available metrics, get_metric_metadata to fetch metadata for specific metrics, and get_targets to inspect scrape targets. To use it, configure the server with the URL to your Prometheus instance (PROMETHEUS_URL) and then connect via your MCP client. Once connected, you can invoke the tools to query metrics, retrieve metadata, and uncover metric structures, all through the standardized MCP tool interfaces.

How to install

Prerequisites:

  • Python 3.10+ installed on your system
  • A Python environment with uv (the MCP runner) available
  • A Prometheus instance reachable from the MCP server

Installation steps:

  1. Install uv (if not already installed): curl -LsSf https://astral.sh/uv/install.sh | sh

  2. Create and activate a Python virtual environment (optional but recommended): uv venv source .venv/bin/activate # Unix/macOS .venv\Scripts\activate # Windows

  3. Install the Prometheus MCP Server package in editable mode: uv pip install -e .

  4. Run or prepare to run the MCP server via uvx (Python runner). Example (adjust package name if differs): uvx prometheus-mcp-server

  5. Alternatively, if you package and publish a runnable entry point, you can install and run using your preferred workflow and then configure your MCP client to connect using the provided mcp_config example.

Additional notes

Configuration and environment:

  • PROMETHEUS_URL is required and should point to your Prometheus instance (e.g., http://prometheus.example.com:9090).
  • Optional SSL/tLS and authentication can be configured via additional environment variables described in the README (PROMETHEUS_USERNAME, PROMETHEUS_PASSWORD, PROMETHEUS_TOKEN, etc.).
  • The available tools can be toggled or limited per client configuration; only the selected tools will appear in the MCP context window.
  • If running in containers or specific IDEs, you may adapt the mcp_config to use docker or npx equivalents if desired, but this package is Python-based and demonstrated here with uvx.
  • Ensure network access from the MCP server to Prometheus is allowed (firewalls, VPNs, or proxy settings may apply).
  • For authentication scenarios, provide the appropriate credentials via environment variables and verify access with a test query (e.g., a simple instant query) before integrating into automated workflows.

Related MCP Servers

Sponsor this space

Reach thousands of developers