home / mcp / grafana mcp analyzer server

Grafana MCP Analyzer Server

让AI助手直接分析你的Grafana监控数据 - A Model Context Protocol server for Grafana data analysis

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "sailingcoder-grafana-mcp-analyzer": {
      "command": "grafana-mcp-analyzer",
      "args": [],
      "env": {
        "CONFIG_PATH": "https://raw.githubusercontent.com/SailingCoder/grafana-mcp-analyzer/main/config/grafana-config-play.js",
        "MAX_CHUNK_SIZE": "100"
      }
    }
  }
}

You will install and run a Grafana MCP Analysis server that lets you converse with your Grafana monitoring data. It connects to your Grafana data sources, accepts natural language queries, and returns actionable insights, enabling you to move from charts to concrete improvements in operations and DevOps practices.

How to use

Install and run the MCP server locally, then connect it to your Grafana workspace. Use an MCP client to open a conversation with the AI helper. You can ask questions like the overall health of your Grafana dashboards, request in-depth analyses of CPU or memory trends, or combine data from multiple sources such as Prometheus, MySQL, or Elasticsearch. The AI will cache conversation context, progressively fetch data, and reuse results to provide accurate, context-aware insights across rounds of dialogue.

You will typically perform these practical tasks: set up the MCP server, configure the MCP client to point to your server, run queries to fetch data from Grafana panels, and ask the AI to generate operational recommendations, dashboards, or optimization steps based on the data. Use multi-step prompts to guide the AI: start with a broad data health check, then drill into specific panels or time ranges, and finally request actionable optimization guidance.

How to install

Prerequisites: ensure you have Node.js 18 or later installed on your machine.

Step 1: Install the MCP analyzer globally

npm install -g grafana-mcp-analyzer

Step 2: Configure the MCP server in your client or orchestration environment. You will reference a configuration that points to the MCP analyzer and sets a data chunk limit.

{
  "mcpServers": {
    "grafana": {
      "command": "grafana-mcp-analyzer",
      "env": {
        "CONFIG_PATH": "https://raw.githubusercontent.com/SailingCoder/grafana-mcp-analyzer/main/config/grafana-config-play.js",
        "MAX_CHUNK_SIZE": "100"
      },
      "args": []
    }
  }
}

Additional setup and usage notes

You can run the analyzer with a remote configuration file to quickly start a sample experience. If you want to connect to your own Grafana instance, create a local or remote configuration that defines your Grafana server address, authentication headers, and the specific queries you want the AI to run.

Restart the MCP client after changing the configuration to ensure the new settings take effect. If you encounter issues, review common troubleshooting steps such as verifying the Grafana URL, checking API keys, and testing network connectivity.

Configuration overview

The configuration allows you to specify the Grafana server address, default request headers, health check endpoints, query definitions, and any necessary HTTP or curl style data fetch patterns. You can tune the maximum chunk size for data sent to the AI to balance accuracy and performance.

Available tools

analyze_query

Query data and provide an initial AI-assisted analysis for a requested dataset

analyze_existing_data

Analyze data based on existing cached results for deeper multi-turn conversations

chunk_workflow

Automatically chunk large data sets for scalable processing by the AI

manage_cache

Inspect, clear, and optimize the caching layer used by the MCP server

list_queries

List available data queries and their definitions for quick selection

check_health

Perform health checks on the connected Grafana data sources and endpoints

list_data

Show historical data that has been stored and is available for analysis

server_status

Provide current status and health of the MCP server itself