Labsco
daanrongen logo

Grafana

from daanrongen

MCP server for Grafana โ€” manage dashboards, datasources, alerts, folders, and annotations over stdio

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

grafana-mcp

MCP server for Grafana โ€” manage dashboards, datasources, alert rules, folders, and annotations over stdio.

Tools (17 total)

DomainToolsCoverage
Dashboardslist_dashboards, get_dashboard, create_dashboard, update_dashboard, delete_dashboardFull dashboard lifecycle
Datasourceslist_datasources, get_datasource, create_datasource, delete_datasourceDatasource management
Alertslist_alert_rules, get_alert_rule, list_alert_instancesAlert rules and firing Alertmanager instances
Folderslist_folders, create_folder, delete_folderFolder organisation
Annotationslist_annotations, create_annotationDashboard and global annotations
Healthhealth_checkGrafana instance status

Development

bun install
bun run dev        # run with --watch
bun test           # run test suite
bun run typecheck  # type-check with tsc
bun run lint       # biome lint
bun run format     # biome format
bun run build      # bundle to dist/main.js

Inspecting locally

Use the MCP Inspector to browse and call tools interactively against a real Grafana instance:

GRAFANA_URL=http://localhost:3000 \
GRAFANA_API_KEY=your-service-account-token \
bun run inspect

This opens the MCP Inspector UI in the browser, pointed at the locally built server.

Architecture

src/
โ”œโ”€โ”€ config.ts                   # Effect Config โ€” GRAFANA_URL, GRAFANA_API_KEY
โ”œโ”€โ”€ main.ts                     # Entry point โ€” ManagedRuntime + StdioServerTransport
โ”œโ”€โ”€ domain/
โ”‚   โ”œโ”€โ”€ GrafanaClient.ts        # Context.Tag service interface (port)
โ”‚   โ”œโ”€โ”€ errors.ts               # GrafanaError, NotFoundError
โ”‚   โ”œโ”€โ”€ models.ts               # Schema.Class models (Dashboard, Datasource, AlertRule, โ€ฆ)
โ”‚   โ”œโ”€โ”€ dashboards.test.ts      # Domain tests using GrafanaClientTest
โ”‚   โ”œโ”€โ”€ datasources.test.ts     # Domain tests using GrafanaClientTest
โ”‚   โ””โ”€โ”€ health.test.ts          # Domain tests using GrafanaClientTest
โ”œโ”€โ”€ infra/
โ”‚   โ”œโ”€โ”€ GrafanaClientLive.ts    # Layer using fetch against the Grafana HTTP API
โ”‚   โ””โ”€โ”€ GrafanaClientTest.ts    # In-memory Ref-based test adapter
โ””โ”€โ”€ mcp/
    โ”œโ”€โ”€ server.ts               # McpServer wired to ManagedRuntime
    โ”œโ”€โ”€ utils.ts                # formatSuccess, formatError
    โ””โ”€โ”€ tools/                  # dashboards.ts, datasources.ts, alerts.ts, folders.ts, annotations.ts, health.ts