The MCP Log Analyzer is a powerful tool for analyzing various log types on Windows systems using the Model Context Protocol. It supports multiple log formats including Windows Event Logs, Event Trace Logs, and structured logs like JSON and CSV.
# Clone the repository
git clone https://github.com/your-username/mcp-log-analyzer.git
cd mcp-log-analyzer
# Install the package
pip install -e .
# For ETL file support (optional)
pip install -e ".[etl]"
On Windows, the package includes Windows Event Log support via pywin32:
# Ensure Windows dependencies are installed
pip install pywin32>=300
# Test the setup
python test_windows_setup.py
# If successful, start the server
python main.py
Note: You may need to run the post-install script after installing pywin32:
python Scripts/pywin32_postinstall.py -install
MCP servers communicate via stdin/stdout with MCP clients like Claude Code. The server runs silently, waiting for protocol messages:
# Run directly
python main.py
# Or add to Claude Code
claude mcp add mcp-log-analyzer python main.py
# Verify the server is working
python check_server.py
# See usage instructions
python check_server.py --usage
Add the server:
claude mcp add mcp-log-analyzer python /path/to/main.py
Use the available tools:
register_log_source: Register new log sourceslist_log_sources: View all registered sourcesget_log_source: Get details about a specific sourcedelete_log_source: Remove a log sourcequery_logs: Query logs with filters and paginationanalyze_logs: Perform analysis (summary, pattern, anomaly)Access resources:
@mcp-log-analyzer:logs://sources@mcp-log-analyzer:logs://types@mcp-log-analyzer:logs://analysis-typesAccess real-time system information without registering log sources:
@mcp-log-analyzer:system://process-list
Shows top processes by CPU usage with memory information.
# Default (last 10 entries)
@mcp-log-analyzer:system://windows-event-logs
# Last 50 entries
@mcp-log-analyzer:system://windows-event-logs/last/50
# Last 30 minutes
@mcp-log-analyzer:system://windows-event-logs/time/30m
# Specific time range
@mcp-log-analyzer:system://windows-event-logs/range/2025-01-07 13:00/2025-01-07 14:00
# Default (last 50 lines)
@mcp-log-analyzer:system://linux-logs
# Last 100 lines
@mcp-log-analyzer:system://linux-logs/last/100
# Last hour
@mcp-log-analyzer:system://linux-logs/time/1h
# Specific time range
@mcp-log-analyzer:system://linux-logs/range/2025-01-07 13:00/2025-01-07 14:00
# Default (listening ports)
@mcp-log-analyzer:system://netstat
# Listening ports
@mcp-log-analyzer:system://netstat/listening
# Established connections
@mcp-log-analyzer:system://netstat/established
# All connections
@mcp-log-analyzer:system://netstat/all
# Network statistics
@mcp-log-analyzer:system://netstat/stats
# Routing table
@mcp-log-analyzer:system://netstat/routing
# Port-specific information
@mcp-log-analyzer:system://netstat/port/80
30m (30 minutes), 2h (2 hours), 1d (1 day)2025-01-07 13:00, 2025-01-07 13:30:15, 07/01/2025 13:00Use register_log_source tool with:
- name: "system-logs"
- source_type: "evt"
- path: "System"
Use query_logs tool with:
- source_name: "system-logs"
- filters: {"level": "Error"}
- limit: 10
Use analyze_logs tool with:
- source_name: "system-logs"
- analysis_type: "pattern"
Use register_log_source tool with:
- name: "network-trace"
- source_type: "etl"
- path: "C:\\Traces\\network.etl"
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-log-analyzer" '{"command":"python","args":["main.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-log-analyzer": {
"command": "python",
"args": [
"main.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"mcp-log-analyzer": {
"command": "python",
"args": [
"main.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect