Enables direct use of curl commands copied from browsers to formulate and execute Grafana queries, simplifying the process of accessing and analyzing monitoring data.
Enables analysis of Dogecoin market data from Grafana dashboards, providing cryptocurrency price trends, technical analysis, and trading insights based on OHLC (Open, High, Low, Close) data.
Provides tools for accessing and analyzing Grafana monitoring data through natural language queries, supporting comprehensive dashboard analysis, visualization of metrics, and AI-powered interpretation of performance data across multiple data sources including Prometheus, MySQL and Elasticsearch.
Facilitates access to MySQL data through Grafana dashboards, allowing natural language querying and AI analysis of database metrics and performance indicators.
Supports querying and analyzing Prometheus metrics through Grafana, enabling AI-powered interpretation of time-series data for system performance monitoring and anomaly detection.
Grafana MCP Analyzer 🤖
让AI直接读懂你的监控数据,智能化运维分析助手
✨ 项目简介
想象一下这样的场景:
您问AI:"我的服务器现在怎么样?"
AI直接查看您的Grafana监控,回答:"CPU使用率偏高,建议检查这几个进程..."
复杂的监控图表,AI帮您一键分析!告别传统的手动监控方式,让AI成为您的专属运维助手!
🚀 核心特性
Grafana MCP Analyzer 基于 MCP (Model Context Protocol) 协议,赋能Claude、ChatGPT等AI助手具备以下超能力:
自然语言查询 - 轻松访问监控数据,AI 一键输出专业分析
智能格式化 - 支持大数据量分析,高效解析各类数据
curl支持 - 直接使用浏览器 copy 的 curl 合成查询
聚合分析 - 单个查询或 Dashboard 级别综合分析
异常检测 - AI 主动报告性能问题,提前警报
全数据源支持 - Prometheus、MySQL、ES 等通通支持
专业 DevOps 建议 - 不只是展示数据,更提供可执行的优化方案,提升DevOps效率
🛠️ 快速开始
第一步:安装
环境要求:Node.js 18+ | 安装指南
第二步:配置AI助手(以Cursor为例)
注:CONFIG_PATH
支持绝对路径、远程路径,推荐使用远程路径快速体验。
第三步:编写配置文件
如果你需要连接自己的数据,请在 CONFIG_PATH
路径下创建一个名为 grafana-config-play.js
的配置文件。
如果你只想快速体验示例,可跳过此步骤,直接执行第四步。
第四步:开始使用!
完全重启Cursor,然后体验智能分析:
👤 您:分析overall_cpu_utilization100数据
🤖 AI:正在连接Grafana并分析...
👤 您:聚合分析dogecoin_panel_2、dogecoin_panel_7的数据
🤖 AI:同时查询多个指标并进行综合关联分析...
配置完成!
MCP工具清单
工具 | 功能 | 使用场景 |
| 查询+AI分析 | 需要专业建议 |
| 聚合分析 | 多查询统一分析 |
| 查询列表 | 查看配置 |
| 健康检查 | 状态监控 |
| 会话管理 | 管理分析会话 |
| 数据列表 | 查看存储数据 |
| 服务器状态 | 服务器信息 |
工具使用方式
高级配置
以下内容适用于需要自定义数据源或进行更高级使用场景的用户。
方式一:HTTP API(如 dogecoin_panel_7
)
获取 Data 传参:进入图表 → "Query Inspector" → "JSON"解析 → 拷贝请求体(request)
获取 Url 和 Headers Token:通过 Network 面板查看请求参数,手动构造 HTTP 配置。
方式二:curl(推荐,适用于所有面板,如overall_cpu_utilization100
):
在Grafana中执行查询
按F12打开开发者工具 → Network标签页
找到查询请求 → 右键点击 → Copy as cURL
将复制的 curl 粘贴至配置文件中即可
环境变量名 | 类型 | 默认值 | 说明 |
| string | 必填 | 配置文件路径(本地或 HTTPS 远程地址) |
| number |
| 单块最大数据体积(KB),影响切片性能 |
| number |
| 会话过期时间(小时) |
| number |
| 远程配置文件缓存时间(秒),设为
则禁用 |
缓存特性:
智能缓存配置文件(默认缓存 5 分钟)
网络失败时使用本地过期缓存
启动自动清理缓存文件
设置 CONFIG_MAX_AGE=0 可禁用缓存,每次请求都拉取最新配置
1. 远程路径
支持通过HTTPS URL访问远程配置文件,适用于团队协作和多环境部署:
支持的远程存储:
GitHub Raw:
https://raw.githubusercontent.com/SailingCoder/grafana-mcp-analyzer/main/config/grafana-config-play.js
阿里云OSS:
https://bucket.oss-cn-hangzhou.aliyuncs.com/config.js
腾讯云COS:
https://bucket-123.cos.ap-shanghai.myqcloud.com/config.js
AWS S3:
https://bucket.s3.amazonaws.com/config.js
注意:
❌ 不支持 GitHub 网页路径,如 https://github.com/SailingCoder/grafana-mcp-analyzer/blob/main/config/grafana-config-play.js, 返回的是 HTML 页面
✅ 必须使用 GitHub Raw 格式获取原始 JS 文件,如 https://raw.githubusercontent.com/SailingCoder/grafana-mcp-analyzer/main/config/grafana-config-play.js
2. 本地路径
支持传入本地绝对路径,适用于快速测试分析:
如需调用受保护的 Grafana API,可通过以下方式设置:
你也可以在配置文件中使用 Headers 方式直接注入 token 访问。
配置示例
业务场景配置
用户问题:"我的电商转化率怎么样?如何提升销售额?"
用户问题:"我的用户活跃度怎么样?如何提高用户留存?"
系统监控配置
用户问题:"我的服务器性能怎么样?需要扩容吗?"
用户问题:"我的应用有错误吗?影响用户体验吗?"
聚合分析配置
用户问题:"我的系统整体性能怎么样?哪里是瓶颈?"
使用方式:
👤 您:聚合分析全链路性能:frontend_performance, backend_performance, database_performance
🤖 AI:综合分析前端、后端、数据库性能,提供完整的性能优化建议
常见问题
检查Grafana地址格式:必须包含
https://
或http://
验证API密钥有效性:确保未过期且有足够权限
测试网络连通性和防火墙设置
完全退出Cursor并重新启动
检查配置文件路径是否正确
确保Node.js版本 ≥ 18
增加timeout设置
检查数据源连接状态
数据量过大时,缩小时间范围
文章推荐
grafana-mcp-analyzer:基于 MCP 的轻量 AI 分析监控图表的运维神器! - CSDN技术博客深度解析
许可证
MIT 开源协议。详见 LICENSE 文件。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server for Grafana data analysis
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that connects to Google Cloud services, allowing users to query logs, interact with Spanner databases, and analyze Cloud Monitoring metrics through natural language interaction.Last updated -403356Apache 2.0
- -securityAlicense-qualityA Model Context Protocol server that enables efficient discovery and retrieval of NASA Earth Data for geospatial analysis.Last updated -21BSD 3-Clause
- -securityAlicense-qualityA Model Context Protocol (MCP) server for Grafana. This provides access to your Grafana instance and the surrounding ecosystem.Last updated -1,607Apache 2.0
- -securityAlicense-qualityA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.Last updated -010MIT License