home / mcp / prometheus mcp server
Provides MCP access to Prometheus metrics, enabling AI assistants to query PromQL, discover metrics, and inspect targets.
Configuration
View docs{
"mcpServers": {
"pab1it0-prometheus-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PROMETHEUS_URL",
"ghcr.io/pab1it0/prometheus-mcp-server:latest"
],
"env": {
"PROMETHEUS_URL": "<your-prometheus-url>"
}
}
}
}You can grant AI assistants access to your Prometheus metrics by running an MCP server that exposes Prometheus data and PromQL queries through standardized MCP interfaces. This enables assistants to query metrics, discover metrics, and analyze data in a structured, interoperable way.
Use an MCP client to connect to the Prometheus MCP Server. The server exposes tools to run instant and range PromQL queries, discover metrics and metadata, and view target information. Start by launching the server through Docker, then configure your MCP client with the provided connection settings. Once connected, you can execute queries, browse metrics, and inspect results directly from your AI assistant.
Prerequisites you need before installation:
- Prometheus server accessible from your environment - MCP-compatible client (Claude Desktop, Claude Code, VS Code, Cursor, Windsurf, etc.)
# Run the MCP server with Docker, supplying your Prometheus URL
docker run -i --rm \
-e PROMETHEUS_URL="http://your-prometheus:9090" \
ghcr.io/pab1it0/prometheus-mcp-server:latestIf you prefer to run directly with Docker and customize authentication, use these examples.
# Without authentication
docker run -i --rm \
-e PROMETHEUS_URL="http://your-prometheus:9090" \
ghcr.io/pab1it0/prometheus-mcp-server:latest
# With basic authentication
docker run -i --rm \
-e PROMETHEUS_URL="http://your-prometheus:9090" \
-e PROMETHEUS_USERNAME="admin" \
-e PROMETHEUS_PASSWORD="password" \
ghcr.io/pab1it0/prometheus-mcp-server:latestIf you are configuring CLI-based MCP clients, set the MCP connection to your server's command and environment. For example, in Claude Code, you would add a new MCP server using a docker run command and define PROMETHEUS_URL as the target Prometheus instance.
Configure how the server connects to Prometheus and how it communicates with MCP clients using environment variables. The essential option is PROMETHEUS_URL which must point to your Prometheus instance. Optional settings control SSL verification, request timeouts, authentication, and MCP transport behavior.
Protect access to your Prometheus MCP Server by using authentication options supported by the container: basic authentication via PROMETHEUS_USERNAME and PROMETHEUS_PASSWORD, or a Bearer token via PROMETHEUS_TOKEN. Enforce SSL verification as needed with PROMETHEUS_URL_SSL_VERIFY, and restrict access to trusted networks.
The server exposes a set of tools that let you perform health checks, run queries, and discover metrics. You can adjust which tools are available to MCP clients according to your needs.
If you encounter connection issues, verify that PROMETHEUS_URL is reachable from the host running the MCP server, check your environment variables for typos, and confirm that the Prometheus instance accepts connections from your environment. Review container logs for errors related to authentication, timeouts, or SSL settings.
Common use cases include executing instant queries, retrieving range query results with specific step intervals, listing available metrics, and obtaining metric metadata or targets information to help you understand your Prometheus deployment.
Health check endpoint for container monitoring and status verification
Execute a PromQL instant query against Prometheus
Execute a PromQL range query with start time, end time, and step interval
List all available metrics in Prometheus with pagination and filtering support
Get metadata for a specific metric
Get information about all scrape targets