loading…
Search for a command to run...
loading…
Analyzes log files to identify root causes of project errors and generates detailed fix plans with risk assessments. It implements a multi-phase workflow that e
Analyzes log files to identify root causes of project errors and generates detailed fix plans with risk assessments. It implements a multi-phase workflow that ensures no code modifications are applied without explicit user approval.
A specialized Model Context Protocol (MCP) server that analyzes errors in your projects, identifies root causes, and generates detailed fix plans with a built-in approval workflow before applying any changes.
When your project encounters errors, this MCP server helps you:
This server emphasizes safety and transparency: it never modifies your files without your explicit approval and clear understanding of what will change.
logger directorylist_available_logsList all log files in your logger directory.
.log files available for analysisanalyze_errorAnalyze errors in a specific log file.
create_fix_planCreate a detailed work plan to fix identified errors.
approve_fix_planApprove a fix plan after reviewing the proposed changes.
apply_fix_plan to make the changesreject_fix_planReject a fix plan if you disagree with proposed solutions.
apply_fix_planApply the approved fixes to your project files.
get_fix_plan_detailsRetrieve detailed information about a specific fix plan.
list_pending_plansSee all fix plans created in this session with their statuses.
1. Error occurs in your project
↓
2. Error is written to logger/error.log
↓
3. Call analyze_error(project_dir="/path/to/project", log_file_name="error.log")
→ Returns: analysis_id = "abc123"
↓
4. Call create_fix_plan(analysis_id="abc123")
→ Returns: plan_id = "xyz789"
→ Status: "AWAITING USER APPROVAL"
↓
5. Review the proposed fixes in the plan
↓
6. Either:
a) Call approve_fix_plan(plan_id="xyz789") → then apply_fix_plan(plan_id="xyz789")
b) Call reject_fix_plan(plan_id="xyz789", feedback="...")
cd m:\mcp\mcp-read-log
pip install -r requirements.txt
# Copy the example file
cp .env.example .env
# Edit .env to customize:
# - LOG_DIR: Path to your logger directory (default: ./logger)
# - PROJECT_DIR: Default project to analyze
# - BACKUP_BEFORE_APPLY: Create backups before applying fixes
mkdir logger
You have access to the error-analyzer-mcp MCP server. When a user's project has errors:
1. First call: list_available_logs() to see what log files are available
2. Then call: analyze_error() with the project path and log file name
3. Review the analysis results
4. Call: create_fix_plan() with the analysis ID
5. Show the user the proposed fixes and ask for approval
6. Only after explicit approval, call: apply_fix_plan()
User: "My Python project is broken with errors"
AI: Calling list_available_logs()... Found: error.log, debug.log
AI: Which log should I analyze? Let me check error.log.
AI: Calling analyze_error(project_dir=".", log_file_name="error.log")
AI: Analysis complete! Found SyntaxError on line 42, affects 3 files.
AI: Calling create_fix_plan()...
AI: Created fix plan. Here are the proposed changes:
- Fix syntax error in main.py line 42
- Update import in handler.py line 15
AI: This has LOW risk. Do you approve these changes?
User: "Yes, apply them"
AI: Calling approve_fix_plan()... then apply_fix_plan()
AI: Done! Applied 2 fixes to your project.
✅ No file modifications without approval
✅ Clear risk assessment
✅ Transparent change tracking
✅ Reversible operations
Place log files in the logger directory. Supported formats:
Example:
Error in /path/to/file.py on line 42:
SyntaxError: invalid syntax
x = y +
^
File "helper.py", line 15, in process()
undefined_variable = 5
Project metadata and Python dependencies. Uses PyPI packages for MCP, Pydantic, and python-dotenv.
Direct pip requirements for easy installation.
Configuration dataclass for runtime settings.
Environment variables:
LOG_DIR: Custom logger directory pathPROJECT_DIR: Default project to analyzeBACKUP_BEFORE_APPLY: Whether to create backups (true/false)mcp-read-log/
├── main.py # MCP server with all tools
├── settings.py # Configuration management
├── pyproject.toml # Project metadata
├── requirements.txt # Python dependencies
├── .env.example # Example configuration
├── README.md # This file
│
├── models/
│ ├── result.py # ToolResult, ErrorInfo, ErrorAnalysis models
│ └── error_analysis_models.py # Input models for MCP tools
│
├── services/
│ ├── log_reader.py # Log file reading utilities
│ └── error_analysis_service.py # Core error analysis logic
│
├── utils/
│ └── (utilities for path, validation, errors)
│
├── tests/
│ └── (unit tests for services)
│
└── logger/ # Log files (created on first use)
├── error.log
└── debug.log
If the MCP server doesn't start:
python --version
pip list | grep mcp
pip list | grep pydantic
python -c "from services.log_reader import list_log_files; print(list_log_files())"
echo %LOG_DIR% # Windows
echo $LOG_DIR # Linux/Mac
Based on the git-mcp-server framework by the course instructor.
To extend this MCP server:
error_analysis_service.pyErrorAnalysis modelmain.py following the @mcp.tool() patternRemember: This server helps you understand and fix errors safely. Always review proposed changes before approval!
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"error-analyzer-mcp-server": {
"command": "npx",
"args": []
}
}
}