# mcp-grafana: An MCP Server for Seamless Grafana Integration

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/grafana-mcp-grafana
Generated for open source discovery and AI-assisted research.

mcp-grafana is a Model Context Protocol (MCP) server designed to provide comprehensive access to your Grafana instance and its surrounding ecosystem. It enables powerful programmatic interaction with Grafana dashboards, datasources, alerting, and more, facilitating advanced automation and integration with AI assistants.

GitHub: https://github.com/grafana/mcp-grafana
OSRepos URL: https://osrepos.com/repo/grafana-mcp-grafana

## Summary

mcp-grafana is a Model Context Protocol (MCP) server designed to provide comprehensive access to your Grafana instance and its surrounding ecosystem. It enables powerful programmatic interaction with Grafana dashboards, datasources, alerting, and more, facilitating advanced automation and integration with AI assistants.

## Topics

- Go
- Grafana
- Observability
- Monitoring
- AI Integration
- DevOps
- Automation
- Model Context Protocol

## Repository Information

Last analyzed by OSRepos: Tue Jun 02 2026 09:29:02 GMT+0100 (Western European Summer Time)
Detail views: 3
GitHub clicks: 14

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

The `mcp-grafana` repository hosts a Model Context Protocol (MCP) server specifically built for Grafana. This server acts as a bridge, providing extensive programmatic access to your Grafana instance and its entire ecosystem. It empowers developers and AI assistants to interact with Grafana's core functionalities, including dashboards, datasources, alerting, incidents, and more, enabling advanced automation, intelligent querying, and dynamic reporting.

With `mcp-grafana`, you can seamlessly integrate Grafana's rich observability data and management capabilities into external applications, scripts, or AI-driven workflows, enhancing operational efficiency and data-driven decision-making.

## Installation

Getting started with `mcp-grafana` is straightforward, with several installation options available. The recommended method uses `uvx` for ease of deployment.

### Quick Start with uvx

If you have [uv](https://docs.astral.sh/uv/getting-started/installation/){:target="_blank"} installed, `uvx` can automatically download and run the server:


{
  "mcpServers": {
    "grafana": {
      "command": "uvx",
      "args": ["mcp-grafana"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>"
      }
    }
  }
}


For Grafana Cloud, replace `GRAFANA_URL` with your instance URL, for example, `https://myinstance.grafana.net`. Ensure your Grafana service account has the necessary [permissions](https://grafana.com/docs/grafana/latest/administration/service-accounts/#add-a-token-to-a-service-account-in-grafana){:target="_blank"}.

### Other Installation Methods

*   **Docker Image**: Use the pre-built Docker image from Docker Hub. For STDIO mode, which is common for AI assistant integration, explicitly override the default SSE mode:
    bash
docker run --rm -i -e GRAFANA_URL=http://localhost:3000 -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> grafana/mcp-grafana -t stdio
    
*   **Binary Download**: Download the latest release from the [releases page](https://github.com/grafana/mcp-grafana/releases){:target="_blank"} and add it to your `$PATH`.
*   **Helm Chart**: Deploy to Kubernetes using the [Helm chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana-mcp){:target="_blank"} from the Grafana helm-charts repository.

## Examples

`mcp-grafana` exposes a rich set of tools to interact with your Grafana instance. Here are some common use cases:

*   **Dashboard Management**: Search for dashboards, retrieve compact summaries, extract specific properties using JSONPath, or even update and create new dashboards. Tools like `get_dashboard_summary` and `get_dashboard_property` are crucial for efficient context window management when working with large dashboards.
*   **Data Source Querying**: Execute queries against various data sources like Prometheus, Loki, InfluxDB, ClickHouse, CloudWatch, Athena, Snowflake, and Elasticsearch/OpenSearch. This includes querying metrics, logs, metadata, and even log patterns.
*   **Alerting and Incidents**: List and manage alert rules, view notification policies, and interact with Grafana Incident to search, create, and update incidents.
*   **OnCall Management**: Integrate with Grafana OnCall to list schedules, get shift details, and identify current on-call users.
*   **Navigation and Rendering**: Generate accurate deep links to Grafana dashboards, panels, and Explore views. You can also render dashboard panels or entire dashboards as PNG images, useful for reports or automated alerts. This requires the [Grafana Image Renderer](https://grafana.com/docs/grafana/latest/setup-grafana/image-rendering/){:target="_blank"} service.
*   **Admin Tasks**: List teams, users, roles, and permissions within your Grafana organization.

Many advanced data source and administrative tools are disabled by default and can be enabled via CLI flags like `--enabled-tools`.

## Why use mcp-grafana?

`mcp-grafana` offers significant advantages for anyone looking to extend Grafana's capabilities programmatically:

*   **Comprehensive Grafana Access**: Provides a unified interface to almost every aspect of Grafana, from data querying to administrative tasks.
*   **AI/LLM Integration Ready**: Designed with the Model Context Protocol, making it ideal for integration with AI assistants and large language models for intelligent observability.
*   **Flexible Deployment**: Supports multiple deployment strategies, including `uvx`, Docker, direct binary, and Helm, fitting various operational environments.
*   **Granular Control**: Offers extensive configuration options, including tool enablement/disablement and fine-grained RBAC permissions, allowing you to tailor access and functionality to your specific needs.
*   **Observability Built-in**: Includes Prometheus metrics, OpenTelemetry tracing, and structured log export, ensuring that the server itself is observable and easy to monitor.
*   **Read-Only Mode**: A dedicated `--disable-write` flag provides a secure read-only mode, perfect for AI assistants or environments where data modification should be restricted.

## Links

*   **GitHub Repository**: [grafana/mcp-grafana](https://github.com/grafana/mcp-grafana){:target="_blank"}
*   **Model Context Protocol**: [modelcontextprotocol.io](https://modelcontextprotocol.io/){:target="_blank"}
*   **Grafana Service Accounts**: [Documentation](https://grafana.com/docs/grafana/latest/administration/service-accounts/#add-a-token-to-a-service-account-in-grafana){:target="_blank"}
*   **Grafana Image Renderer**: [Documentation](https://grafana.com/docs/grafana/latest/setup-grafana/image-rendering/){:target="_blank"}
*   **Grafana RBAC**: [Documentation](https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/access-control/){:target="_blank"}
*   **uv Installation**: [Documentation](https://docs.astral.sh/uv/getting-started/installation/){:target="_blank"}