Skip to main content
Glama
log-analyzer-mcp

log-analyzer-mcp

by yufeizhou666

log-analyzer-mcp

로그 분석 및 시스템 메트릭 도구를 제공하는 MCP(Model Context Protocol) 서버입니다. stdio 전송을 통해 Claude Code에 연결되며, 로컬 로그 파일을 검색, 카운팅 및 분석하기 위한 5가지 도구를 제공합니다.

기능

도구

설명

search_logs

키워드 또는 정규식 패턴으로 로그 파일 검색

count_by_level

심각도 수준(ERROR/WARN/INFO/DEBUG)별 로그 항목 수 계산

query_by_timerange

특정 시간 범위 내의 로그 필터링

get_system_metrics

CPU, 메모리 및 디스크 사용량 메트릭 가져오기

explain_error

AI 지원 분석을 위해 오류 내용 형식 지정

Related MCP server: ai-ssh-mcp

빠른 시작

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run the server
npm start

개발

# Run with hot reload
npm run dev

Claude Code와 통합

Claude Code에 서버 추가:

# Project-level (only available in this directory)
claude mcp add log-analyzer -- node /path/to/log-analyzer-mcp/dist/index.js

# User-level (available globally)
claude mcp add log-analyzer --scope user -- node /path/to/log-analyzer-mcp/dist/index.js

연결 확인:

claude mcp list

도구 세부 정보

키워드 또는 정규식으로 로그 파일을 검색합니다. 단일 .log 파일 또는 전체 디렉토리 검색을 지원합니다.

{
  "keywords": ["ERROR", "timeout"],
  "regex": "connection.*failed",
  "logPath": "/var/log",
  "limit": 100
}

count_by_level

심각도 수준별로 로그 항목을 계산하며, 선택적으로 시간 범위별로 필터링할 수 있습니다.

{
  "logPath": "/var/log",
  "startTime": "2026-04-29T00:00:00Z",
  "endTime": "2026-04-30T00:00:00Z"
}

query_by_timerange

특정 시간 범위 내의 로그를 필터링하며, 선택적으로 수준 필터를 적용할 수 있습니다.

{
  "startTime": "2026-04-29T00:00:00Z",
  "endTime": "2026-04-30T00:00:00Z",
  "logPath": "/var/log",
  "level": "ERROR",
  "limit": 100
}

get_system_metrics

CPU, 메모리 및 디스크 메트릭을 가져옵니다. Windows 및 Linux를 지원합니다.

{
  "metrics": ["cpu", "memory", "disk"]
}

explain_error

AI 지원 근본 원인 분석을 위해 오류 내용을 형식화합니다.

{
  "errorContent": "java.lang.NullPointerException\n  at com.example.Service.process(Service.java:42)",
  "contextLines": 10
}

아키텍처

src/
├── index.ts           # MCP Server entry point
├── tools/             # Individual MCP tool implementations
├── utils/
│   ├── log_parser.ts  # Timestamp/level parsing, keyword/regex matching
│   └── metrics.ts     # Cross-platform CPU/memory/disk metrics
└── types/             # TypeScript type definitions

이 서버는 StdioServerTransport와 함께 @modelcontextprotocol/sdk를 사용합니다. 도구는 CallToolRequestSchema 핸들러를 통해 등록됩니다.

주요 설계 결정

  • 스트림 처리: readline + createReadStream을 사용하여 대용량 로그 파일을 메모리에 완전히 로드하지 않고 처리합니다.

  • 크로스 플랫폼: 런타임 플랫폼 감지를 통해 Windows(WMIC) 및 Linux(top/free/df) 이중 경로 구현

  • 허용적 파싱: 비표준 로그 형식은 삭제되지 않고 보존됩니다(수준이 누락된 경우 INFO로 기본 설정, 타임스탬프가 누락된 경우 현재 시간으로 기본 설정).

라이선스

MIT

Available Tools

5 tools
count_by_levelB

Count log entries by severity level (ERROR, WARN, INFO, DEBUG)

Inputs: logPath, startTime, endTime.

explain_errorC

AI-assisted error analysis. Formats error content for AI analysis.

Inputs: errorContent (required), contextLines.

get_system_metricsB

Get CPU, memory, and disk metrics from the system

Inputs: metrics.

query_by_timerangeC

Query logs within a specific time range

Inputs: startTime (required), endTime (required), logPath, level, +1 more.

search_logsA

Search log files by keywords or regex patterns. Returns matching log entries with timestamps.

Inputs: keywords, regex, logPath, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: counting by level, error explanation, system metrics, time-range queries, and keyword search. No overlap in functionality.

    Naming Consistency4/5

    Names follow a verb-oriented pattern (count, explain, get, query, search) but mix styles: some use 'by_' (count_by_level, query_by_timerange) while others are plain verb_noun (explain_error, get_system_metrics, search_logs). Mostly consistent but with minor deviations.

    Tool Count5/5

    5 tools is well-scoped for a log analysis server, covering essential operations without being too few or excessive.

    Completeness4/5

    Core log analysis tasks are covered: search, count by level, time-range queries, error explanation, and system metrics. Minor gaps exist, such as lacking a tool to list log sources or aggregate statistics beyond level counting.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Claude integration tool that enables users to query and analyze Aliyun (Alibaba Cloud) Simple Log Service logs through natural language commands.
      1
      21 npm
      2
      GPL 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Enables natural language SSH server management via Claude Code, allowing users to read logs, check services, run commands, and transfer files across multiple servers.
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables Claude to monitor CPU, memory, disk, processes, network connections, Docker containers, and system logs for system diagnostics and troubleshooting.
      5
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Exposes homelab and IT-ops tools to Claude, including system health monitoring, Grafana alert states, Docker container status, Loki logs, SMART disk health, and more.
      8
      1
      -