English | 中文
An MCP (Model Context Protocol) server that extracts professional monitoring metrics from existing Grafana Dashboards and queries real-time data via Prometheus to assist AI in monitoring analysis and troubleshooting.
Key Features:
- Extracts key metrics from large JSON files (20000+ lines), saving AI context and focusing on important indicators
- Supports both instant and range queries for Prometheus, meeting different monitoring needs
- Supports Dashboard variable parsing for dynamic metric and option retrieval
- Python: 3.10+ (MCP SDK minimum requirement)
⚠️ Note: MCP Python SDK requires Python 3.10 or higher
./setup.shThis script will automatically:
- Detect available Python 3.10+ version
- Create virtual environment
- Install all dependencies
- Run basic tests
python3 --version
# Ensure version >= 3.10If version is too low, install Python 3.10+:
- macOS:
brew install python@3.10orbrew install python@3.11 - Linux: Use system package manager
- Windows: Download from python.org
# Create virtual environment with Python 3.10+
python -m venv venv
# Activate virtual environment
# macOS/Linux:
source venv/bin/activate
# Windows:
# venv\Scripts\activate# Upgrade pip (recommended)
pip install --upgrade pip
# Install project dependencies
pip install -r requirements.txtExport dashboard JSON files from Grafana and place them in the dashboard/ directory. Multiple dashboard files are supported.
⚠️ Note: A professional Grafana dashboard metadata is crucial for AI analysis.
How to export:
- Open your Grafana dashboard
- Click the gear icon (Settings) in the top right
- Select "JSON Model"
- Copy the content and save as
your-service-dashboard.json
Copy the example config file and edit:
cp config.yaml.example config.yamlThen edit config.yaml with your Prometheus server info and dashboard list:
prometheus:
url: "http://your-prometheus-url:9090"
username: "your_username" # Optional, if authentication required
password: "your_password" # Optional, if authentication required
timeout: 30
dashboards:
- name: "pulsar-dashboard"
path: "./dashboard/pulsar-dashboard.json"Relative paths: If
dashboards[].pathis relative (e.g../dashboard/xxx.json), it is resolved relative to the directory containing the config file, not the project root or current working directory. For example, ifconfig.yamlis at/opt/dash2insight/config.yaml, then./dashboard/foo.jsonresolves to/opt/dash2insight/dashboard/foo.json.
⚠️ Note:config.yamlcontains sensitive information and is ignored by.gitignore.
Specify a custom config file: You can use a config file outside the project root by:
- Command line:
python -m src.server -c /path/to/config.yamlor./scripts/run_server.sh --config /path/to/config.yaml - Environment variable: Set
DASH2INSIGHT_CONFIG=/path/to/config.yaml(useful when the MCP client does not pass args)
Configure the MCP Server in AI clients like Cursor or Claude Desktop, pointing to the server.py script.
Using Cursor as an example:
- Open Cursor Settings
- Find "MCP Servers" configuration
- Add server configuration
Option 1: Using Virtual Environment Python
{
"mcpServers": {
"Dash2Insight-MCP": {
"command": "/path/to/Dash2Insight-MCP/venv/bin/python",
"args": ["/path/to/Dash2Insight-MCP/src/server.py"],
"cwd": "/path/to/Dash2Insight-MCP"
}
}
}Use absolute paths to avoid environment variable issues.
To use a config file outside the project root, add"-c", "/path/to/your/config.yaml"toargs.
⚠️ Option 1 requires settingcwdto the project root, otherwise you'll get:ModuleNotFoundError: No module named 'src'.
Option 2: Using Startup Script
The script automatically switches to the project root, no need to set cwd in MCP config:
{
"mcpServers": {
"Dash2Insight-MCP": {
"command": "/path/to/Dash2Insight-MCP/scripts/run_server.sh"
}
}
}- Restart Cursor
After configuration, restart Cursor to activate the MCP server. AI can then use prometheus_query, prometheus_range_query tools, and access dashboard variables and metrics resources.
Success screenshot:

- Generate a traffic report for the Pulsar cluster and save it as a markdown document.
- Cluster XXX experienced a failure at XXX time, help me analyze the cause and provide troubleshooting steps.
- Analyze the load of cluster XXX and provide optimization suggestions.
Apache-2.0