Skip to main content

An AWS Labs Model Context Protocol (MCP) server for cloudwatch-logs

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

AWS Labs cloudwatch-logs MCP Server

An AWS Labs Model Context Protocol (MCP) server for cloudwatch-logs

Instructions

Use this MCP server to run read-only commands and analyze CloudWatchLogs. Supports discovering logs groups as well as running CloudWatch Log Insight Queries. With CloudWatch Logs Insights, you can interactively search and analyze your log data in Amazon CloudWatch Logs and perform queries to help you more efficiently and effectively respond to operational issues.

Features

  • Discovering log groups and metadata about them within your AWS account or accounts connected by CloudWatch Cross Account Observability
  • Converting human-readable questions and commands into CloudWatch Log Insight queries and executing them against the discovered log groups.

Prerequisites

  1. Install uv from Astral or the GitHub README
  2. Install Python using uv python install 3.10
  3. An AWS account with CloudWatch Log Groups
  4. This MCP server can only be run locally on the same host as your LLM client.
  5. Set up AWS credentials with access to AWS services
    • You need an AWS account with appropriate permissions
    • Configure AWS credentials with aws configure or environment variables

Available Tools

  • describe_log_groups - Describe log groups in the account and region, including user saved queries applicable to them. Supports Cross Account Observability.
  • analyze_log_group - Analyzes a CloudWatch log group for anomalies, top message patterns, and top error patterns within a specified time window. Log group must have at least one CloudWatch Log Anomaly Detector configured to search for anomalies.
  • execute_log_insights_query - Execute a Log Insights query against one or more log groups. Will wait for the query to complete for a configurable timeout.
  • get_query_results - Get the results of a query previously started by execute_log_insights_query.
  • cancel_query - Cancel an ongoing query that was previously started by execute_log_insights_query.

Required IAM Permissions

  • logs:Describe*
  • logs:Get*
  • logs:List*
  • logs:StartQuery
  • logs:StopQuery

Installation

Example for Amazon Q Developer CLI (~/.aws/amazonq/mcp.json):

{
  "mcpServers": {
    "awslabs.cloudwatch-logs-mcp-server": {
      "autoApprove": [],
      "disabled": false,
      "timeout": 60,
      "command": "uvx",
      "args": [
        "awslabs.cloudwatch-logs-mcp-server@latest",
      ],
      "env": {
        "AWS_PROFILE": "[The AWS Profile Name to use for AWS access]",
        "AWS_REGION": "[The AWS region to run in]",
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "transportType": "stdio"
    }
  }
}

Build and install docker image locally on the same host of your LLM client

  1. git clone https://github.com/awslabs/mcp.git
  2. Go to sub-directory 'src/cloudwatch-logs-mcp-server/'
  3. Run 'docker build -t awslabs/cloudwatch-logs-mcp-server:latest .'

Add or update your LLM client's config with following:

{
  "mcpServers": {
    "awslabs.cloudwatch-logs-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "AWS_PROFILE=[your data]",
        "-e", "AWS_REGION=[your data]",
        "awslabs/cloudwatch-logs-mcp-server:latest"
      ]
    }
  }
}

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md in the monorepo root for guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awslabs_cloudwatch_logs_mcp_server-0.0.2.tar.gz (79.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file awslabs_cloudwatch_logs_mcp_server-0.0.2.tar.gz.

File metadata

File hashes

Hashes for awslabs_cloudwatch_logs_mcp_server-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6426e646f9e831cc96196cec2bd836888d55614c83be83e469583617e27a6f26
MD5 86bce0b6ee79ba98c0c38fd72c9fdad4
BLAKE2b-256 7c4ae07e788d3e3dabb945d7ac3c93f2e52e645c802beade4656ad3186fd38ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_cloudwatch_logs_mcp_server-0.0.2.tar.gz:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file awslabs_cloudwatch_logs_mcp_server-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for awslabs_cloudwatch_logs_mcp_server-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1b4eb5bd0be421148a50c86cfda2e2b6dc860c29666a9b69b839b189f0020ca5
MD5 88d041b65011501c10070f074236b2a3
BLAKE2b-256 a0f30b79535a38063e9e370063406cbf8ba346f1a96a00a22e3ac207f0240ab1

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_cloudwatch_logs_mcp_server-0.0.2-py3-none-any.whl:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page