Home / MCP / Prometheus MCP Server

Prometheus MCP Server

Provides access to Prometheus metrics and queries via MCP interfaces for AI assistants.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "prometheus": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "PROMETHEUS_URL",
                "ghcr.io/pab1it0/prometheus-mcp-server:latest"
            ],
            "env": {
                "PROMETHEUS_URL": "<your-prometheus-url>",
                "PROMETHEUS_URL_SSL_VERIFY": "False",
                "PROMETHEUS_DISABLE_LINKS": "true",
                "PROMETHEUS_USERNAME": "admin",
                "PROMETHEUS_PASSWORD": "password",
                "PROMETHEUS_TOKEN": "<token>",
                "ORG_ID": "org-123",
                "PROMETHEUS_MCP_SERVER_TRANSPORT": "stdio",
                "PROMETHEUS_MCP_BIND_HOST": "127.0.0.1",
                "PROMETHEUS_MCP_BIND_PORT": "8080",
                "PROMETHEUS_CUSTOM_HEADERS": "{ \"X-Custom\": \"value\" }"
            }
        }
    }
}

You can access Prometheus metrics and PromQL queries through a Model Context Protocol (MCP) server. This MCP server exposes Prometheus data via standardized interfaces so AI assistants can discover metrics, fetch metadata, run instant queries, and explore range queries with configurable authentication and transport options.

How to use

Use an MCP client to connect to the Prometheus MCP Server. You can discover available metrics, request metadata for a specific metric, and execute PromQL queries—both instant and range queries. Authentication options let you secure access with basic credentials or a bearer token. You can run the server in a container or expose it via HTTP transport, depending on your environment.

Typical capabilities you can leverage include:

How to install

Prerequisites: Ensure your Prometheus server is accessible from the environment running the MCP server, and have an MCP-compatible client ready (Claude Desktop, VS Code, Cursor, Windsurf, etc.). Add the MCP server configuration to your client setup using one of the supported methods.

Install and run via Docker Desktop (recommended for quick setup):

# Manual Docker Setup example
# Run the MCP server container with your Prometheus URL
docker run -i --rm \
  -e PROMETHEUS_URL="http://your-prometheus:9090" \
  ghcr.io/pab1it0/prometheus-mcp-server:latest

# Optional authentication example
# 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:latest

Additional installation methods

The following examples show how the MCP server can be integrated into various environments. Use the method that best fits your workflow and tooling.

Claude Desktop users can add an MCP server configuration that runs the MCP server container with the required environment variable for Prometheus URL.

Claude Code users can install via the Claude Code CLI by providing the environment variable and running the container command.

Available tools

health_check

Health check endpoint for container monitoring and status verification

execute_query

Execute a PromQL instant query against Prometheus

execute_range_query

Execute a PromQL range query with start time, end time, and step interval

list_metrics

List all available metrics in Prometheus with pagination and filtering support

get_metric_metadata

Get metadata for a specific metric

get_targets

Get information about all scrape targets