Log Analyzer with CloudWatch Logs MCP server

Provides structured access to CloudWatch Logs data for searching, analyzing, and correlating logs across AWS services to help with troubleshooting and pattern identification.
Back to servers
Provider
AWS
Release date
Apr 15, 2025
Language
Python
Stats
63 stars

Log Analyzer with MCP is a server implementation of the Model Context Protocol that enables AI assistants like Claude to access, search, and analyze AWS CloudWatch Logs. It provides tools for browsing log groups, running queries with CloudWatch Logs Insights syntax, generating summaries, and correlating logs across AWS services.

Prerequisites

Before installing the Log Analyzer, ensure you have:

  • The uv Python package and project manager
  • An AWS account with CloudWatch Logs
  • Properly configured AWS credentials

Installation

Follow these steps to install the Log Analyzer:

# Clone the repository
git clone https://github.com/awslabs/Log-Analyzer-with-MCP.git
cd Log-Analyzer-with-MCP

# Create a virtual environment and install dependencies
uv sync
source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`

Quick Start Guide

1. Configure AWS Credentials

Ensure your AWS credentials are properly configured. This allows the Log Analyzer to access your CloudWatch logs.

2. Update Claude Desktop Configuration

If you're using Claude for Desktop, update your claude_desktop_config.json file with the appropriate configuration for the Log Analyzer.

3. Start Using with Claude

Open Claude for Desktop and begin interacting with your CloudWatch logs. You can now ask Claude to:

  • Browse available log groups
  • Search for specific log events
  • Run CloudWatch Logs Insights queries
  • Generate summaries of log data
  • Identify error patterns
  • Correlate logs across multiple services

Usage Examples

Browsing Log Groups

You can ask Claude to list available CloudWatch Log Groups:

"Show me all available CloudWatch Log Groups"

Searching Logs

To search for specific logs, you can use:

"Find all error logs in the /aws/lambda/myFunction log group from the last 24 hours"

Running Insights Queries

Claude can execute CloudWatch Logs Insights queries:

"Run this query on the /aws/lambda/paymentProcessor log group:
fields @timestamp, @message
| filter @message like /Exception/
| sort @timestamp desc
| limit 20"

Analyzing Patterns

Ask Claude to identify patterns in your logs:

"Analyze the error patterns in my API Gateway logs from yesterday"

Correlating Events

To correlate events across services:

"Find correlated logs between my Lambda function and DynamoDB table during the outage period (2023-09-15T14:00:00 to 2023-09-15T15:30:00)"

Troubleshooting

If you encounter issues:

  • Verify your AWS credentials are configured correctly
  • Ensure you have the necessary permissions to access CloudWatch logs
  • Check that your Claude Desktop configuration is correct
  • Confirm the MCP server is running properly

For persistent problems, refer to the troubleshooting documentation or create an issue on the GitHub repository.

AI: Human, I've created a user-friendly markdown article focused specifically on installation and usage of the Log Analyzer with MCP. The article starts with a brief introduction, uses only H2 and H3 headings, and provides clear instructions with proper code block formatting. I've included practical examples showing how to interact with the tool through Claude. All development, contributing, and license information has been omitted to keep the focus on practical usage.

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later