home / mcp / prometheus mcp server
A Model Context Protocol (MCP) server enabling LLMs to query, analyze, and interact with Prometheus databases through predefined routes.
Configuration
View docs{
"mcpServers": {
"caesaryangs-prometheus_mcp_server": {
"command": "uv",
"args": [
"--directory",
"/path/to/prometheus_mcp_server",
"run",
"server.py"
],
"env": {
"PROMETHEUS_HOST": "http://localhost:9090"
}
}
}
}You can run a Python-based MCP server that lets large language models fetch, analyze, and query data from Prometheus. This server exposes a lightweight interface to retrieve metrics, analyze them by ranges, and explore usage patterns, all through pre-defined start commands that you can run from your environment.
You use an MCP client to start the server and then interact with its endpoints to retrieve metric data, perform analyses, and run advanced queries. Start the local MCP server as described below, then configure your client to point to the running process. Ensure the Prometheus host is reachable at the URL you provide via the environment variable when needed.
Prerequisites you need before running the server:
Step-by-step setup options you can use right away.
# Manual installation: prepare a Python virtual environment
cd ./src/prometheus_mcp_server
python3 -m venv .venv
# Activate the virtual environment
# Linux/macOS:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate
# Ensure pip is available in the venv
# If pip is missing, install it manually
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
# Install required Python packages
pip install -r requirements.txt
```} ,{Configuration notes and runtime guidance help you keep the server running smoothly and securely.
Environment variables you may need when running the server include the target Prometheus host, which you provide to the MCP client so the server can query the Prometheus API.