home / mcp / log analyzer mcp server

Log Analyzer MCP Server

Provides log analysis via an MCP server and CLI for flexible log sourcing and querying.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "darkstar326-log_analyzer_mcp": {
      "command": "uvx",
      "args": [
        "log-analyzer-mcp"
      ],
      "env": {
        "MCP_LOG_FILE": "YOUR_PATH/log_analyzer_mcp_server.log",
        "MCP_LOG_LEVEL": "INFO",
        "LOG_DIRECTORIES": "[\"/var/log/myapp\"]",
        "PYTHONUNBUFFERED": "1",
        "LOG_PATTERNS_ERROR": "[\"Exception:.*\"]"
      }
    }
  }
}

Log Analyzer MCP provides an MCP server that lets you analyze logs from your editor or IDE-driven workflows. You can run a local MCP server or fetch the latest package through a helper runner, and you gain automated log search, test-focused actions, and optional code coverage reporting within your development environment.

How to use

Use the MCP server with an MCP client to access log analysis capabilities from your editor or AI-assisted tools. You can launch a local MCP server to run directly in your environment, then connect your client to the provided endpoint. Two common usage modes are available: running via a helper runner to fetch the latest MCP package, or running the server directly with command-line flags to expose an HTTP transport.

How to install

Prerequisites: ensure you have a compatible Python environment and a tool to fetch MCP packages if you plan to run the helper runner.

# Run the helper runner to fetch the latest MCP package
uvx log-analyzer-mcp

# Or, install the MCP package locally and run the server directly
log-analyzer-mcp --transport http --port 8080

Configuration and running tips

Configure the MCP server environment by setting variables that control log sources, patterns, and context. You typically set variables in a shell environment or a .env file at your project root. The final start command may look like starting the server in HTTP mode on a port you choose.

# Example environment setup for a local run
export MCP_LOG_LEVEL=INFO
export PYTHONUNBUFFERED=1
export LOG_DIRECTORIES=["/var/log/myapp"]
export LOG_PATTERNS_ERROR=["ERROR|Exception"]

# Start the server
log-analyzer-mcp --transport http --port 8080

Using with a client like Cursor

In your Cursor configuration, you can fetch the MCP server via a helper runner and pass environment variables to customize behavior. The server can be started with a command similar to the one shown for dev/testing, ensuring the correct transport is configured for your client.

Troubleshooting tips

If the server fails to start, verify that the port is not in use, the Python environment is accessible, and required environment variables are set. Check that the MCP client can reach the server URL or socket and that any log directories you reference exist and are readable.

Available tools

analyze_tests

Summarize test logs and extract test-level insights to provide a concise overview of test results.

run_unit_test

Execute a targeted unit test with configurable verbosity and capture results for reporting.

create_coverage_report

Generate a code coverage report for analyzed code paths based on log data.

search_logs

Perform advanced log searching with options for all records, time-based ranges, or first/last N entries.