Self-hosted
Monitoring & Observability Basic Auth

Prometheus REST API

Pull-based monitoring system with powerful query language

Prometheus is an open-source monitoring and alerting toolkit designed for reliability and scalability. It collects and stores metrics as time series data, providing a powerful query language (PromQL) for analysis and visualization. Developers use Prometheus to monitor infrastructure, applications, and services with dimensional data modeling and built-in alerting.

Base URL http://localhost:9090/api/v1

API Endpoints

MethodEndpointDescription
GET/queryEvaluates an instant query at a single point in time. Requires a PromQL expression in the query parameter.
GET/query_rangeEvaluates an expression query over a range of time. Accepts start, end, and step parameters to define the time window.
GET/seriesReturns the list of time series that match a certain label set
GET/labelsReturns a list of label names. Optionally filtered by start and end time parameters.
GET/label//valuesReturns a list of label values for a provided label name. The label_name is specified in the path.
GET/targetsReturns an overview of the current state of the Prometheus target discovery
GET/rulesReturns a list of alerting and recording rules. Includes rule groups, evaluation times, and health status.
GET/alertsReturns a list of all active alerts. Includes alert state, labels, annotations, and firing duration.
GET/alertmanagersReturns an overview of the current state of the Prometheus alertmanager discovery
GET/status/configReturns the current Prometheus configuration. Includes the YAML config as loaded at startup.
GET/status/flagsReturns the flag values that Prometheus was configured with. Shows command-line flags and their current values.
GET/status/runtimeinfoReturns runtime information about the Prometheus server. Includes startup time, storage retention, and Go runtime details.
GET/metadataReturns metadata about metrics currently scraped from targets
POST/admin/tsdb/snapshotCreates a snapshot of all current data into a subdirectory. Returns the snapshot directory name for backup purposes.
POST/admin/tsdb/delete_seriesDeletes data for a selection of series in a time range. Requires match[] selectors and optional start/end timestamps.

Code Examples

curl -G 'http://localhost:9090/api/v1/query' \
  --data-urlencode 'query=up' \
  --data-urlencode 'time=2024-01-15T10:30:00.000Z' \
  -u 'admin:password'

Use Prometheus from Claude / Cursor / ChatGPT

Prometheus is a self-hosted protocol — it lives on a host you operate (default http://localhost:9090/api/v1). A hosted MCP gateway can't reach localhost on your machine, so the usual one-click setup doesn't apply. These are the tools an MCP for Prometheus would expose:

query_prometheus_metrics Execute PromQL queries to retrieve current metric values and analyze system health
get_metric_history Query time-series data over a range to analyze trends and patterns in metrics
list_active_alerts Retrieve all currently firing alerts with their labels and annotations
discover_targets Get the current status of all monitored targets and their health state
analyze_metric_cardinality Examine metric labels and cardinality to optimize monitoring performance

Run an Prometheus MCP locally

The local-CLI version of these tools is on the way (npx @meru/rest-mcp --vendor=prometheus · BYO connection string · zero secrets sent to us). For now use the patterns below in your own MCP server, or self-host one from the IOX templates.

Build your own Prometheus MCP →

Related APIs