
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
raihan0824-prometheus-mcp-server
Advanced tools
A Model Context Protocol (MCP) server for Prometheus.
This provides access to your Prometheus metrics and queries through standardized MCP interfaces, allowing AI assistants to execute PromQL queries and analyze your metrics data.
# Install and run in one command
uvx --from raihan0824-prometheus-mcp-server prometheus-mcp-server
# Clone and install in development mode
git clone https://github.com/raihan0824/prometheus-mcp-server.git
cd prometheus-mcp-server
uv pip install -e .
prometheus-mcp-server
Execute PromQL queries against Prometheus
Discover and explore metrics
Authentication support
Docker containerization support
Provide interactive tools for AI assistants
The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to take up too much of the context window.
# Using uvx (recommended for Claude Desktop)
uvx --from raihan0824-prometheus-mcp-server prometheus-mcp-server
# Using pip
pip install raihan0824-prometheus-mcp-server
# Using uv
uv add raihan0824-prometheus-mcp-server
# Clone the repository
git clone https://github.com/raihan0824/prometheus-mcp-server.git
cd prometheus-mcp-server
# Install with uv (development mode)
uv pip install -e .
# Or install with pip (development mode)
pip install -e .
If you want to use the pre-built package from PyPI:
# Install and run in one command
uvx --from raihan0824-prometheus-mcp-server prometheus-mcp-server
# Or install permanently
pip install raihan0824-prometheus-mcp-server
prometheus-mcp-server
If you want to modify the code or contribute:
# Clone and install in development mode
git clone https://github.com/raihan0824/prometheus-mcp-server.git
cd prometheus-mcp-server
uv pip install -e .
# Run the development version
prometheus-mcp-server
Ensure your Prometheus server is accessible from the environment where you'll run this MCP server.
Configure the environment variables for your Prometheus server, either through a .env
file or system environment variables:
# Required: Prometheus configuration
PROMETHEUS_URL=http://your-prometheus-server:9090
# Optional: Authentication credentials (if needed)
# Choose one of the following authentication methods if required:
# For basic auth
PROMETHEUS_USERNAME=your_username
PROMETHEUS_PASSWORD=your_password
# For bearer token auth
PROMETHEUS_TOKEN=your_token
# Optional: Custom MCP configuration
PROMETHEUS_MCP_SERVER_TRANSPORT=stdio # Choose between http, stdio, sse. If undefined, stdio is set as the default transport.
# Optional: Only relevant for non-stdio transports
PROMETHEUS_MCP_BIND_HOST=localhost # if undefined, 127.0.0.1 is set by default.
PROMETHEUS_MCP_BIND_PORT=8080 # if undefined, 8080 is set by default.
# Optional: For multi-tenant setups like Cortex, Mimir or Thanos
ORG_ID=your_organization_id
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": [
"--from",
"raihan0824-prometheus-mcp-server",
"prometheus-mcp-server"
],
"env": {
"PROMETHEUS_URL": "<your-prometheus-url>",
"PROMETHEUS_USERNAME": "<your-username>",
"PROMETHEUS_PASSWORD": "<your-password>"
}
}
}
}
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": [
"--directory",
"/path/to/prometheus-mcp-server",
"run",
"prometheus-mcp-server"
],
"env": {
"PROMETHEUS_URL": "<your-prometheus-url>",
"PROMETHEUS_USERNAME": "<your-username>",
"PROMETHEUS_PASSWORD": "<your-password>"
}
}
}
}
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": [
"run",
"--from",
"git+https://github.com/raihan0824/prometheus-mcp-server.git",
"prometheus-mcp-server"
],
"env": {
"PROMETHEUS_URL": "<your-prometheus-url>",
"PROMETHEUS_USERNAME": "<your-username>",
"PROMETHEUS_PASSWORD": "<your-password>"
}
}
}
}
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PROMETHEUS_URL",
"ghcr.io/pab1it0/prometheus-mcp-server:latest"
],
"env": {
"PROMETHEUS_URL": "<url>",
"PROMETHEUS_MCP_SERVER_TRANSPORT": "http",
"PROMETHEUS_MCP_BIND_HOST": "localhost",
"PROMETHEUS_MCP_BIND_PORT": "8080"
}
}
}
}
Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project uses uv
to manage dependencies. Install uv
following the instructions for your platform:
curl -LsSf https://astral.sh/uv/install.sh | sh
You can then create a virtual environment and install the dependencies with:
uv venv
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
uv pip install -e .
The project has been organized with a src
directory structure:
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
The project includes a comprehensive test suite that ensures functionality and helps prevent regressions.
Run the tests with pytest:
# Install development dependencies
uv pip install -e ".[dev]"
# Run the tests
pytest
# Run with coverage report
pytest --cov=src --cov-report=term-missing
Tests are organized into:
When adding new features, please also add corresponding tests.
Tool | Category | Description |
---|---|---|
execute_query | Query | Execute a PromQL instant query against Prometheus |
execute_range_query | Query | Execute a PromQL range query with start time, end time, 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 |
MIT
FAQs
MCP server for Prometheus integration
We found that raihan0824-prometheus-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.