Skip to main content
Glama
LogAnalyzer MCP Server

LogAnalyzer MCP Server

LogAnalyzer MCP Server

AI-powered log analysis for your editor. Paste a log or point at a log file, and get the root cause, prioritized fixes, and ready-to-run debug commands, right inside Claude, Cursor, or any other MCP client.

npm version npm downloads License: MIT Node.js

Features

  • Root-cause analysis: an LLM (Google Gemini or Anthropic Claude) reads your logs and explains what went wrong, with a confidence score.

  • Actionable fixes: prioritized suggestions plus copy-paste debug commands.

  • Live monitoring: watch log files and catch new errors as they're written.

  • Stack trace parsing: Node/V8, Java, and Python traces are parsed into structured fields.

  • Error history: every analysis is saved to a local SQLite database you can query by file, severity, and date.

  • Works without an API key: with no key, the server still runs and falls back to local pattern matching.

Related MCP server: Debug MCP

Quick start

You need Node.js 18+ and, for AI analysis, an API key from Google AI Studio or the Anthropic Console.

Claude Code

claude mcp add loganalyzer -e LLM_PROVIDER=anthropic -e ANTHROPIC_API_KEY=your_key -- npx -y loganalyzer-mcp

Claude Desktop, Cursor, and other MCP clients

Add this to your client's MCP config (claude_desktop_config.json for Claude Desktop, ~/.cursor/mcp.json for Cursor):

{
  "mcpServers": {
    "loganalyzer": {
      "command": "npx",
      "args": ["-y", "loganalyzer-mcp"],
      "env": {
        "GEMINI_API_KEY": "your_gemini_api_key"
      }
    }
  }
}

To use Claude instead of Gemini, replace the env block with:

"env": {
  "LLM_PROVIDER": "anthropic",
  "ANTHROPIC_API_KEY": "your_anthropic_api_key"
}

Prefer a global install? Run npm install -g loganalyzer-mcp and use "command": "loganalyzer-mcp" with no args.

Restart your client, then try asking:

Debug these logs and tell me how to fix them: <paste logs>
Start watching /var/log/app.log for errors
Show me all critical errors from the last 24 hours

Tools

Tool

What it does

Parameters

rapid_debug

Fast triage: root cause, prioritized fixes, and debug commands

logText

analyze_log

Deeper AI analysis with surrounding context

logText, logFormat (auto | json | plain), contextLines

quick_scan

Local error detection in milliseconds, with no AI call

logText

watch_log_file

Start monitoring a file for new errors

filePath, pollInterval

stop_watching

Stop monitoring a file

filePath

list_watched_files

List files being monitored

none

get_recent_errors

Recent errors from monitored files

filePath, limit

get_error_history

Query saved errors with filtering and pagination

filePath, severity (low | medium | high | critical), since, until, limit, offset

The server also exposes three MCP resources: loganalyzer://rapid-debug, loganalyzer://recent-errors, and loganalyzer://watched-files.

Configuration

All settings are environment variables, set in your MCP client's env block or in a .env file.

Variable

Description

Default

LLM_PROVIDER

gemini or anthropic

gemini

GEMINI_API_KEY

Required when LLM_PROVIDER=gemini

none

ANTHROPIC_API_KEY

Required when LLM_PROVIDER=anthropic

none

LLM_MODEL

Override the model for the selected provider

gemini-2.5-flash / claude-sonnet-5-5

DB_PATH

Where the SQLite error history is stored

~/.loganalyzer/loganalyzer.db

No API key? The server still starts. It logs a warning to stderr, disables AI analysis, and the tools keep working with local pattern matching, file watching, and history.

Troubleshooting

  • The server exits right away when I run it in a terminal. That's expected. MCP servers talk over stdin/stdout and are started by your MCP client, not run by hand.

  • Analysis says "AI analysis disabled". No API key matches LLM_PROVIDER. Check that the key is in your client's env block and restart the client.

  • Model not found errors. Your key may not have access to the default model. Set LLM_MODEL to one it does.

  • Install fails while building better-sqlite3. It's a native module. Make sure you're on a current Node.js LTS release; prebuilt binaries are downloaded for most platforms.

  • File watching doesn't pick anything up. Use an absolute path and check that the file is readable by the user your MCP client runs as.

Development

git clone https://github.com/ChiragPatankar/loganalyzer-mcp.git
cd loganalyzer-mcp
npm ci
npm run build
npm test

npm run dev runs the server from source and npm run analyze <logfile> runs a quick CLI analysis. To test with an MCP client, point it at node /absolute/path/to/loganalyzer-mcp/dist/src/server.js.

More guides:

Contributing

Issues and pull requests are welcome. Please run npm run build && npm test before opening a PR, and open an issue first for larger changes.

License

MIT © Chirag Patankar

Available Tools

7 tools
analyze_logB

Analyze error logs and provide root cause analysis with AI-powered insights

Inputs: logText (required), contextLines, logFormat.

get_recent_errorsC

Get recent error analysis from monitored files

Inputs: filePath, limit.

list_watched_filesB

List all currently monitored log files

Inputs: no named parameters.

quick_scanB

⚡ Ultra-fast log scan for real-time monitoring (< 1 second)

Inputs: logText (required).

rapid_debugC

🚀 DEBUG SERVER LOGS IN UNDER 30 SECONDS - Instant analysis with actionable fixes and debug commands

Inputs: logText (required).

stop_watchingC

Stop monitoring a specific log file

Inputs: filePath (required).

watch_log_fileC

Start monitoring a log file for real-time error detection

Inputs: filePath (required), pollInterval.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 7 tools

    Disambiguation4/5

    Most tools have distinct purposes, but 'analyze_log' and 'rapid_debug' could be confused as both involve analyzing logs for debugging, with 'rapid_debug' emphasizing speed and actionable fixes. The other tools like 'list_watched_files', 'stop_watching', and 'watch_log_file' are clearly distinct for file monitoring management.

    Naming Consistency3/5

    The naming is mixed with some consistent patterns like verb_noun ('analyze_log', 'watch_log_file', 'stop_watching') but deviations such as 'get_recent_errors' and 'list_watched_files' use different verb styles, and 'quick_scan' and 'rapid_debug' include emojis and marketing language, breaking consistency.

    Tool Count5/5

    With 7 tools, the count is well-scoped for a log analysis server, covering core operations like analysis, monitoring, and file management without being excessive or too sparse, fitting typical MCP server ranges.

    Completeness4/5

    The tool set covers key log analysis workflows including monitoring (watch/stop/list), analysis (analyze/scan/debug), and error retrieval, but lacks explicit tools for configuration management or historical data export, which could be minor gaps in a comprehensive logging system.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An AI-powered server that analyzes system log files to identify errors/warnings and recommend fixes using FastMCP, LangGraph ReAct agents, and Anthropic Claude.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An intelligent debugging assistant that automates the debugging process by analyzing bugs, injecting HTTP-based debug logs into code across multiple environments (browser, Node.js, mobile, etc.), and iteratively fixing issues based on real-time feedback.
      8
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server for AI-powered log analysis that enables parsing, searching, and debugging across nine log formats directly within Claude. It features automated error extraction, sensitive data scanning, and streaming support for large log files.
      14
      34 PyPI
      5
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An AI-powered server for code analysis, requirements validation, and automated fix proposals with human-in-the-loop confirmation. It supports multiple LLM providers and ensures safe file modifications through automatic backups and path validation.
      -