Ndjson Local Log Triage Mcp

io.github.vola-trebla由 GitHub 账号 vola-trebla 发布v0.2.0更新于 Oct 24, 2026

Streams NDJSON log triage: query patterns, detect anomalies, summarize timelines without full load.

已验证STDIO仅桌面安全与监控数据与分析

概览

AI 生成的概览

一个本地 MCP 服务器,以流式方式读取 NDJSON 日志文件,让助手无需整体加载即可筛选条目、检测错误尖峰并汇总时间线。

可以做什么
按字段/值匹配筛选日志条目,可选按行首模式重建多行堆栈,并限制返回条数。按时间窗口分桶统计错误,用 Z 分数标出异常偏高的窗口。按时间窗口汇总各级别日志数量,可选自动调整桶大小并放大峰值窗口。按 trace ID 跨多个日志文件重建分布式调用链,列出涉及的服务和总耗时。推断日志文件格式与字段结构,识别时间戳和严重级别字段。用 Drain 算法把消息聚类成模板并展示参数分布。启动后台实时跟踪并推送异常告警,或查询外部日志平台。
适用场景
当助手需要排查大型 NDJSON 日志时使用,例如查明某时间点错误激增的原因、跨服务重建一次请求,或在故障期间快速获得严重级别时间线。
运行要求
通过 npm 包以 npx 在用户机器上作为本地进程运行,需要 Node.js。未声明认证、环境变量或请求头。助手需要对磁盘上的日志文件有读取权限。
安装前请注意
服务器会读取本地日志文件,其中可能含用户 ID、客户端 IP 等个人数据,结果会返回给助手。实时排查工具会启动后台跟踪并发送通知。外部日志查询工具会把搜索条件发送给 Datadog、Splunk 或 Elasticsearch 等第三方,可能需其各自的凭据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Ndjson Local Log Triage Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

🪵 ndjson-local-log-triage-mcp

[npm] [CI] [License: MIT]

Your service just crashed. The log file is 2GB. Your AI agent can't help.

MCP server that stream-parses NDJSON log files without loading them into memory — filter by pattern, detect error spikes via Z-score analysis, summarize severity timelines by time window.


🤔 The problem

A service crashes at 3am. The log file is app.log.ndjson and it's 2GB. You ask your agent to find what caused the spike in errors around 03:17. The agent can't read 2GB. It can't even try.

ndjson-local-log-triage-mcp streams the file line by line — never loading it into memory — and gives the agent exactly the slice it needs.


🛠️ Tools

query_log_pattern

Filter log entries by a field/value match. Returns up to N matching entries, streaming the file without loading it entirely. Pass lineStartPattern (e.g. "^{") to reconstruct multiline stack traces silently dropped by the default parser.

Log Query Results  File:        /var/log/app.log.ndjson  Filter:      service contains "auth"  Lines read:  847,293  Matches:     50 (limit 50 reached)
{"timestamp":"2025-01-15T03:17:02Z","level":"error","service":"auth","msg":"token validation failed","userId":"u_abc123"}...

detect_error_anomalies

Z-score frequency analysis. Buckets errors by time window, computes mean + stddev, flags windows where the error rate is anomalously high.

Error Anomaly Detection  File:            /var/log/app.log.ndjson  Window:          5min  Z-score cutoff:  2.0  Baseline:        mean=3.2 errors/window, stdDev=1.8  Anomalies found: 2
  [z=4.71] 2025-01-15T03:15:00.000Z  23 errors  [z=2.33] 2025-01-15T03:20:00.000Z  9 errors

summarize_log_timeline

Chronological aggregation of errors, warnings, and info counts per time window. Quick visual of where the incident is.

Pass adaptive: true to auto-scale bucket size to actual event density and zoom in on the peak error window at 10× finer resolution.

Log Timeline Summary  File:        /var/log/app.log.ndjson  Window:      5min  Buckets:     48
  Time (UTC)                 Errors  Warnings  Info  Other  ─────────────────────────────────────────────────────────    2025-01-15 03:00:00Z          2         8   142      0    2025-01-15 03:05:00Z          1         5   138      0    2025-01-15 03:10:00Z          3         9   141      0  ! 2025-01-15 03:15:00Z         23        14   119      0    2025-01-15 03:20:00Z          9        11   133      0

correlate_request

Reconstructs a distributed trace from multiple NDJSON log files. Given a trace_id, collects all correlated events in chronological order across all files and surfaces the services involved and total duration.

Request Correlation  Trace ID:          trace-8f7a9b2c  Files scanned:     2  Events found:      10  Services involved: api, worker  Duration:          890ms
[2025-01-15T14:00:00.001Z] api           {"level":"info","msg":"incoming request",...}[2025-01-15T14:00:00.045Z] api           {"level":"info","msg":"auth token validated",...}[2025-01-15T14:00:00.112Z] worker        {"level":"info","msg":"job queued",...}...

discover_log_schema

Analyze a log file to infer its wrapper format (NDJSON, Syslog, Kubernetes container logs) and extract type schemas, identifying polymorphic keys, timestamp patterns, and severity fields.

json
{  "fileFormat": "NDJSON",  "detectedKeys": {    "timestamp": { "type": "string", "format": "date-time", "isChronologicalIndex": true },    "level": { "type": "string", "isSeverityField": true, "possibleValues": ["info", "error"] }  }}

group_semantic_patterns

Cluster log messages dynamically using the fixed-depth tree-based Drain parsing algorithm to isolate distinct log templates and analyze their parameter distributions (wildcard variations).

Processed Logs: 1500Unique Patterns: 2
- Template: "connection failed from * port *"  Occurrences: 1200  Parameters:    - param_0 (client_ip): 192.168.1.1 (80%), 10.0.0.5 (20%)

start_live_triage

Start background log tailing with real-time Z-score anomaly alerting on error frequency spikes and heap memory protection limits. Dispatches notifications directly over standard JSON-RPC channels.

json
{  "method": "notifications/triage",  "params": {    "type": "anomaly",    "message": "Live Anomaly Detected: 45 errors in current window (Z-score: 3.52)",    "z_score": 3.52,    "error_count": 45  }}

query_external_logs

A unified gateway to query central log providers (Datadog, Splunk, Elasticsearch), converting search patterns to vendor-specific dialects and mapping the output into the standardized OpenTelemetry Log Data Model structure.


⚡ Setup

json
{  "mcpServers": {    "log-triage": {      "command": "npx",      "args": ["-y", "ndjson-local-log-triage-mcp"]    }  }}

🚀 Usage

"Analyze /var/log/app.log.ndjson — summarize the error timeline in 5-minute windows, detect any anomalous spikes, and show me the error entries around the spike."

Works great alongside:


📦 Links

License

MIT

来源:README.md,提交 76f7060

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分