Get the FREE Ultimate OpenClaw Setup Guide →

prometheus

Prometheus MCP Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio brenoepics-prometheus-mcp docker run --rm -it brenoepics/prometheus-mcp:latest --mcp --prometheus-url http://host.docker.internal:9090

How to use

Prometheus MCP provides a set of MCP tools to query Prometheus from the command line or from MCP-compatible clients. It exposes instant queries, range queries, and metadata discovery utilities, as well as a small in-process cache and an optional internal metrics exporter. You can run it as a standard MCP server over stdio or use the included CLI inside a container or binary to interact with Prometheus in real time. Typical workflows include querying current metrics (instant queries), evaluating time-bound series (range queries), listing available metric names, fetching metric metadata, and exploring series selectors and label values to construct precise queries.

To use the CLI, run commands such as prometheus-mcp query, prometheus-mcp range, prometheus-mcp list-metrics, prometheus-mcp metadata, prometheus-mcp series, and prometheus-mcp label-values. You can also start an MCP server over stdio with --mcp, which enables MCP clients to feed requests directly through standard input/output. If you enable the internal metrics exporter, you can monitor MCP activity at /metrics on the configured port. When running via Docker or in CI, provide the Prometheus URL with --prometheus-url and, if needed, set authentication via the provided username/password options or environment variables.

This server is designed to be lightweight and easy to wire into existing MCP workflows. The discovery helpers (list metrics, metadata, and label values) are especially helpful when constructing dynamic queries in MCP clients or in automation that adapts to the target Prometheus deployment.

How to install

Prerequisites:

  • Docker installed (recommended) or a local Rust toolchain if you want to build from source.
  • Access to a running Prometheus instance you want to query.

Option A: Run via Docker (recommended for quick start)

  1. Pull and run the image with MCP enabled: docker run --rm -it brenoepics/prometheus-mcp:latest --mcp --prometheus-url http://host.docker.internal:9090

    Notes:

    • Use http://localhost:9090 if Prometheus runs on the host and you’re not using Docker networking tricks.
    • For Linux hosts, you may need --network host or proper host.docker.internal resolution as shown in the docs.
  2. If you want to pass a different Prometheus URL: docker run --rm -it brenoepics/prometheus-mcp:latest --mcp --prometheus-url http://prometheus.example.com:9090

Option B: Build from source (Rust)

  1. Install Rust and cargo from https://rust-lang.org
  2. Build the binary: cargo install prometheus-mcp

    or from source: cargo build --release

  3. Run the binary directly: prometheus-mcp --mcp --prometheus-url http://localhost:9090

Option C: Prebuilt binaries

  1. Download the latest release for your OS/arch from the project releases page.
  2. Run the binary with the same flags as above (e.g., --mcp and --prometheus-url).

Prerequisites summary:

  • Docker or Rust toolchain (cargo) or prebuilt binaries
  • Access to a Prometheus instance
  • Optional: authentication credentials if your Prometheus requires auth

Additional notes

  • Environment variables supported by the server include PROMETHEUS_URL, PROMETHEUS_USERNAME, and PROMETHEUS_PASSWORD to configure the target Prometheus and basic auth.
  • The internal metrics exporter (metrics-exporter) can be enabled to expose /metrics for MCP performance monitoring; you can set a custom port with --metrics-port.
  • When running in Docker, you may need to adjust networking (host networking or --add-host) to reach Prometheus depending on your network setup.
  • If your Prometheus is behind basic auth, use PROMETHEUS_USERNAME/PROMETHEUS_PASSWORD or the corresponding CLI flags to supply credentials.
  • The MCP server can operate over stdio or as a standalone CLI; for scripts and automation, the stdio mode (--mcp) is often the most straightforward integration point.

Related MCP Servers

Sponsor this space

Reach thousands of developers