mcp-grafana
MCP (Model Context Protocol) server for Grafana - TypeScript/npm implementation with 43+ tools for dashboards, alerts, incidents, and observability
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
- Install the MCP Grafana package globally
npm install -g @leval/mcp-grafana
- 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
dynatrace
MCP server for Dynatrace Observability
grafana -analyzer
让AI助手直接分析你的Grafana监控数据 - A Model Context Protocol server for Grafana data analysis
mcp -text-editor
An open source implementation of the Claude built-in text editor tool
autotask
MCP server for Kaseya Autotask PSA — 39 tools for companies, tickets, projects, time entries, and more
gmail
A robust Model Context Protocol server for Gmail integration with intelligent authentication and comprehensive email operations
ux
MCP server providing 28 UX knowledge resources, 23 analysis tools, and 4 workflow prompts. Complete UX ecosystem: WCAG, Nielsen heuristics, design systems, e-commerce, PWA, AI/ML, healthcare, finance & more.