Query and analyze Prometheus, open-source monitoring system.
Unlock the power of your Prometheus metrics within your Large Language Model (LLM) applications with the Prometheus Model Context Protocol (MCP) Server. This server acts as a bridge, enabling seamless communication between your LLMs and Prometheus, allowing AI assistants to execute PromQL queries and gain valuable insights from your monitoring data.
Environment Variables: Configure the following environment variables, either in a .env
file or directly in your system environment:
# Required: Prometheus URL PROMETHEUS_URL=http://your-prometheus-server:9090 # Optional: Authentication (choose one method) # Basic Auth: PROMETHEUS_USERNAME=your_username PROMETHEUS_PASSWORD=your_password # Bearer Token: PROMETHEUS_TOKEN=your_token
Client Configuration: Integrate the server into your LLM client configuration. Here's an example for Claude Desktop:
{ "mcpServers": { "prometheus": { "command": "uv", "args": [ "--directory", "<full path to prometheus-mcp-server directory>", "run", "src/prometheus_mcp_server/main.py" ], "env": { "PROMETHEUS_URL": "http://your-prometheus-server:9090", "PROMETHEUS_USERNAME": "your_username", "PROMETHEUS_PASSWORD": "your_password" } } } }
Error: spawn uv ENOENT
, provide the full path to the uv
executable or set NO_UV=1
in the configuration.Simplify deployment with Docker!
docker build -t prometheus-mcp-server .
Option 1: docker run
docker run -it --rm \ -e PROMETHEUS_URL=http://your-prometheus-server:9090 \ -e PROMETHEUS_USERNAME=your_username \ -e PROMETHEUS_PASSWORD=your_password \ prometheus-mcp-server
Option 2: docker-compose
.env
file with your Prometheus credentials.docker-compose up
Configure Claude Desktop to use the containerized server:
{ "mcpServers": { "prometheus": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "PROMETHEUS_URL", "-e", "PROMETHEUS_USERNAME", "-e", "PROMETHEUS_PASSWORD", "prometheus-mcp-server" ], "env": { "PROMETHEUS_URL": "http://your-prometheus-server:9090", "PROMETHEUS_USERNAME": "your_username", "PROMETHEUS_PASSWORD": "your_password" } } } }
Contributions are highly encouraged! Feel free to open issues or submit pull requests.
uv
: curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
.venv\Scripts\activate
uv pip install -e .
prometheus-mcp-server/
โโโ src/
โ โโโ prometheus_mcp_server/
โ โโโ __init__.py # Package initialization
โ โโโ server.py # MCP server implementation
โ โโโ main.py # Main application logic
โโโ Dockerfile # Docker configuration
โโโ docker-compose.yml # Docker Compose configuration
โโโ .dockerignore # Docker ignore file
โโโ pyproject.toml # Project configuration
โโโ README.md # This file
Ensure code quality with our comprehensive test suite.
uv pip install -e ".[dev]"
pytest
pytest --cov=src --cov-report=term-missing
Tool | Category | Description |
---|---|---|
execute_query | Query | Execute a PromQL instant query against Prometheus. |
execute_range_query | Query | Execute a PromQL range query with start/end times and step interval. |
list_metrics | Discovery | List all available metrics in Prometheus. |
get_metric_metadata | Discovery | Get metadata for a specific metric. |
get_targets | Discovery | Get information about all scrape targets. |
By leveraging the Prometheus MCP Server, you can empower your LLMs with real-time monitoring data, enabling them to make more informed decisions and provide more insightful responses.
๐ ๐ Generate visualizations from fetched data using the VegaLite format and renderer.
๐ โ๏ธ A mcp server that bridges Dune Analytics data to AI agents.
๐ โ๏ธ An MCP server for real-time Fantasy Premier League data and analysis tools.
๐๏ธ ๐ ๐ โ๏ธ Search dashboards, investigate incidents and query datasources in your Grafana instance