## Grafana integration

Grafana can be connected to Agen.co two ways, matching the **Official** / **In-house** filter in the connector picker:

- **Official** — Agen.co connects through Grafana Cloud's own hosted MCP server (`https://mcp.grafana.com/mcp`), authenticated via OAuth 2.1, so your AI agents use the same dashboard, data source, alerting, and incident tools Grafana exposes to MCP clients like Claude Desktop and Cursor.
- **In-house** — Agen.co wraps the Grafana REST API directly through its own integration layer, using a Grafana service account token you generate for your specific instance.


Pick **Official** if the built-in MCP tools cover what your agents need and your instance runs on Grafana Cloud. Fall back to **In-house** if you self-host Grafana, since the Official flow only supports Grafana Cloud.

### Connect via the official MCP server

Prerequisites
- A [Grafana Cloud](https://grafana.com/auth/sign-in) account or organization


#### Connect Grafana in Agen.co

1. In the Agen.co portal, go to **Connectors** → **My connectors** and click **Add connector**.
2. In the search bar, type `Grafana` and select it from the results.
3. Optionally fill in **Instance Slug** — distinguishes multiple instances of this MCP connector by prefixing each imported tool as `slug__tool`. Use lowercase kebab-case; leave empty for a single instance. This value is immutable after creation.
4. Click **Connect**.
5. On the page that opens, enter your **Grafana instance URL** and click **Continue**.


Sign in and approve access. No service account token or other credentials need to be entered manually. Access is scoped to your Grafana RBAC permissions — the connected agent can only do what your Grafana user is allowed to do.

Once connected, Grafana appears under **My connectors** with tools spanning:

| Area | What it covers |
|  --- | --- |
| **Search & dashboards** | Locating dashboards by title/metadata, retrieving dashboard details, and applying targeted patches |
| **Data sources** | Listing configured data sources and their details |
| **Query engines** | Prometheus (PromQL), Loki (LogQL), InfluxDB, ClickHouse, CloudWatch, Elasticsearch/OpenSearch, Snowflake, Graphite, and Athena |
| **Alerting** | Managing alert rules, routing policies, and contact points |
| **Incidents & OnCall** | Searching/creating/updating Grafana Incidents; managing OnCall schedules, shifts, teams, and alert groups |
| **Sift** | Retrieving investigations and detecting error patterns or slow requests |
| **Annotations & rendering** | Querying/creating dashboard annotations; exporting dashboards and panels as images |
| **Navigation & admin** | Generating deeplink URLs; managing teams, users, roles, and permissions |


Enabling the Grafana connector isn't enough on its own. Tool calls remain denied until you create a [policy](/agen-for-work/policies/overview) that grants access to the specific tools you want to expose.

### Connect via the Grafana API

Grafana is an open-source observability platform for visualizing metrics, logs, and traces. Integrating Grafana with Frontegg allows your application to access dashboards, data sources, alerts, and annotations on behalf of your users using a Grafana service account token.

Prerequisites
- A [Grafana Cloud account](https://grafana.com/auth/sign-in)
- Admin access to your Grafana instance


#### Connect Grafana

##### Step 1: Open the Administration panel

Log in to your Grafana instance and click **Administration** in the left sidebar to expand the administration menu.

![Grafana Administration panel](/assets/grafana-1.77ba996a6262e59376a4fbb097709f25932202b6fb73e8066264336b4c39366f.1ce25488.png)

##### Step 2: Open the Service accounts page

In the Administration menu, click **Users and access**, then click **Service accounts**. The Service accounts page lists all existing service accounts for your instance.

![Grafana Service accounts page](/assets/grafana-2.07c22bf0ed9519b8177df7b64b7d3fc8390dfcb53ae81893f473a72a13d1b979.1ce25488.png)

##### Step 3: Create a new service account

Click **Add service account**. On the form that appears, enter a descriptive name in the **Display name** field (for example, `Frontegg Integration`), then click **Create**.

![Grafana create service account form](/assets/grafana-3.5e2211ee3041739f2c28199dd1e76504a55882723dd3430e2b1994405181ffb8.1ce25488.png)

##### Step 4: Add a service account token

After the service account is created, you are taken to the service account detail page. Click **Add service account token** to create an API token for this service account.

![Grafana service account detail page](/assets/grafana-4.423e928c8c1bbeb452d5e5f6614c73f5fbf2e2df91514281f4435c8fd242e00a.1ce25488.png)

##### Step 5: Generate the token

In the dialog that appears, enter a name for the token (for example, `Frontegg Integration`) and choose an expiration option. Select **No expiration** to create a permanent token, or **Set expiration date** to define a specific validity period. Click **Generate token**.

![Grafana generate token dialog](/assets/grafana-5.23621a42b985f7736638e61dfce185dfc216549f29211803b04f0117e3019e2f.1ce25488.png)

##### Step 6: Copy your token

A dialog displays the generated token value. Copy the token and store it in a safe place.

Copy your token now
This is the only time Grafana will display the token value. If you lose it, you will need to delete the token and create a new one.

![Grafana token created dialog](/assets/grafana-6.4246f54950ca615af061ccc209e37a11de3901a7aeed93b1cbee490cfe391e6f.1ce25488.png)

#### Configure the Frontegg portal

Once you have obtained your Grafana service account token from the steps above, enter it in the integration configuration page of the Frontegg portal:

1. Open the **Frontegg portal** and navigate to [ENVIRONMENT] → Integrations → Grafana.
2. Enter the service account token in the **API Key** field.
3. Enter your Grafana instance URL in the **Grafana instance URL** field. Use the root URL of your Grafana stack — for example, `https://mycompany.grafana.net` for Grafana Cloud or `https://grafana.your-company.com` for a self-hosted instance. Do not include a trailing slash or an `/api` suffix.
4. Click **Save**.


Keep your token secure
Never share or commit your service account token to version control.

### Additional resources

- [Grafana Cloud MCP server](https://grafana.com/docs/grafana-cloud/machine-learning/assistant/configure/cloud-mcp/)
- [Open source Grafana MCP server](https://grafana.com/docs/grafana/latest/developer-resources/mcp/)
- [grafana/mcp-grafana on GitHub](https://github.com/grafana/mcp-grafana)
- [Grafana service accounts documentation](https://grafana.com/docs/grafana/latest/administration/service-accounts/)
- [Grafana REST API documentation](https://grafana.com/docs/grafana/latest/developers/http_api/)
- [How to get your Redirect URL](/agen-for-work/connectors/redirect-url)