log-analyzer-mcp
Enables log analysis, searching, counting, and system metrics retrieval (CPU, memory, disk) via natural language, using 5 tools that can be integrated with Claude Code.
README
log-analyzer-mcp
An MCP (Model Context Protocol) server that provides log analysis and system metrics tools. Connects to Claude Code via stdio transport and exposes 5 tools for searching, counting, and analyzing local log files.
Features
| Tool | Description |
|---|---|
search_logs |
Search log files by keywords or regex patterns |
count_by_level |
Count log entries by severity level (ERROR/WARN/INFO/DEBUG) |
query_by_timerange |
Filter logs within a specific time range |
get_system_metrics |
Get CPU, memory, and disk usage metrics |
explain_error |
Format error content for AI-assisted analysis |
Quick Start
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run the server
npm start
Development
# Run with hot reload
npm run dev
Integration with Claude Code
Add the server to 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
Verify the connection:
claude mcp list
Tool Details
search_logs
Search log files by keywords or regex. Supports searching a single .log file or an entire directory.
{
"keywords": ["ERROR", "timeout"],
"regex": "connection.*failed",
"logPath": "/var/log",
"limit": 100
}
count_by_level
Count log entries by severity level, optionally filtered by time range.
{
"logPath": "/var/log",
"startTime": "2026-04-29T00:00:00Z",
"endTime": "2026-04-30T00:00:00Z"
}
query_by_timerange
Filter logs within a specific time range, with optional level filter.
{
"startTime": "2026-04-29T00:00:00Z",
"endTime": "2026-04-30T00:00:00Z",
"logPath": "/var/log",
"level": "ERROR",
"limit": 100
}
get_system_metrics
Get CPU, memory, and disk metrics. Supports Windows and Linux.
{
"metrics": ["cpu", "memory", "disk"]
}
explain_error
Format error content for AI-assisted root cause analysis.
{
"errorContent": "java.lang.NullPointerException\n at com.example.Service.process(Service.java:42)",
"contextLines": 10
}
Architecture
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
The server uses @modelcontextprotocol/sdk with StdioServerTransport. Tools are registered via CallToolRequestSchema handler.
Key Design Decisions
- Stream processing: Uses
readline + createReadStreamto handle large log files without loading them entirely into memory - Cross-platform: Windows (WMIC) and Linux (top/free/df) dual-path implementation with runtime platform detection
- Tolerant parsing: Non-standard log formats are preserved rather than dropped (missing levels default to INFO, missing timestamps default to current time)
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.