AL

ascii766164696d/log-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

101 stars 6 forks 质量 70 趋势 0MIT

ascii766164696d/log-mcp 是从 https://github.com/ascii766164696d/log-mcp. 导入的 MCP 服务器候选

概览

ascii766164696d/log-mcp 是从 https://github.com/ascii766164696d/log-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

用于日志文件分析的MCP服务器。赋予LLM高效分析大型日志文件的能力,而无需将其加载到上下文中。

这是一个为人工智能设计的工具,而不是为人类设计。没有人类会读取analyze_errors或[compare_logs的输出——克劳德会读取,并进一步压缩,给出一个简单的英文答案。人类会触碰两个端点:“这个日志有什么问题?”输入,自然语言回答输出。中间的一切都是人工智能在自言自语。

工具

工具 描述
log_overview 快速扫描:大小、线数、时间范围、水平分布、头/尾样本
search_logs 按正规表达式、日志级别和/或时间范围搜索
get_log_segment 按线程或时间范围提取一段
analyze_errors 通过指纹去重错误,计数频率,提取栈痕迹
log_stats 体积直方图,水平分解,顶部重复模式
compare_logs 查找每个文件及其频率异常值的独特模式
classify_lines 机器学习分类器(TF-IDF → BERT)将有趣的行与噪声分离

主要特征

  • ML 预过滤 — Rust TF-IDF 分类器扫描文件,位于 1。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

log-mcp

MCP server for log file analysis. Gives LLMs the ability to efficiently analyze large log files without loading them into context.

  Log file (e.g. 705K lines, 67 MB)
    │
    ▼
  Rust TF-IDF classifier ─── 1.3M lines/sec ──▶ 70-95% discarded as routine,
    │                        finds lines that are semantically interesting,
    │                        also captures lines not explicitly marked as ERROR
    │                        (grep ERROR: 2 lines, classifier: 92)
    ▼
  BERT-mini (optional) ───── GPU, ~2K lines/sec ─▶ refines interest scores on found lines
    │
    ▼
  Python MCP tools ────────── search, compare, group errors
    │
    ▼
  LLM (Claude) ───────────── compresses tool output into plain English

This is a tool designed for AI, not humans. No human reads the output of analyze_errors or compare_logs — Claude does, compresses it further, and gives the human a plain English answer. The human touches two endpoints: “what’s wrong with this log?” in, natural language answer out. Everything in between is AI talking to itself.

Tools

Tool Description
log_overview Quick scan: size, line count, time range, level distribution, head/tail samples
search_logs Search by regex, log level, and/or time range
get_log_segment Extract a segment by line range or time range
analyze_errors Deduplicate errors by fingerprint, count frequencies, extract stack traces
log_stats Volume histogram, level breakdown, top repeated patterns
compare_logs Find patterns unique to each file and frequency outliers across files
classify_lines ML classifier (TF-IDF → BERT) separates interesting lines from noise

Key features

  • ML pre-filter — a Rust TF-IDF classifier scans files at 1.3M lines/sec, so analyze_errors and search_logs only process the 5-30% of lines that matter. Optional BERT-mini re-scores LOOK lines at ~2K lines/sec on Metal GPU for higher precision. Works without parsed log levels — catches errors, security events, hardware faults, and anomalies that don’t have ERROR in them.
  • Auto-detection of log formats: JSON, standard text (2024-01-15 10:30:45 ERROR ...), syslog, Spark/Log4j (17/06/08 13:33:49 INFO ...), and tab/pipe-delimited formats (GitHub Actions CI logs)
  • Normalization collapses variable parts (UUIDs, hex IDs, IPs, numbers) so that messages differing only in IDs or timestamps are grouped as the same pattern
  • Content-based error detection falls back to regex heuristics (fatal:, Permission denied, ##[error], etc.) when log files lack standard levels
  • Prefix-aware comparison distinguishes patterns from different job steps in CI logs

Install

Prerequisites (fresh Mac):

brew install python uv
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "log-mcp": { "command": "uv", "args": ["run", "--directory", "/path/to/log-mcp", "log-mcp"] } } }