Skip to main content
Glama
Prometheus MCP Server

Prometheus MCP Server

by Elad-Health

Prometheus MCP Server

A READ-ONLY MCP (Model Context Protocol) server that connects AI assistants to Prometheus. Works with Claude Code CLI, VS Code AI extensions (Continue, Cline), Cursor, Amazon Q Developer, and any MCP-compatible client.

Features

  • Health Monitoring: Check target status, scrape health

  • PromQL Queries: Execute instant and range queries

  • Metrics Discovery: List and search available metrics

  • Alerting: View active alerts and alerting rules

  • Exporter Helpers: Pre-built queries for windows_exporter and blackbox_exporter

Related MCP server: Prometheus MCP Server

Prerequisites

  • Node.js 18 or higher

  • Prometheus server (accessible via HTTP API)

Installation

npx @elad-nofy/prometheus-mcp@latest

Option 2: Clone and Build

git clone https://github.com/elad-nofy/prometheus-mcp.git
cd prometheus-mcp
npm install
npm run build

Configuration

Configure MCP Client

Claude Code CLI

Add to your global settings (~/.claude.json on macOS/Linux, %USERPROFILE%\.claude.json on Windows):

Windows:

{
  "mcpServers": {
    "prometheus": {
      "command": "cmd",
      "args": ["/c", "npx", "@elad-nofy/prometheus-mcp"],
      "env": {
        "PROMETHEUS_URL": "http://your-prometheus-server:9090"
      }
    }
  }
}

macOS / Linux:

{
  "mcpServers": {
    "prometheus": {
      "command": "npx",
      "args": ["@elad-nofy/prometheus-mcp"],
      "env": {
        "PROMETHEUS_URL": "http://your-prometheus-server:9090"
      }
    }
  }
}

Amazon Q Developer

Add to %USERPROFILE%\.aws\amazonq\agents\mcp.json:

{
  "mcpServers": {
    "prometheus": {
      "command": "cmd",
      "args": ["/c", "npx", "@elad-nofy/prometheus-mcp"],
      "env": {
        "PROMETHEUS_URL": "http://your-prometheus-server:9090"
      }
    }
  }
}

Environment Variables

Variable

Required

Description

PROMETHEUS_URL

Yes

