Prometheus Monitoring
MCP Server
| Property |
Value |
| Source |
pab1it0/prometheus-mcp-server |
| Transport |
stdio (default), SSE, or HTTP |
| Language |
Python 3.10+ |
| Tools |
6 (query, range query, list metrics, metadata, targets, health check) |
| Auth |
Basic auth (username/password), bearer token, or unauthenticated |
| Install |
pip3 install prometheus-mcp-server (PyPI) |
| Run |
prometheus-mcp-server (stdio) |
How to Run
# stdio mode (default — used by NetClaw)
PROMETHEUS_URL=http://prometheus:9090 prometheus-mcp-server
# HTTP transport mode
PROMETHEUS_MCP_SERVER_TRANSPORT=http PROMETHEUS_URL=http://prometheus:9090 prometheus-mcp-server
# With basic auth
PROMETHEUS_URL=http://prometheus:9090 PROMETHEUS_USERNAME=admin PROMETHEUS_PASSWORD=secret prometheus-mcp-server
# With bearer token (Grafana Cloud, Thanos, etc.)
PROMETHEUS_URL=https://prom.example.com PROMETHEUS_TOKEN=your_bearer_token prometheus-mcp-server
Environment Variables
| Variable |
Required |
Example |
Description |
PROMETHEUS_URL |
Yes |
http://prometheus:9090 |
Prometheus server endpoint |
PROMETHEUS_USERNAME |
No |
admin |
Basic auth username |
PROMETHEUS_PASSWORD |
No |
changeme |
Basic auth password |
PROMETHEUS_TOKEN |
No |
eyJhbG... |
Bearer token (Grafana Cloud, Thanos, Cortex) |
PROMETHEUS_URL_SSL_VERIFY |
No |
false |
Disable SSL certificate verification |
PROMETHEUS_REQUEST_TIMEOUT |
No |
30 |
Request timeout in seconds (default: 30) |
PROMETHEUS_DISABLE_LINKS |
No |
true |
Disable Prometheus UI links in responses (saves context) |
ORG_ID |
No |
1 |
Multi-tenant organization ID (Cortex/Mimir) |
PROMETHEUS_CUSTOM_HEADERS |
No |
{"X-Custom":"val"} |
Additional HTTP headers as JSON |
PROMETHEUS_MCP_SERVER_TRANSPORT |
No |
stdio |
Transport: stdio (default), http, or sse |
Tools
| Tool |
Parameters |
What It Does |
execute_query |
query, timeout? |
Execute instant PromQL query at current time |
execute_range_query |
query, start, end, step, timeout? |
Execute PromQL range query over time interval |
list_metrics |
page?, page_size? |
Browse available metric names with pagination |
get_metric_metadata |
metric?, limit? |
Retrieve metric type, help text, and unit info |
get_targets |
none |
View scrape target details (up/down, labels, last scrape) |
health_check |
none |
Check Prometheus server availability and readiness |
Workflow: Network Device Metric Monitoring
When checking Prometheus for network device metrics:
- Health check:
health_check — verify Prometheus is reachable
- Discover metrics:
list_metrics — find available SNMP/device metrics
- Metric metadata:
get_metric_metadata(metric="ifHCInOctets") — check type and description
- Instant query:
execute_query(query="up{job='snmp'}") — check which targets are up
- Range query:
execute_range_query — trend analysis over time:
- Interface traffic:
rate(ifHCInOctets{instance="router1"}[5m]) * 8
- CPU utilization:
device_cpu_utilization{device="core-rtr-01"}
- Interface errors:
increase(ifInErrors{device=~".*"}[1h])
- BGP peer state:
bgp_peer_state{peer="10.1.1.2"}
- Scrape targets:
get_targets — verify SNMP exporters and device scrape health
- GAIT: Record all queries in audit trail
Example: Interface Utilization Check
health_check()
list_metrics(page=1, page_size=50)
execute_query(query="rate(ifHCInOctets{device='core-rtr-01'}[5m]) * 8")
execute_range_query(query="rate(ifHCOutOctets{device='core-rtr-01'}[5m]) * 8", start="2024-01-01T00:00:00Z", end="2024-01-01T01:00:00Z", step="60s")
get_targets()
Workflow: Alert Threshold Investigation
When investigating whether metrics are crossing alert thresholds:
- Discover metrics:
list_metrics — find the metric name
- Check metadata:
get_metric_metadata — understand metric type (counter, gauge, histogram)
- Current value:
execute_query — get current metric value
- Historical trend:
execute_range_query — check trend over past 1h/6h/24h
- Compare targets:
get_targets — check if specific exporters are down
- Report: Metric analysis with current value, trend direction, and recommendation
Workflow: Capacity Planning
When analyzing capacity trends for network infrastructure:
- Discover metrics:
list_metrics — find bandwidth/utilization metrics
- Peak analysis:
execute_range_query with max_over_time():
max_over_time(rate(ifHCInOctets{device="core-rtr-01",ifName="Gi0/0"}[5m])[7d:1h]) * 8
- 95th percentile:
execute_range_query with quantile_over_time():
quantile_over_time(0.95, rate(ifHCInOctets{device="core-rtr-01"}[5m])[30d:1h]) * 8
- Growth rate: Compare weekly/monthly averages
- Report: Utilization summary with capacity headroom and growth projection
Integration with Other Skills
| Skill |
Integration |
| grafana-observability |
Grafana dashboards visualize Prometheus data; use Prometheus skill for direct PromQL when Grafana isn't available or for ad-hoc queries |
| pyats-health-check |
Cross-reference pyATS device health with Prometheus time-series metrics |
| pyats-routing |
Correlate OSPF/BGP state changes with Prometheus metric timelines |
| gait-session-tracking |
Record all Prometheus queries and findings in GAIT audit trail |
| te-network-monitoring |
Pair ThousandEyes path data with Prometheus infrastructure metrics |
| sdwan-ops |
Correlate SD-WAN vManage alarms with Prometheus device metrics |
| servicenow-change-workflow |
Reference Prometheus metrics as evidence in change requests |
Important Rules
- Prefer read-only operations — all 6 tools are read-only; no Prometheus configuration changes
- Use pagination for metric lists —
list_metrics supports page and page_size to avoid large responses
- Specify time ranges carefully — overly broad
execute_range_query time ranges return large result sets
- Disable links for context efficiency — set
PROMETHEUS_DISABLE_LINKS=true to reduce response size
- GAIT audit mandatory — record all Prometheus queries and metric analysis in audit trail
- No secrets in queries — never embed credentials or sensitive data in PromQL expressions
- Verify connectivity first — use
health_check before running queries to confirm Prometheus is reachable
Error Handling
- Auth fails (401/403): Check
PROMETHEUS_URL, PROMETHEUS_USERNAME/PROMETHEUS_PASSWORD, or PROMETHEUS_TOKEN in ~/.openclaw/.env. Verify Prometheus allows the configured auth method.
- Connection refused: Verify
PROMETHEUS_URL is reachable. Use health_check to diagnose connectivity.
- PromQL syntax errors: Use
list_metrics and get_metric_metadata to discover valid metric names before querying.
- Empty results: Check
get_targets to verify scrape targets are up and the expected labels exist.
- Timeout errors: Increase
PROMETHEUS_REQUEST_TIMEOUT for slow queries or large result sets.
- SSL errors: Set
PROMETHEUS_URL_SSL_VERIFY=false for self-signed certificates (development only).
1---
2name: prometheus-monitoring
3description: "Prometheus monitoring — PromQL instant/range queries, metric discovery, metadata, scrape target health, system health checks (6 tools). Use when querying Prometheus metrics, checking scrape targets, investigating alert thresholds, or analyzing network device utilization trends."
4license: Apache-2.0
5user-invocable: true
6metadata:
7 { "openclaw": { "requires": { "bins": ["pip3"], "env": ["PROMETHEUS_URL"] } } }
8---
9
10# Prometheus Monitoring
11
12## MCP Server
13
14| Property | Value |
15|----------|-------|
16| **Source** | [pab1it0/prometheus-mcp-server](https://github.com/pab1it0/prometheus-mcp-server) |
17| **Transport** | stdio (default), SSE, or HTTP |
18| **Language** | Python 3.10+ |
19| **Tools** | 6 (query, range query, list metrics, metadata, targets, health check) |
20| **Auth** | Basic auth (username/password), bearer token, or unauthenticated |
21| **Install** | `pip3 install prometheus-mcp-server` (PyPI) |
22| **Run** | `prometheus-mcp-server` (stdio) |
23
24## How to Run
25
26```bash
27# stdio mode (default — used by NetClaw)
28PROMETHEUS_URL=http://prometheus:9090 prometheus-mcp-server
29
30# HTTP transport mode
31PROMETHEUS_MCP_SERVER_TRANSPORT=http PROMETHEUS_URL=http://prometheus:9090 prometheus-mcp-server
32
33# With basic auth
34PROMETHEUS_URL=http://prometheus:9090 PROMETHEUS_USERNAME=admin PROMETHEUS_PASSWORD=secret prometheus-mcp-server
35
36# With bearer token (Grafana Cloud, Thanos, etc.)
37PROMETHEUS_URL=https://prom.example.com PROMETHEUS_TOKEN=your_bearer_token prometheus-mcp-server
38```
39
40## Environment Variables
41
42| Variable | Required | Example | Description |
43|----------|----------|---------|-------------|
44| `PROMETHEUS_URL` | Yes | `http://prometheus:9090` | Prometheus server endpoint |
45| `PROMETHEUS_USERNAME` | No | `admin` | Basic auth username |
46| `PROMETHEUS_PASSWORD` | No | `changeme` | Basic auth password |
47| `PROMETHEUS_TOKEN` | No | `eyJhbG...` | Bearer token (Grafana Cloud, Thanos, Cortex) |
48| `PROMETHEUS_URL_SSL_VERIFY` | No | `false` | Disable SSL certificate verification |
49| `PROMETHEUS_REQUEST_TIMEOUT` | No | `30` | Request timeout in seconds (default: 30) |
50| `PROMETHEUS_DISABLE_LINKS` | No | `true` | Disable Prometheus UI links in responses (saves context) |
51| `ORG_ID` | No | `1` | Multi-tenant organization ID (Cortex/Mimir) |
52| `PROMETHEUS_CUSTOM_HEADERS` | No | `{"X-Custom":"val"}` | Additional HTTP headers as JSON |
53| `PROMETHEUS_MCP_SERVER_TRANSPORT` | No | `stdio` | Transport: stdio (default), http, or sse |
54
55## Tools
56
57| Tool | Parameters | What It Does |
58|------|-----------|-------------|
59| `execute_query` | `query`, `timeout?` | Execute instant PromQL query at current time |
60| `execute_range_query` | `query`, `start`, `end`, `step`, `timeout?` | Execute PromQL range query over time interval |
61| `list_metrics` | `page?`, `page_size?` | Browse available metric names with pagination |
62| `get_metric_metadata` | `metric?`, `limit?` | Retrieve metric type, help text, and unit info |
63| `get_targets` | none | View scrape target details (up/down, labels, last scrape) |
64| `health_check` | none | Check Prometheus server availability and readiness |
65
66---
67
68## Workflow: Network Device Metric Monitoring
69
70When checking Prometheus for network device metrics:
71
721. **Health check**: `health_check` — verify Prometheus is reachable
732. **Discover metrics**: `list_metrics` — find available SNMP/device metrics
743. **Metric metadata**: `get_metric_metadata(metric="ifHCInOctets")` — check type and description
754. **Instant query**: `execute_query(query="up{job='snmp'}")` — check which targets are up
765. **Range query**: `execute_range_query` — trend analysis over time:
77 - Interface traffic: `rate(ifHCInOctets{instance="router1"}[5m]) * 8`
78 - CPU utilization: `device_cpu_utilization{device="core-rtr-01"}`
79 - Interface errors: `increase(ifInErrors{device=~".*"}[1h])`
80 - BGP peer state: `bgp_peer_state{peer="10.1.1.2"}`
816. **Scrape targets**: `get_targets` — verify SNMP exporters and device scrape health
827. **GAIT**: Record all queries in audit trail
83
84### Example: Interface Utilization Check
85
86```
87health_check()
88list_metrics(page=1, page_size=50)
89execute_query(query="rate(ifHCInOctets{device='core-rtr-01'}[5m]) * 8")
90execute_range_query(query="rate(ifHCOutOctets{device='core-rtr-01'}[5m]) * 8", start="2024-01-01T00:00:00Z", end="2024-01-01T01:00:00Z", step="60s")
91get_targets()
92```
93
94## Workflow: Alert Threshold Investigation
95
96When investigating whether metrics are crossing alert thresholds:
97
981. **Discover metrics**: `list_metrics` — find the metric name
992. **Check metadata**: `get_metric_metadata` — understand metric type (counter, gauge, histogram)
1003. **Current value**: `execute_query` — get current metric value
1014. **Historical trend**: `execute_range_query` — check trend over past 1h/6h/24h
1025. **Compare targets**: `get_targets` — check if specific exporters are down
1036. **Report**: Metric analysis with current value, trend direction, and recommendation
104
105## Workflow: Capacity Planning
106
107When analyzing capacity trends for network infrastructure:
108
1091. **Discover metrics**: `list_metrics` — find bandwidth/utilization metrics
1102. **Peak analysis**: `execute_range_query` with `max_over_time()`:
111 - `max_over_time(rate(ifHCInOctets{device="core-rtr-01",ifName="Gi0/0"}[5m])[7d:1h]) * 8`
1123. **95th percentile**: `execute_range_query` with `quantile_over_time()`:
113 - `quantile_over_time(0.95, rate(ifHCInOctets{device="core-rtr-01"}[5m])[30d:1h]) * 8`
1144. **Growth rate**: Compare weekly/monthly averages
1155. **Report**: Utilization summary with capacity headroom and growth projection
116
117---
118
119## Integration with Other Skills
120
121| Skill | Integration |
122|-------|-------------|
123| **grafana-observability** | Grafana dashboards visualize Prometheus data; use Prometheus skill for direct PromQL when Grafana isn't available or for ad-hoc queries |
124| **pyats-health-check** | Cross-reference pyATS device health with Prometheus time-series metrics |
125| **pyats-routing** | Correlate OSPF/BGP state changes with Prometheus metric timelines |
126| **gait-session-tracking** | Record all Prometheus queries and findings in GAIT audit trail |
127| **te-network-monitoring** | Pair ThousandEyes path data with Prometheus infrastructure metrics |
128| **sdwan-ops** | Correlate SD-WAN vManage alarms with Prometheus device metrics |
129| **servicenow-change-workflow** | Reference Prometheus metrics as evidence in change requests |
130
131---
132
133## Important Rules
134
135- **Prefer read-only operations** — all 6 tools are read-only; no Prometheus configuration changes
136- **Use pagination for metric lists** — `list_metrics` supports `page` and `page_size` to avoid large responses
137- **Specify time ranges carefully** — overly broad `execute_range_query` time ranges return large result sets
138- **Disable links for context efficiency** — set `PROMETHEUS_DISABLE_LINKS=true` to reduce response size
139- **GAIT audit mandatory** — record all Prometheus queries and metric analysis in audit trail
140- **No secrets in queries** — never embed credentials or sensitive data in PromQL expressions
141- **Verify connectivity first** — use `health_check` before running queries to confirm Prometheus is reachable
142
143## Error Handling
144
145- **Auth fails (401/403)**: Check `PROMETHEUS_URL`, `PROMETHEUS_USERNAME`/`PROMETHEUS_PASSWORD`, or `PROMETHEUS_TOKEN` in `~/.openclaw/.env`. Verify Prometheus allows the configured auth method.
146- **Connection refused**: Verify `PROMETHEUS_URL` is reachable. Use `health_check` to diagnose connectivity.
147- **PromQL syntax errors**: Use `list_metrics` and `get_metric_metadata` to discover valid metric names before querying.
148- **Empty results**: Check `get_targets` to verify scrape targets are up and the expected labels exist.
149- **Timeout errors**: Increase `PROMETHEUS_REQUEST_TIMEOUT` for slow queries or large result sets.
150- **SSL errors**: Set `PROMETHEUS_URL_SSL_VERIFY=false` for self-signed certificates (development only).