Get the FREE Ultimate OpenClaw Setup Guide →

mcp-grafana

MCP (Model Context Protocol) server for Grafana - TypeScript/npm implementation with 43+ tools for dashboards, alerts, incidents, and observability

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio 0xteamhq-mcp-grafana npx @leval/mcp-grafana \
  --env DEBUG="true" \
  --env GRAFANA_URL="https://your-grafana-instance.com" \
  --env GRAFANA_SERVICE_ACCOUNT_TOKEN="glsa_xxxxxxxxxxxx"

How to use

This MCP server implements the Grafana MCP integration, enabling an AI assistant to interact with Grafana resources such as dashboards, datasources, alerts, incidents, and more through MCP-enabled clients. Once running, you can talk to the assistant to search dashboards, fetch complete dashboard JSON, list datasources, query Prometheus-backed metrics, read Loki logs, and manage dashboards and configurations via the 43 available tools described in the documentation. The server is designed for multiple MCP clients (e.g., Claude Desktop, Claude Code, Cursor, Zed, Codex) and is built with TypeScript for reliability, with full authentication support including service accounts and API keys.

To use it, start the MCP server (via npx or a local install) so that your MCP client can connect. Then invoke commands through your chosen client to access Grafana resources using the provided tools. For example, you can ask to list all dashboards, fetch a dashboard by UID, or run PromQL queries against your Grafana-connected Prometheus datasource. The tools cover dashboards, datasources, Prometheus, Loki logs, and more, enabling integrated, context-aware Grafana operations within your AI workflow.

How to install

Prerequisites:

  • Node.js (LTS) and npm/yarn installed
  • Access to a Grafana instance with a valid token or credentials

Option A: Global installation

  1. Install the MCP Grafana package globally
npm install -g @leval/mcp-grafana
  1. Run the MCP Grafana server
npx @leval/mcp-grafana

Option B: Run with npx without installation (recommended)

npx @leval/mcp-grafana

Option C: Local development (from source)

git clone https://github.com/levalhq/mcp-grafana.git
cd mcp-grafana
npm install
npm run build
npm start

Prerequisites are the same across options: ensure you have network access to Grafana and proper credentials (URL and token or username/password) configured via environment variables as described in the environment section.

Additional notes

Environment variables:

  • GRAFANA_URL: Grafana instance URL (required)
  • GRAFANA_SERVICE_ACCOUNT_TOKEN or GRAFANA_USERNAME / GRAFANA_PASSWORD: authentication method (one of these)
  • Optional: DEBUG to enable verbose logging
  • TLS_CERT_FILE, TLS_KEY_FILE, TLS_CA_FILE, TLS_SKIP_VERIFY: TLS/mTLS related settings if needed

Common issues:

  • Ensure the Grafana URL is reachable and the credentials have sufficient permissions
  • If using token-based authentication, confirm the token has Grafana API access
  • When using npx, ensure you have an internet connection; local builds require npm install

Configuration tips:

  • The mcpServers block can be customized per environment; exposure to different MCP clients can be tuned by adjusting env vars per client setup
  • Use the provided sample env values as placeholders and replace with your actual Grafana details before running in production

Related MCP Servers

Sponsor this space

Reach thousands of developers