> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grafana as an MCP

> Let your AI agents use Grafana in real time through the Nekt MCP Gateway.

Grafana is an open-source platform for monitoring and observability. By connecting Grafana to Nekt, your AI agent can query metrics, search dashboards, analyze logs and traces, and create annotations across your infrastructure in real time.

| | Available |
| :- | :- |
| **Nekt Express** | Yes |
| **GCP** | Yes |
| **AWS** | Yes |

## Adding Grafana as an MCP

Before you start, make sure the [MCP Server](/mcp-server/setup) is set up. See [MCPs](/mcps/overview) for how MCPs work.

1. Go to **Activate → [MCPs](https://app.nekt.ai/mcps)**, click **New MCP** and choose **Grafana**.
2. **Name your MCP** and describe what it is used for. The agent reads the description to choose between MCPs of the same provider.
3. **Setup access**. To authenticate, you need a service account token from your Grafana instance.

   1. In Grafana, create a new service account.
   2. Grant it the Viewer role, or the Editor role if you want the agent to use write tools.
   3. Generate a token for the service account.

   Provide the following fields:

   * **Grafana URL** (Required): Base URL of your Grafana instance — a Grafana Cloud stack (`https://<stack>.grafana.net`) or a self-hosted deployment.
   * **Service account token** (Required): Token of a Grafana service account with access to the dashboards, datasources and alerts you want to use.
4. **Select tools**. Pick the tools your agents can use. See [Available tools](#available-tools) below.
5. Click **Save**. On Growth and Custom plans, choose who can use it; see [Access levels](/mcps/overview#access-levels).

## Example prompts

* "Are there any active alerts firing right now?"
* "Search for the infrastructure overview dashboard and summarize its panels."
* "Run a PromQL query to show the error rate over the last 30 minutes."
* "Check the Loki logs for any authentication failures in the past hour."
* "Create a new annotation marking a production deployment."

## Available tools

Choose which of these tools your agents can use in **Select tools**.

### Read tools

| Tool | Description | Parameters |
| :- | :- | :- |
| `get_active_alerts` | Get the alerts currently firing in Grafana's alertmanager, with labels, state and start time. | — |
| `get_dashboard` | Get a Grafana dashboard by uid — by default a summary (panel titles, types and queries); set full\_json=true for the complete dashboard model (large). | `uid` (string, required), `full_json` (boolean) |
| `get_trace` | Get a full trace by id from a Tempo datasource in Grafana (spans, timings, attributes). | `trace_id` (string, required), `datasource_uid` (string) |
| `list_alert_rules` | List Grafana-managed alert rule definitions, with uid, title, folder and paused state. | — |
| `list_datasources` | List datasources configured in Grafana, with uid, name, type and default flag. | — |
| `query_loki` | Run a LogQL query on a Loki datasource in Grafana over a time range (RFC3339; defaults to the last hour), returning up to `limit` log lines or metric samples. | `query` (string, required), `end` (string), `limit` (integer), `start` (string), `datasource_uid` (string) |
| `query_prometheus` | Run a PromQL query on a Prometheus datasource in Grafana: instant query when no start is given, range query otherwise (RFC3339 timestamps; step e.g. '1m', '15s'). | `query` (string, required), `end` (string), `step` (string), `start` (string), `datasource_uid` (string) |
| `search_dashboards` | Search Grafana dashboards by title (empty query lists all), returning uid, title, folder and URL. | `limit` (integer), `query` (string) |
| `search_traces` | Search traces on a Tempo datasource in Grafana using a TraceQL query (e.g. '\{resource.service.name="api" && duration > 1s}') over a time range (RFC3339; defaults to the last hour). | `query` (string, required), `end` (string), `limit` (integer), `start` (string), `datasource_uid` (string) |

### Write tools

| Tool | Description | Parameters |
| :- | :- | :- |
| `create_annotation` | Create a Grafana annotation (e.g. a deploy or incident marker) — global by default, or attached to a dashboard/panel; time\_iso RFC3339 (defaults to now). | `text` (string, required), `tags` (array), `panel_id` (integer), `time_iso` (string), `dashboard_uid` (string) |
| `create_or_update_dashboard` | Create or update a Grafana dashboard from its JSON model (omit `id` and set `uid` to update an existing one); folder\_uid places it in a folder, message describes the change. | `dashboard` (object, required), `message` (string), `overwrite` (boolean), `folder_uid` (string) |

## Troubleshooting

* **Token expired or revoked**: If your service account token is deleted or expires, the MCP shows that it needs to reconnect. Generate a new token in Grafana and update the credentials from the MCP's page in Nekt.
* **Permission denied on writes**: If the agent fails to create annotations or update dashboards, verify that the Grafana service account has the Editor role. The Viewer role is only sufficient for reading data.

## Need help?

Contact our support team if you have trouble connecting Grafana.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.