KosmoKrator

analytics

Grafana MCP Integration for OpenAI Agents SDK

Connect Grafana to OpenAI Agents SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

7 functions 6 read 1 write API token auth

Connect Grafana to OpenAI Agents SDK

Attach KosmoKrator integration tools to OpenAI Agents SDK workflows through a local MCP gateway.

Start the KosmoKrator MCP gateway locally and point the OpenAI Agents SDK MCP tool at that process or wrapper. The gateway is local, scoped to this integration, and starts with --write=deny so OpenAI Agents can inspect read-capable tools without receiving write access by default.

Grafana MCP Config for OpenAI Agents SDK

Use headless JSON commands for CI-style execution and MCP for agent tool discovery.

{
  "mcpServers": {
    "kosmokrator-grafana": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=grafana",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=grafana --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Grafana instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Grafana Tools Visible to OpenAI Agents

OpenAI Agents sees stable MCP tool names generated from the Grafana integration catalog.

MCP toolSource functionTypeDescription
integration__grafana__grafana_list_dashboards grafana.grafana_list_dashboards Read Search and list Grafana dashboards. Returns dashboard UIDs, titles, and folder info. Use query to filter by title.
integration__grafana__grafana_get_dashboard grafana.grafana_get_dashboard Read Get a Grafana dashboard by its UID. Returns the full dashboard definition including panels, queries, and settings.
integration__grafana__grafana_create_dashboard grafana.grafana_create_dashboard Write Create or update a Grafana dashboard. Provide the full dashboard JSON with panels, queries, and settings. Set overwrite to true to update an existing dashboard.
integration__grafana__grafana_list_datasources grafana.grafana_list_datasources Read List all configured datasources in Grafana. Returns datasource IDs, names, types (e.g., Prometheus, InfluxDB), and access info.
integration__grafana__grafana_list_alerts grafana.grafana_list_alerts Read List Grafana alerts. Optionally filter by dashboard ID or panel ID. Returns alert states, thresholds, and conditions.
integration__grafana__grafana_list_teams grafana.grafana_list_teams Read List all Grafana teams. Returns team IDs, names, emails, and member counts with pagination support.
integration__grafana__grafana_get_current_user grafana.grafana_get_current_user Read Get the currently authenticated Grafana user. Useful for verifying credentials and identifying the connected account.

Related Grafana Pages