io.github.pab1it0/prometheus-mcp-server
MCP server for Prometheus, enabling AI assistants to query metrics and monitor system health
Versions
1.2.6latestTools 6
get_metric_metadata Get metadata for one metric or bulk metadata for all metrics. Args: metric: Optional metric name. If provided, returns legacy list format. filter_pattern: Optional substring filter on metric name and descriptions. limit: Maximum number of metrics to return in bulk mode. offset: Number of metrics to skip in bulk mode. Returns: If metric is provided: list of metadata entries for that metric. If metric is not provided: dict with filtered metadata and pagination info.
health_check Return health status of the MCP server and Prometheus connection. Returns: Health status including service information, configuration, and connectivity
execute_query Execute an instant query against Prometheus. Args: query: PromQL query string time: Optional RFC3339 or Unix timestamp (default: current time) Returns: Query result with type (vector, matrix, scalar, string) and values
execute_range_query Execute a range query against Prometheus. Args: query: PromQL query string start: Start time as RFC3339 or Unix timestamp end: End time as RFC3339 or Unix timestamp step: Query resolution step width (e.g., '15s', '1m', '1h') Returns: Range query result with type (usually matrix) and values over time
list_metrics Retrieve a list of all metric names available in Prometheus. Args: limit: Maximum number of metrics to return (default: all metrics) offset: Number of metrics to skip for pagination (default: 0) filter_pattern: Optional substring to filter metric names (case-insensitive) refresh_cache: Force a cache refresh to pick up newly scraped metrics (default: False) Returns: Dictionary containing: - metrics: List of metric names - total_count: Total number of metrics (before pagination) - returned_count: Number of metrics returned - offset: Current offset - has_more: Whether more metrics are available
get_targets Get information about Prometheus scrape targets. Args: state: Which targets to request from Prometheus - "active" (default), "dropped", or "any". This is applied server-side by Prometheus. scrape_pool: Optional scrape pool name to restrict results to, applied server-side by Prometheus. limit: Maximum number of targets to return per category (default: all) offset: Number of targets to skip for pagination (default: 0) Returns: Dictionary containing: - activeTargets / droppedTargets: Target lists (after pagination) - total_active / total_dropped: Totals before pagination - returned_active / returned_dropped: Counts actually returned - offset: Current offset - has_more: Whether more targets are available - state: The state filter that was applied Note: The default is "active" rather than "any" deliberately. On a cluster of any size, service discovery finds far more targets than relabeling keeps, and each dropped target carries its full discoveredLabels map. Requesting dropped targets unfiltered can produce a response large enough to exhaust the server's memory before any pagination could be applied, since the whole payload is parsed first. Pass state="any" or "dropped" explicitly when you need them, ideally with scrape_pool.
Permissions 4
network medium filesystem low shell high env_vars low