Generic Grafana/Loki log-querying MCP server (stdio, read-only). Returns raw logs with aggregated views (slow queries, errors, volume trends); root-cause analysis is done by AI IDE + business code/skills.
Server has 10 tools with consistent naming (verb_noun pattern: list_, query_, diagnose_, analyze_, extract_, get_). Descriptions are present and detailed (avg ~180 chars), exceeding baseline minimums. However, input schemas are partially visible but lack formal JSON Schema type declarations in the provided code excerpt. Parameter descriptions are comprehensive but schema validation rigor is unclear. Error handling via `fail()` wrapper exists but lacks recovery guidance. No tool annotations (readOnlyHint, destructiveHint) despite all tools being READ_ONLY. Output structure is documented informally but not as formal JSON Schema.
分析慢日志:从日志中提取耗时(支持 SQL 操作、请求汇总、连接释放、结构化字段、文本模式),按操作维度聚合,返回按累计耗时降序的统计视图(count/totalMs/maxMs/avgMs/first/last)。
分析日志量趋势:按时间分桶统计日志条数,检测异常突增(基线+3σ),返回桶序列、基线均值、阈值、峰值、倍数、异常起点、是否持续。
自动诊断问题:聚合错误模式、检测异常起点、提取根因信号、对比基线、追踪流程断点。输入 requestId 或 keyword 精确定位问题范围,返回结构化分析(故障分类、级联关系、堆栈、外部依赖、字段异常、慢日志、流程断点)。
从日志中提取 requestId / traceId 等链路 ID,按出现频次排序。用于发现高频请求或链路。
按时间戳精确查询单行日志的完整内容(不截断)。当 query_logs / diagnose_issue 因预算省略了某行时,用此工具补全。
列出该 Grafana 实例上全部 Loki 日志数据源(uid/名称/是否默认),以及各数据源已登记的项目数。多数据源环境下先用它确认要查哪个数据源。
Input schemas lack formal JSON Schema type declarations. Code shows `z.string()`, `z.record()` (Zod validators) but the actual JSON Schema sent to the MCP client is not visible. Cannot verify if types, minLength, maxLength, enum constraints are properly serialized.
No tool annotations (readOnlyHint, destructiveHint, idempotentHint) despite all 10 tools being READ_ONLY. MCP spec (2026-07-28) recommends tool annotations for agent planning. Missing this metadata forces LLMs to infer safety from descriptions alone.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 66 | 2026-07-28+ | v2 |
列出指定标签在时间窗内的全部取值(如 labelName=app 列出所有服务名)。
列出某数据源(或某项目)在时间窗内可用的日志标签名(如 app/group/host/level)。
列出全部可查项目:已登记项目(含中文别名)+ 遍历各 Loki 数据源实时发现的 app/group 组合(默认查最近 24h,标注归属数据源与登记状态)。不知道项目叫什么时先调这个。
查询原始日志。数据量控制:优先用 requestId 精确到单次请求;配合窄时间窗(默认 15m);行数/单行长度/总响应均有硬上限,超出会标注省略。排查线上问题建议优先用 diagnose_issue(自动聚合分析),本工具适合按线索精确取证。
Error handling via `fail(e)` returns only error message text. No recovery guidance, error classification (retryable vs user-fixable), or actionable next steps. E.g., 'project not found' error lists available projects but other errors (API timeout, auth failure) provide no guidance.
Output schemas not formally documented. Tools return `ok(obj)` which serializes to JSON text, but the structure of returned objects (fields, types, pagination) is not declared in tool definitions. LLMs cannot plan downstream calls without knowing response structure.
Parameter `range` (e.g., '15m', '2h', '1d') lacks enum constraint. Description says 'supports 5m/2h/1d' but no formal enum in schema. LLMs may pass invalid values like '3h' or '1w'. Should declare enum: ['5m', '15m', '1h', '2h', '6h', '1d', '7d'].