Log Analyzer MCP Server

Log Analyzer MCP Server

An MCP server for intelligent log analysis providing semantic search, error pattern clustering, and smart error detection. It enables users to process, vectorize, and query local logs to efficiently identify issues and generate AI-powered summaries.

Category
访问服务器

README

Log Analyzer MCP Server 🚀

100% Local | FAISS-Powered | No Cloud APIs | 30-150x Faster

A Model Context Protocol (MCP) server for intelligent log analysis with semantic search, error detection, and pattern clustering. Runs entirely locally using sentence-transformers and FAISS.

GitHub

✨ Features

  • 🔍 Semantic Search - Find logs by meaning, not just keywords
  • FAISS Vector Search - 30-150x faster than traditional search
  • 🐛 Smart Error Detection - Automatic error pattern clustering
  • 💾 Intelligent Caching - Lightning-fast re-indexing
  • 🏠 100% Local - No cloud APIs, no costs, privacy-first
  • 📊 Hybrid Retrieval - Combines semantic + lexical matching

🎯 Quick Start (Production)

Using uvx (Recommended)

# Install uv
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Claude Desktop Config:

{
  "mcpServers": {
    "log-analyzer": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/suriya-ML/log-checker-mcp.git",
        "log-analyzer-mcp"
      ]
    }
  }
}

Config Location: C:\Users\YOUR-USERNAME\AppData\Roaming\Claude\claude_desktop_config.json

Restart Claude Desktop and you're done! ✅

📦 Manual Installation

1. Clone the Repository

git clone https://github.com/suriya-ML/log-checker-mcp.git
cd log-checker-mcp

2. Install Dependencies

pip install -r requirements.txt

3. Configure Environment Variables

Create a .env file in the project root:

cp .env.example .env

Edit .env and add your AWS credentials:

AWS_ACCESS_KEY_ID=your_access_key_here
AWS_SECRET_ACCESS_KEY=your_secret_key_here
AWS_REGION=us-east-2

Usage

Running the Server Locally

python server.py

Configuring with Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "log-analyzer": {
      "command": "python",
      "args": ["/absolute/path/to/log-analyzer-mcp/server.py"],
      "env": {
        "AWS_ACCESS_KEY_ID": "your_key",
        "AWS_SECRET_ACCESS_KEY": "your_secret",
        "AWS_REGION": "us-east-2"
      }
    }
  }
}

Available Tools

1. fetch_local_logs

Fetch and chunk log files from a local directory.

Parameters:

  • input_folder (optional): Path to folder containing log files (default: ./logs)
  • chunk_size (optional): Size of each chunk in characters (default: 4096)
  • overlap (optional): Overlap between chunks in characters (default: 1024)

Example:

Use fetch_local_logs to process logs from /path/to/logs with chunk_size 5000

2. store_chunks_as_vectors

Vectorize log chunks with AWS Bedrock embeddings and intelligent caching.

Parameters:

  • use_cache (optional): Whether to use embedding cache (default: true)
  • clear_cache (optional): Clear cache before starting (default: false)

Features:

  • Extracts timeframes, class names, method names, error types
  • Parallel processing for fast vectorization
  • Persistent caching to avoid re-embedding

Example:

Use store_chunks_as_vectors to vectorize the logs

3. query_SFlogs

Query vectorized logs with semantic search and comprehensive analysis.

Parameters:

  • query (required): Natural language query

Features:

  • Hybrid semantic + lexical search
  • Automatic error clustering and deduplication
  • Severity ranking and frequency analysis
  • Metadata extraction (timeframes, classes, methods)
  • AI-powered summarization

Examples:

Query logs: "What NullPointerExceptions occurred?"
Query logs: "Summarize all errors"
Query logs: "Show timeout issues in UserHandler"

Configuration

Environment Variables

Variable Description Default
AWS_ACCESS_KEY_ID AWS access key Required
AWS_SECRET_ACCESS_KEY AWS secret key Required
AWS_REGION AWS region us-east-2
AWS_CONNECT_TIMEOUT Connection timeout (seconds) 60
AWS_READ_TIMEOUT Read timeout (seconds) 300
BEDROCK_EMBED_MODEL_ID Embedding model amazon.titan-embed-text-v2:0
BEDROCK_NOVA_MODEL_ID Analysis model amazon.nova-premier-v1:0
LOG_FOLDER Default log folder ./logs
DEFAULT_CHUNK_SIZE Default chunk size 4096
DEFAULT_OVERLAP Default overlap 1024

Architecture

log-analyzer-mcp/
├── server.py              # Main MCP server implementation
├── config.py              # Configuration management
├── utils/                 # Utility modules
│   ├── logging_utils.py   # Logging configuration
│   ├── file_utils.py      # File operations
│   ├── bedrock_utils.py   # AWS Bedrock integration
│   ├── chunking_utils.py  # Text chunking
│   └── error_extraction.py # Error pattern extraction
├── logs/                  # Log storage (created automatically)
├── requirements.txt       # Python dependencies
├── .env.example          # Environment template
└── README.md             # This file

How It Works

1. Log Processing Pipeline

Raw Logs → Chunking → Metadata Extraction → Vectorization → Storage
  • Chunking: Split logs into overlapping chunks for better context preservation
  • Metadata Extraction: Extract timeframes, class names, methods, error types
  • Vectorization: Generate embeddings using AWS Bedrock
  • Caching: Store embeddings for fast re-processing

2. Query Pipeline

Query → Embedding → Hybrid Search → Error Clustering → AI Analysis → Results
  • Hybrid Search: Combine semantic similarity with lexical matching
  • Error Clustering: Group similar errors using fingerprinting
  • Ranking: Sort by severity and frequency
  • AI Analysis: Generate comprehensive summaries with AWS Bedrock

Performance

  • Parallel Processing: Up to 5 concurrent embedding requests
  • Intelligent Caching: 70-90% cache hit rate on repeated processing
  • Adaptive Retrieval: Dynamic top-k based on query type
  • Token Optimization: Smart budget management for AI analysis

Troubleshooting

Common Issues

"No vector JSON found"

  • Run store_chunks_as_vectors first to vectorize your logs

"Bedrock authentication failed"

  • Verify your AWS credentials in .env
  • Ensure your AWS account has Bedrock access enabled

"No chunks found"

  • Check that log files exist in the configured folder
  • Verify file extensions (.log, .txt) are correct

Logging

Logs are written to stderr for MCP compatibility. To debug:

python server.py 2> debug.log

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For issues and questions:

Roadmap

  • [ ] Support for additional embedding models
  • [ ] Real-time log streaming
  • [ ] Web UI for visualization
  • [ ] Multi-language support
  • [ ] Enhanced error pattern detection
  • [ ] Integration with monitoring tools

Acknowledgments

Built with:

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选