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 分