Grafana Observability
MCP Server
| Property |
Value |
| Source |
grafana/mcp-grafana |
| Transport |
stdio (default), SSE, or streamable-http |
| Language |
Go (runs via uvx mcp-grafana) |
| Tools |
75+ (dashboards, Prometheus, Loki, alerting, incidents, OnCall, annotations, admin) |
| Auth |
Service account token (preferred) or username/password |
| Requires |
Grafana 9.0+, service account with Editor role or granular RBAC |
How to Run
# stdio mode (default — used by NetClaw)
uvx mcp-grafana
# Read-only mode (prevents dashboard/alert modifications)
uvx mcp-grafana --disable-write
Environment Variables
| Variable |
Required |
Example |
Description |
GRAFANA_URL |
Yes |
http://grafana.example.com:3000 |
Grafana instance URL |
GRAFANA_SERVICE_ACCOUNT_TOKEN |
Yes* |
glsa_abc123... |
Service account token (preferred auth) |
GRAFANA_USERNAME |
Alt |
admin |
Basic auth username (alternative to token) |
GRAFANA_PASSWORD |
Alt |
changeme |
Basic auth password |
GRAFANA_ORG_ID |
No |
1 |
Organization ID for multi-org setups |
*Either service account token or username/password required.
Key Tool Categories
Dashboard Operations
| Tool |
What It Does |
search_dashboards |
Find dashboards by title or metadata |
get_dashboard_summary |
Lightweight overview (context-efficient — use this first) |
get_dashboard_by_uid |
Full dashboard JSON (large — use sparingly) |
get_dashboard_property |
Extract specific fields via JSONPath |
get_dashboard_panel_queries |
Extract panel query details |
update_dashboard |
Create or modify dashboards |
patch_dashboard |
Targeted modifications without full JSON replacement |
Prometheus (PromQL)
| Tool |
What It Does |
query_prometheus |
Execute instant or range PromQL queries |
list_prometheus_metric_names |
Discover available metrics |
list_prometheus_label_names |
List labels matching selectors |
list_prometheus_label_values |
Retrieve values for a specific label |
query_prometheus_histogram |
Calculate percentiles (p50, p90, p95, p99) |
list_prometheus_metric_metadata |
Metric type, help text, unit |
Loki (LogQL)
| Tool |
What It Does |
query_loki_logs |
Execute LogQL queries against log streams |
list_loki_label_names |
Discover available log labels |
list_loki_label_values |
List values for a specific log label |
query_loki_stats |
Stream statistics (volume, rate) |
query_loki_patterns |
Detect log structure patterns |
Alerting
| Tool |
What It Does |
list_alert_rules |
View all Grafana and datasource-managed alert rules |
get_alert_rule_by_uid |
Retrieve specific alert rule details |
create_alert_rule |
Create new alert rule |
update_alert_rule |
Modify existing alert rule |
delete_alert_rule |
Remove alert rule |
list_contact_points |
View notification endpoints (email, Slack, PagerDuty, etc.) |
Incident Management
| Tool |
What It Does |
list_incidents |
View Grafana Incidents with filtering |
get_incident |
Single incident details |
create_incident |
Create a new incident |
add_activity_to_incident |
Add timeline entry to incident |
OnCall
| Tool |
What It Does |
list_oncall_schedules |
View on-call rotation schedules |
get_oncall_shift |
Shift details |
get_current_oncall_users |
Who is on call right now |
list_alert_groups |
OnCall alert groups with filtering |
Annotations & Rendering
| Tool |
What It Does |
get_annotations |
Query annotations with time/tag filters |
create_annotation |
Add annotation to dashboard/panel |
get_panel_image |
Render a panel or dashboard as PNG image |
generate_deeplink |
Create accurate Grafana URLs for sharing |
Investigation (Sift)
| Tool |
What It Does |
list_sift_investigations |
List automated investigations |
get_sift_investigation |
Investigation details |
find_error_pattern_logs |
Detect elevated error patterns in logs |
find_slow_requests |
Identify slow requests via Tempo traces |
Workflow: Network Infrastructure Monitoring
When checking network device metrics in Grafana:
- Find dashboards:
search_dashboards with keyword (e.g., "network", "interface", "BGP")
- Dashboard overview:
get_dashboard_summary for panel list without full JSON
- Query metrics:
query_prometheus with PromQL for specific metrics:
- Interface traffic:
rate(ifHCInOctets{instance="router1"}[5m]) * 8
- BGP peer state:
bgp_peer_state{peer="10.1.1.2"}
- CPU utilization:
device_cpu_utilization{device="core-rtr-01"}
- Interface errors:
increase(ifInErrors{device=~".*"}[1h])
- Check alerts:
list_alert_rules to see active alerting thresholds
- Search logs:
query_loki_logs for syslog or SNMP trap data
- Report: Metrics summary with alert status and log correlation
- GAIT: Record all queries in audit trail
Example: Interface Utilization Check
search_dashboards(title="Network Interfaces")
get_dashboard_summary(uid="abc123")
query_prometheus(expr="rate(ifHCInOctets{device='core-rtr-01'}[5m]) * 8", time_range="1h")
query_prometheus(expr="rate(ifHCOutOctets{device='core-rtr-01'}[5m]) * 8", time_range="1h")
list_alert_rules(folder="Network")
Workflow: Alert Investigation
When investigating Grafana alerts:
- List alerts:
list_alert_rules — find firing or pending rules
- Alert details:
get_alert_rule_by_uid — thresholds, conditions, datasource
- Query metrics:
query_prometheus — check the metric that triggered the alert
- Search logs:
query_loki_logs — correlate with log events around alert time
- Check incidents:
list_incidents — is this already tracked?
- Contact points:
list_contact_points — verify notification routes
- Report: Alert analysis with root cause and metric evidence
Workflow: Incident Response
When responding to a Grafana incident:
- List incidents:
list_incidents — find open incidents
- Incident details:
get_incident — timeline, severity, labels
- OnCall:
get_current_oncall_users — who should be notified
- Correlate metrics:
query_prometheus — check affected service metrics
- Correlate logs:
query_loki_logs — find error patterns around incident time
- Investigate:
find_error_pattern_logs — automated error pattern detection
- Update incident:
add_activity_to_incident — add findings to timeline
- Annotate:
create_annotation — mark event on relevant dashboards
Workflow: Log Analysis
When investigating network logs stored in Loki:
- Discover labels:
list_loki_label_names — find available labels (host, severity, facility)
- Label values:
list_loki_label_values — enumerate hosts, severity levels
- Query logs:
query_loki_logs with LogQL:
- By device:
{host="core-rtr-01"}
- By severity:
{host="core-rtr-01"} |= "error"
- Pattern match:
{job="syslog"} |~ "BGP|OSPF"
- Patterns:
query_loki_patterns — detect recurring log structures
- Stats:
query_loki_stats — log volume and rate analysis
Integration with Other Skills
| Skill |
Integration |
| pyats-health-check |
Cross-reference pyATS health data with Grafana metrics and dashboards |
| pyats-routing |
Correlate OSPF/BGP state changes with Grafana metric timelines |
| gait-session-tracking |
Record all Grafana queries and findings in GAIT audit trail |
| slack-network-alerts |
Grafana alerts fed through Slack + NetClaw for automated investigation |
| servicenow-change-workflow |
Annotate Grafana dashboards during change windows; correlate incidents with CRs |
| te-network-monitoring |
Pair ThousandEyes path data with Grafana infrastructure metrics |
| aws-cloud-monitoring |
Compare Grafana dashboards with CloudWatch data for hybrid visibility |
| markmap-viz |
Visualize Grafana alert rule hierarchies as mind maps |
Context Window Management
Grafana dashboards can be large JSON documents. Use these strategies:
- Always start with
get_dashboard_summary — lightweight overview, not full JSON
- Use
get_dashboard_property with JSONPath for specific fields
- Avoid
get_dashboard_by_uid unless you need the complete dashboard definition
- Use
get_dashboard_panel_queries to extract just the query definitions
Important Rules
- Prefer read-only operations — use
search_dashboards, get_dashboard_summary, query_prometheus, query_loki_logs, list_alert_rules before any write operations
- Dashboard modifications require ServiceNow CR — unless in lab/dev Grafana instance
- Alert rule changes require approval — creating/updating/deleting alert rules affects production monitoring
- Token-efficient queries — use
get_dashboard_summary over get_dashboard_by_uid, use time ranges to limit Prometheus/Loki result size
- GAIT audit mandatory — record all Grafana queries, dashboard modifications, alert changes, and incident updates
- No secrets in queries — never embed credentials or sensitive data in PromQL/LogQL expressions
Error Handling
- Auth fails (401/403): Check
GRAFANA_URL and GRAFANA_SERVICE_ACCOUNT_TOKEN in ~/.openclaw/.env. Verify service account has Editor role or required RBAC permissions.
- Datasource not found: Use
list_datasources to discover available datasource UIDs and names.
- PromQL/LogQL errors: Use
list_prometheus_metric_names or list_loki_label_names to discover valid metric/label names before querying.
- Dashboard not found: Use
search_dashboards to find dashboards by title before using UID-based tools.
- Rate limiting: Grafana may rate-limit API requests; space out large query batches.
1---
2name: grafana-observability
3description: "Grafana observability platform — dashboards, Prometheus PromQL, Loki LogQL, alerting, incidents, OnCall schedules, annotations, datasource queries, panel rendering (75+ tools). Use when querying Grafana dashboards, running PromQL for interface metrics, searching Loki logs for syslog events, investigating firing alerts, or checking who is on call."
4license: Apache-2.0
5user-invocable: true
6metadata:
7 { "openclaw": { "requires": { "bins": ["uvx"], "env": ["GRAFANA_URL", "GRAFANA_SERVICE_ACCOUNT_TOKEN"] } } }
8---
9
10# Grafana Observability
11
12## MCP Server
13
14| Property | Value |
15|----------|-------|
16| **Source** | [grafana/mcp-grafana](https://github.com/grafana/mcp-grafana) |
17| **Transport** | stdio (default), SSE, or streamable-http |
18| **Language** | Go (runs via `uvx mcp-grafana`) |
19| **Tools** | 75+ (dashboards, Prometheus, Loki, alerting, incidents, OnCall, annotations, admin) |
20| **Auth** | Service account token (preferred) or username/password |
21| **Requires** | Grafana 9.0+, service account with Editor role or granular RBAC |
22
23## How to Run
24
25```bash
26# stdio mode (default — used by NetClaw)
27uvx mcp-grafana
28
29# Read-only mode (prevents dashboard/alert modifications)
30uvx mcp-grafana --disable-write
31```
32
33## Environment Variables
34
35| Variable | Required | Example | Description |
36|----------|----------|---------|-------------|
37| `GRAFANA_URL` | Yes | `http://grafana.example.com:3000` | Grafana instance URL |
38| `GRAFANA_SERVICE_ACCOUNT_TOKEN` | Yes* | `glsa_abc123...` | Service account token (preferred auth) |
39| `GRAFANA_USERNAME` | Alt | `admin` | Basic auth username (alternative to token) |
40| `GRAFANA_PASSWORD` | Alt | `changeme` | Basic auth password |
41| `GRAFANA_ORG_ID` | No | `1` | Organization ID for multi-org setups |
42
43*Either service account token or username/password required.
44
45## Key Tool Categories
46
47### Dashboard Operations
48
49| Tool | What It Does |
50|------|-------------|
51| `search_dashboards` | Find dashboards by title or metadata |
52| `get_dashboard_summary` | Lightweight overview (context-efficient — use this first) |
53| `get_dashboard_by_uid` | Full dashboard JSON (large — use sparingly) |
54| `get_dashboard_property` | Extract specific fields via JSONPath |
55| `get_dashboard_panel_queries` | Extract panel query details |
56| `update_dashboard` | Create or modify dashboards |
57| `patch_dashboard` | Targeted modifications without full JSON replacement |
58
59### Prometheus (PromQL)
60
61| Tool | What It Does |
62|------|-------------|
63| `query_prometheus` | Execute instant or range PromQL queries |
64| `list_prometheus_metric_names` | Discover available metrics |
65| `list_prometheus_label_names` | List labels matching selectors |
66| `list_prometheus_label_values` | Retrieve values for a specific label |
67| `query_prometheus_histogram` | Calculate percentiles (p50, p90, p95, p99) |
68| `list_prometheus_metric_metadata` | Metric type, help text, unit |
69
70### Loki (LogQL)
71
72| Tool | What It Does |
73|------|-------------|
74| `query_loki_logs` | Execute LogQL queries against log streams |
75| `list_loki_label_names` | Discover available log labels |
76| `list_loki_label_values` | List values for a specific log label |
77| `query_loki_stats` | Stream statistics (volume, rate) |
78| `query_loki_patterns` | Detect log structure patterns |
79
80### Alerting
81
82| Tool | What It Does |
83|------|-------------|
84| `list_alert_rules` | View all Grafana and datasource-managed alert rules |
85| `get_alert_rule_by_uid` | Retrieve specific alert rule details |
86| `create_alert_rule` | Create new alert rule |
87| `update_alert_rule` | Modify existing alert rule |
88| `delete_alert_rule` | Remove alert rule |
89| `list_contact_points` | View notification endpoints (email, Slack, PagerDuty, etc.) |
90
91### Incident Management
92
93| Tool | What It Does |
94|------|-------------|
95| `list_incidents` | View Grafana Incidents with filtering |
96| `get_incident` | Single incident details |
97| `create_incident` | Create a new incident |
98| `add_activity_to_incident` | Add timeline entry to incident |
99
100### OnCall
101
102| Tool | What It Does |
103|------|-------------|
104| `list_oncall_schedules` | View on-call rotation schedules |
105| `get_oncall_shift` | Shift details |
106| `get_current_oncall_users` | Who is on call right now |
107| `list_alert_groups` | OnCall alert groups with filtering |
108
109### Annotations & Rendering
110
111| Tool | What It Does |
112|------|-------------|
113| `get_annotations` | Query annotations with time/tag filters |
114| `create_annotation` | Add annotation to dashboard/panel |
115| `get_panel_image` | Render a panel or dashboard as PNG image |
116| `generate_deeplink` | Create accurate Grafana URLs for sharing |
117
118### Investigation (Sift)
119
120| Tool | What It Does |
121|------|-------------|
122| `list_sift_investigations` | List automated investigations |
123| `get_sift_investigation` | Investigation details |
124| `find_error_pattern_logs` | Detect elevated error patterns in logs |
125| `find_slow_requests` | Identify slow requests via Tempo traces |
126
127---
128
129## Workflow: Network Infrastructure Monitoring
130
131When checking network device metrics in Grafana:
132
1331. **Find dashboards**: `search_dashboards` with keyword (e.g., "network", "interface", "BGP")
1342. **Dashboard overview**: `get_dashboard_summary` for panel list without full JSON
1353. **Query metrics**: `query_prometheus` with PromQL for specific metrics:
136 - Interface traffic: `rate(ifHCInOctets{instance="router1"}[5m]) * 8`
137 - BGP peer state: `bgp_peer_state{peer="10.1.1.2"}`
138 - CPU utilization: `device_cpu_utilization{device="core-rtr-01"}`
139 - Interface errors: `increase(ifInErrors{device=~".*"}[1h])`
1404. **Check alerts**: `list_alert_rules` to see active alerting thresholds
1415. **Search logs**: `query_loki_logs` for syslog or SNMP trap data
1426. **Report**: Metrics summary with alert status and log correlation
1437. **GAIT**: Record all queries in audit trail
144
145### Example: Interface Utilization Check
146
147```
148search_dashboards(title="Network Interfaces")
149get_dashboard_summary(uid="abc123")
150query_prometheus(expr="rate(ifHCInOctets{device='core-rtr-01'}[5m]) * 8", time_range="1h")
151query_prometheus(expr="rate(ifHCOutOctets{device='core-rtr-01'}[5m]) * 8", time_range="1h")
152list_alert_rules(folder="Network")
153```
154
155## Workflow: Alert Investigation
156
157When investigating Grafana alerts:
158
1591. **List alerts**: `list_alert_rules` — find firing or pending rules
1602. **Alert details**: `get_alert_rule_by_uid` — thresholds, conditions, datasource
1613. **Query metrics**: `query_prometheus` — check the metric that triggered the alert
1624. **Search logs**: `query_loki_logs` — correlate with log events around alert time
1635. **Check incidents**: `list_incidents` — is this already tracked?
1646. **Contact points**: `list_contact_points` — verify notification routes
1657. **Report**: Alert analysis with root cause and metric evidence
166
167## Workflow: Incident Response
168
169When responding to a Grafana incident:
170
1711. **List incidents**: `list_incidents` — find open incidents
1722. **Incident details**: `get_incident` — timeline, severity, labels
1733. **OnCall**: `get_current_oncall_users` — who should be notified
1744. **Correlate metrics**: `query_prometheus` — check affected service metrics
1755. **Correlate logs**: `query_loki_logs` — find error patterns around incident time
1766. **Investigate**: `find_error_pattern_logs` — automated error pattern detection
1777. **Update incident**: `add_activity_to_incident` — add findings to timeline
1788. **Annotate**: `create_annotation` — mark event on relevant dashboards
179
180## Workflow: Log Analysis
181
182When investigating network logs stored in Loki:
183
1841. **Discover labels**: `list_loki_label_names` — find available labels (host, severity, facility)
1852. **Label values**: `list_loki_label_values` — enumerate hosts, severity levels
1863. **Query logs**: `query_loki_logs` with LogQL:
187 - By device: `{host="core-rtr-01"}`
188 - By severity: `{host="core-rtr-01"} |= "error"`
189 - Pattern match: `{job="syslog"} |~ "BGP|OSPF"`
1904. **Patterns**: `query_loki_patterns` — detect recurring log structures
1915. **Stats**: `query_loki_stats` — log volume and rate analysis
192
193---
194
195## Integration with Other Skills
196
197| Skill | Integration |
198|-------|-------------|
199| **pyats-health-check** | Cross-reference pyATS health data with Grafana metrics and dashboards |
200| **pyats-routing** | Correlate OSPF/BGP state changes with Grafana metric timelines |
201| **gait-session-tracking** | Record all Grafana queries and findings in GAIT audit trail |
202| **slack-network-alerts** | Grafana alerts fed through Slack + NetClaw for automated investigation |
203| **servicenow-change-workflow** | Annotate Grafana dashboards during change windows; correlate incidents with CRs |
204| **te-network-monitoring** | Pair ThousandEyes path data with Grafana infrastructure metrics |
205| **aws-cloud-monitoring** | Compare Grafana dashboards with CloudWatch data for hybrid visibility |
206| **markmap-viz** | Visualize Grafana alert rule hierarchies as mind maps |
207
208---
209
210## Context Window Management
211
212Grafana dashboards can be large JSON documents. Use these strategies:
213
2141. **Always start with `get_dashboard_summary`** — lightweight overview, not full JSON
2152. **Use `get_dashboard_property`** with JSONPath for specific fields
2163. **Avoid `get_dashboard_by_uid`** unless you need the complete dashboard definition
2174. **Use `get_dashboard_panel_queries`** to extract just the query definitions
218
219---
220
221## Important Rules
222
223- **Prefer read-only operations** — use `search_dashboards`, `get_dashboard_summary`, `query_prometheus`, `query_loki_logs`, `list_alert_rules` before any write operations
224- **Dashboard modifications require ServiceNow CR** — unless in lab/dev Grafana instance
225- **Alert rule changes require approval** — creating/updating/deleting alert rules affects production monitoring
226- **Token-efficient queries** — use `get_dashboard_summary` over `get_dashboard_by_uid`, use time ranges to limit Prometheus/Loki result size
227- **GAIT audit mandatory** — record all Grafana queries, dashboard modifications, alert changes, and incident updates
228- **No secrets in queries** — never embed credentials or sensitive data in PromQL/LogQL expressions
229
230## Error Handling
231
232- **Auth fails (401/403)**: Check `GRAFANA_URL` and `GRAFANA_SERVICE_ACCOUNT_TOKEN` in `~/.openclaw/.env`. Verify service account has Editor role or required RBAC permissions.
233- **Datasource not found**: Use `list_datasources` to discover available datasource UIDs and names.
234- **PromQL/LogQL errors**: Use `list_prometheus_metric_names` or `list_loki_label_names` to discover valid metric/label names before querying.
235- **Dashboard not found**: Use `search_dashboards` to find dashboards by title before using UID-based tools.
236- **Rate limiting**: Grafana may rate-limit API requests; space out large query batches.