Prometheus server URL (e.g., http://prometheus:9090)

PROMETHEUS_USERNAME

No

Basic auth username

PROMETHEUS_PASSWORD

No

Basic auth password

Available Tools

Health & Targets

Tool

Description

test_connection

Test connection to Prometheus

list_targets

List all scrape targets and health status

get_target_health

Get health of specific target by job/instance

Queries

Tool

Description

query_instant

Execute PromQL instant query (current value)

query_range

Execute PromQL range query (time series)

query_windows_exporter

Query Windows server metrics (CPU, memory, disk, network, services)

query_node_exporter

Query Linux server metrics (CPU, memory, disk, network, load, filesystem)

query_blackbox_exporter

Query endpoint probe results

Metrics

Tool

Description

list_metrics

List all available metric names

get_metric_metadata

Get metric type and help text

get_label_values

Get all values for a label

find_series

Find time series matching a selector

Alerts & Rules

Tool

Description

list_alerts

List firing/pending alerts

get_alert_rules

Get alerting rules and states

get_alert_history

Query alert state changes over time

get_recording_rules

Get recording rules (pre-computed queries)

Status & Info

Tool

Description

get_prometheus_status

Get Prometheus version, runtime info, config, and flags

get_tsdb_status

Get TSDB statistics (cardinality, memory usage, top metrics)

Usage Examples

Once configured, you can ask your AI assistant questions like:

  • "Are all Prometheus targets healthy?"

  • "Show me the CPU usage of server1 over the last hour"

  • "What alerts are currently firing?"

  • "List all metrics containing 'http'"

  • "Check the memory usage on my Windows servers"

  • "What's the load average on my Linux servers?"

  • "Is the website responding? Check blackbox_exporter"

  • "What version of Prometheus is running?"

  • "Show me the top metrics by cardinality"

  • "What recording rules are configured?"

Example Queries

Check target health:

What's the health status of all Prometheus targets?

Query CPU usage:

Show me the CPU usage on instance "server1:9182" for the last 30 minutes

Find metrics:

List all metrics related to HTTP requests

Check alerts:

Are there any firing alerts? Show me the details

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

Troubleshooting

Connection errors

  • Verify PROMETHEUS_URL is correct and accessible

  • Check if basic auth is required and credentials are correct

  • Ensure your network allows connection to the Prometheus server

Query errors

  • Verify the PromQL syntax is correct

  • Check if the metric exists using list_metrics

  • Ensure the time range is valid

No data returned

  • Verify the target is being scraped

  • Check if the metric has data for the requested time range

  • Use list_targets to verify scrape status

License

MIT

Available Tools

18 tools
find_seriesC

Find time series matching a label selector

Inputs: match (required), end, start.

get_alert_historyC

Query alert state changes over time using ALERTS metric

Inputs: alertname, timeRange.

get_alert_rulesC

Get all alerting rules and their current states

Inputs: group, state.

get_label_valuesA

Get all values for a specific label (e.g., all job names, all instances)

Inputs: label (required).

get_metric_metadataA

Get metadata (type, help text) for a specific metric or all metrics

Inputs: metric.

get_prometheus_statusB

Get Prometheus server status including version, runtime info, and configuration

Inputs: include.

get_recording_rulesB

Get all recording rules (pre-computed queries) and their current states

Inputs: group.

get_target_healthB

Get health status of a specific target by job name and/or instance

Inputs: job, instance.

get_tsdb_statusB

Get Prometheus TSDB (Time Series Database) statistics including cardinality and memory usage

Inputs: limit.

list_alertsC

List all currently firing or pending alerts

Inputs: state.

list_metricsC

List all available metric names in Prometheus

Inputs: limit, search.

list_targetsC

List all scrape targets and their health status (up/down)

Inputs: health.

query_blackbox_exporterC

Query probe results from blackbox_exporter for endpoint monitoring

Inputs: module, target.

query_instantA

Execute a PromQL instant query to get the current value of metrics

Inputs: query (required), time.

query_node_exporterC

Query common Linux metrics from node_exporter (CPU, memory, disk, network, load)

Inputs: metric (required), instance (required), timeRange.

query_rangeB

Execute a PromQL range query to get time series data over a time range

Inputs: query (required), start (required), end, step.

query_windows_exporterB

Query common Windows metrics from windows_exporter (CPU, memory, disk, etc.)

Inputs: metric (required), instance (required), timeRange.

test_connectionB

Test connection to Prometheus and verify it is accessible

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target a distinct resource/action (targets, alerts, rules, TSDB, queries), and the exporter-specific helpers (node/windows/blackbox) are clearly labeled by domain. Minor overlap exists between list_targets and get_target_health, and between list_metrics, get_metric_metadata, find_series, and get_label_values, but descriptions clarify boundaries.

    Naming Consistency4/5

    All snake_case with predictable verb_noun form (list_targets, get_alert_rules, query_range). The verb set varies (test/list/get/query/find) but each verb is used sensibly; query_instant and query_range are a slight outlier pairing versus the get_* family but remain readable and consistent with each other.

    Tool Count4/5

    18 tools is on the heavier side but each maps to a concrete Prometheus concept (targets, alerts, rules, TSDB, status, query types, exporter shortcuts). The three exporter convenience wrappers duplicate what query_instant could do, which is slightly redundant, but overall the set is well scoped.

    Completeness4/5

    Covers the core lifecycle: connectivity, target/health discovery, instant and range PromQL queries, metric/label/series exploration, alerts and rule inspection, and server/TSDB status. Minor gaps exist (e.g., no label-name listing distinct from label values, no config reload or admin/series-deletion operations), but agents can work around them.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to execute PromQL queries and discover metrics across multiple Prometheus tenants using the Model Context Protocol. It supports single and multi-tenant configurations with secure authentication for instant and range query analysis.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides access to Prometheus metrics and queries, allowing AI assistants to execute PromQL queries and analyze metrics data through standardized MCP interfaces.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to inspect FOSSA organizations and answer software composition analysis questions through a read-only MCP server.
      100
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that enables AI assistants to query and analyze Prometheus metrics through PromQL, with support for metric discovery and authentication.
      MIT