prometheus
A Model Context Protocol (MCP) server that enables AI agents and LLMs to query and analyze Prometheus metrics through standardized interfaces.
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:
-
Install uv (if not already installed): curl -LsSf https://astral.sh/uv/install.sh | sh
-
Create and activate a Python virtual environment (optional but recommended): uv venv source .venv/bin/activate # Unix/macOS .venv\Scripts\activate # Windows
-
Install the Prometheus MCP Server package in editable mode: uv pip install -e .
-
Run or prepare to run the MCP server via uvx (Python runner). Example (adjust package name if differs): uvx prometheus-mcp-server
-
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
mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
nerve
The Simple Agent Development Kit.
python-utcp
Official python implementation of UTCP. UTCP is an open standard that lets AI agents call any API directly, without extra middleware.
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
octave
OCTAVE protocol - structured AI communication with 3-20x token reduction. MCP server with lenient-to-canonical pipeline and schema validation.
mcp-prompt-optimizer
Advanced MCP server providing cutting-edge prompt optimization tools with research-backed strategies