How to integrate Grafana MCP with Codex

Connect Codex to Grafana MCP. Summarize grafana alerts from production, list dashboards showing api latency, and more using natural language, with authentication handled for you.

Grafana logoGrafana
Bearer Token

Grafana is an open and composable observability platform for metrics, logs, traces, dashboards, and alerts. It helps teams monitor systems, troubleshoot incidents, and understand production health in one place.

20 Tools

Introduction

Codex is one of the most popular coding harnesses out there. And MCP makes the experience even better. With the Grafana MCP integration, Codex can push OTLP logs, query public dashboard panels, check health and license status, and inspect cluster ring status, all without leaving the terminal or the app, whichever you prefer.

For exact tool slugs and parameter tables, see the tool catalog in the Composio docs.

Also integrate Grafana with

Why use Composio?

Apart from a managed and hosted MCP server, you will get:

  • CodeAct: A dedicated workbench that allows GPT to write its code to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool responses: Handle them to minimise context rot.
  • Dynamic just-in-time access to 20,000 tools across 2000+ other Apps for cross-app workflows. It loads the tools you need, so GPTs aren't overwhelmed by tools you don't need.

How to install Grafana MCP in Codex

Run the setup command

Run this command in your terminal to add the Composio MCP server to Codex.

Terminal

It will initiate the authentication in a browser window, authorize Codex to access your Composio account.

Composio authentication page

(Optional) Authenticate with OAuth

To authenticate manually, run the login command to open a browser window and authorize Codex to access your Composio account.

bash
codex mcp login composio

Verify the connection

Run codex mcp list to confirm Composio appears as a registered MCP server.

bash
codex mcp list

Codex App

Codex App follows the same approach as VS Code.

  1. Click ⚙️ on the bottom left → MCP Servers → + Add servers → Streamable HTTP:
  2. Fill the header and Key fields with { "x-consumer-api-key" = "ck_*******" }.
  3. The Key is the Composio API key, that you can find on dashboard.composio.dev
  4. Click on Authenticate and authorize Codex to your Composio account and you're all set.
Codex App MCP setup
  1. Restart and verify if it's there in .codex/config.toml
bash
[mcp_servers.composio]
url = "https://connect.composio.dev/mcp"
http_headers = { "x-consumer-api-key" = "ck_*******" }

Try it

Ask Codex for a Grafana task. The first time, Composio asks you to connect your Grafana account.

For example, ask it to:

  • "Summarize Grafana alerts from production"
  • "List dashboards showing API latency"
  • "Query error logs for checkout"

What is the Grafana MCP server, and what's possible with it?

The Grafana MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Grafana account. It provides structured and secure access to server health, public dashboard metrics, monitoring component status, license details, and token verification keys, so your agent can check system health, query dashboard panels, inspect monitoring rings, confirm Enterprise licensing, and retrieve public keys on your behalf.

  • Grafana health checks: Have your agent check whether your Grafana server is healthy and connected to its database.
  • Public dashboard queries: Instruct your agent to query panels on public Grafana dashboards and retrieve time-series data and metrics.
  • Loki gateway monitoring: Let the agent inspect the Grafana Loki index gateway ring to help assess its current status.
  • Mimir ruler monitoring: Direct your agent to check the Grafana Mimir ruler ring and report its status.
  • License and verification details: Have your agent confirm whether a valid Grafana Enterprise license is available or retrieve public keys needed for token verification.

Conclusion

You've successfully integrated Grafana with Codex using Composio's MCP server. Now you can interact with Grafana directly from your terminal, VS Code, or the Codex App using natural language commands.

Key benefits of this setup:

  • Seamless integration across CLI, VS Code, and standalone app
  • Natural language commands for Grafana operations
  • Managed authentication through Composio
  • Access to 20,000+ tools across 2000+ apps for cross-app workflows
  • CodeAct workbench for complex tool chaining

Next steps:

  • Try asking Codex to perform various Grafana operations
  • Explore cross-app workflows by connecting more toolkits
  • Build automation scripts that leverage Codex's AI capabilities
TOOLS

Supported Tools

Every Grafana action and event your agent gets out of the box.

Create OTLP v1 Logs

Tool to create OTLP v1 logs in Grafana Loki.

Evaluate Alerting Expressions

Evaluate Grafana datasource queries and expressions without saving a rule.

Get Dashboard by UID

Retrieve an authenticated Grafana dashboard and its metadata by UID.

Get Distributor HA Tracker

Tool to retrieve distributor HA tracker status.

Get Grafana Health Status

Check Grafana server health and database connectivity.

Get Index Gateway Ring Status

Tool to retrieve the index gateway hash ring status from Grafana Loki.

Get overrides exporter ring

Tool to retrieve the overrides-exporter hash ring status as an HTML page.

Get Provisioned Alert Rule

Retrieve a Grafana-managed provisioned alert rule by UID.

Get Ruler Ring Status

Tool to retrieve the ruler ring status from Grafana Mimir.

Get License Status

Tool to check if a valid Grafana Enterprise license is available.

Get Store Gateway Tenants

Retrieves the store-gateway tenants page listing tenants with blocks in the store-gateway's configured storage.

List Alert Silences

List Grafana Alertmanager silences, optionally filtered by matchers.

List Provisioned Alert Rules

List all provisioned Grafana-managed alert rules.

Post ACS

Tool to perform SAML Assertion Consumer Service (ACS) operation.

Query Grafana Datasource

Execute one or more backend datasource queries for a Grafana time range.

Query Loki at an Instant

Run a metric LogQL query at one evaluation time through Grafana.

Query Loki Logs Over a Range

Run a LogQL query over a time range through Grafana.

Query Public Dashboard Panel

Query a panel on a public Grafana dashboard to retrieve time-series data and metrics.

Retrieve JWKS

Tool to retrieve JSON Web Key Set (JWKS) with all public keys for token verification.

Update Provisioned Alert Rule

Fully replace a Grafana-managed provisioned alert rule by UID (PUT, not a partial update).

FRAMEWORKS

How to build Grafana MCP Agent with another framework

FAQ

Frequently asked questions

Start with Grafana.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Grafana tool your agent needs.Free to start.

Start building