MCP Log Analyzer
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Log AnalyzerRead logs from sample_logs and show me any errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
📊 MCP Log Analyzer
An intelligent log file analyzer powered by Python and integrated with Cursor IDE through the Model Context Protocol (MCP).
🎯 What It Does
Analyzes log files instantly using AI-powered tools. Instead of manually searching through thousands of log lines, ask questions in natural language and get instant insights about errors, patterns, and anomalies.
Before vs After
Before (❌):
Manually open and search log files
Hours of tedious analysis
Error-prone manual work
After (✅):
Ask Claude in natural language
Get instant analysis in seconds
Automatic pattern detection
AI-powered insights
Related MCP server: Local Logs MCP Server
🛠️ Features
6 Analysis Tools
read_logs - Fetch and display log content
count_log_types - Count logs by severity (INFO, ERROR, WARNING, CRITICAL)
generate_statistics - Analyze patterns and detect anomalies
extract_critical_logs - Extract only critical issues
detect_anomalies - Find unusual activity and spikes
generate_report - Create formatted HTML/text reports
🚀 Quick Start
1. Clone Repository
git clone https://github.com/BBashh/log_file_mcp.git
cd log_file_mcp2. Set Up Virtual Environment
# Windows
python -m venv venv
venv\Scripts\activate# Mac/Linux
python3 -m venv venv
source venv/bin/activate3. Install Dependencies
pip install -r requirements.txt4. Test Locally
python mcp_server.py
# Should show: "Log Analyzer MCP Server starting..."
# Press Ctrl+C to stop5. Configure Cursor IDE
Update your mcp.json file:
Location: C:\Users\[YourUsername]\AppData\Roaming\Cursor\User\settings\mcp.json
{
"mcpServers": {
"log-analyzer": {
"command": "[FULL_PATH_TO_VENV]\\venv\\Scripts\\python.exe",
"args": ["[FULL_PATH_TO_PROJECT]\\mcp_server.py"]
}
}
}6. Use in Cursor
Restart Cursor IDE
Look for green dot in Tools & MCP
Ask questions in Cursor chat:
"Read logs from sample_logs"
"How many errors are there?"
"Generate a report"
🔧 Configuration
Edit `config.py` to customize:
DEFAULT_LOG_DIR = "C:\\path\\to\\logs" # Your log directory
LOG_LEVELS = ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"]
STATS_CONFIG = {
"min_line_length": 5,
"max_line_length": 1000,
"rare_threshold": 0.01,
}📝 Usage Examples
In Cursor Chat:
NOTE: If the chat is giving responses without using the mcp tool, then explicitly mention in the chat to use the xyz tool.
Ex:
Read logs:
Read the logs from sample_logs and show me the last 10 lines using the read_logs mcp toolCount by type:
How many INFO, WARNING, and ERROR logs are there using `xyz` tool?Get statistics:
Analyze the logs for patterns and anomalies using `xyz` toolExtract critical:
Show me all critical logs only using `xyz` toolGenerate report:
Create a comprehensive analysis report of the logs using `xyz` tool.Ex:
🏛️ Technical Details
Technologies
FastMCP - MCP server framework
Python 3.x - Programming language
Cursor IDE - IDE integration
JSON-RPC - Communication protocol
Design Patterns
MVC Pattern - Separation of concerns
Factory Pattern - Tool creation
Observer Pattern - Event handling
Singleton Pattern - Config management
Key Features
Modular architecture (easy to extend)
Error handling and validation
Configuration management
Report generation (HTML/Text)
Pattern detection
Anomaly detection
🔐 Security Notes
Server runs locally only (no internet exposure)
Log files processed in memory
No data stored externally
Compatible with confidential logs
🐛 Troubleshooting
Green dot not showing?
Check mcp.json has correct paths
Verify venv Python path is correct
Restart Cursor completely
"Module not found" error?
Make sure venv is activated
Run: pip install -r requirements.txt
Tools not responding?
Verify server running: python mcp_server.py
Check sample_logs/sample.log exists
Restart Cursor and try again
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.
Query application logs, traces, and metrics from your AI coding assistant via Foam's MCP server.
- SuperlogOAuthsh.superlog
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Search log events, investigate anomalies, and manage cases in your Knowledge Grid tenant.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI-powered debugging through structured logging with pattern recognition and intelligent analysis. Allows applications to write structured logs and receive actionable debugging insights based on error patterns and frequency analysis.-
- AlicenseAqualityDmaintenanceEnables monitoring and analysis of local application log files with real-time tailing, error tracking, and search capabilities. Perfect for debugging Node.js applications, web servers, or any application that writes to log files through natural language commands.66MIT
- FlicenseBqualityCmaintenanceEnables AI-assisted analysis of log files through advanced searching, filtering, and test execution capabilities. Supports time-based queries, pattern matching, test summarization, and code coverage reporting directly within compatible MCP clients.12-
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides AI assistants with direct access to application logs for on-demand searching, filtering, and analysis. It enables tools like Cursor to summarize log entries and identify errors within the development environment to streamline debugging.8 npm6MIT