Skip to main content
Glama

CloudWatch Logs MCP Server

by serkanh

CloudWatch Logs MCP 服务器

一个 MCP(模型上下文协议)服务器,提供用于访问 AWS CloudWatch 日志的工具。该服务器允许 AI 助手列出日志组并从 AWS CloudWatch 读取日志条目。

可用工具

列表组

列出可用的 CloudWatch 日志组。

参数:

  • prefix (可选):日志组名称前缀
  • region (可选):AWS 区域
  • accessKeyId (可选):AWS 访问密钥 ID
  • secretAccessKey (可选):AWS 秘密访问密钥
  • sessionToken (可选):AWS 会话令牌

**返回:**带有日志组列表的 JSON 字符串,包括logGroupNamecreationTimestoredBytes

获取日志

从特定日志组获取 CloudWatch 日志。

参数:

  • logGroupName (必需):日志组的名称
  • logStreamName (可选):日志流的名称
  • startTime (可选):ISO 格式或相对时间的开始时间(例如“5m”、“1h”、“1d”)
  • endTime (可选):ISO 格式的结束时间
  • filterPattern (可选):日志的过滤模式
  • region (可选):AWS 区域
  • accessKeyId (可选):AWS 访问密钥 ID
  • secretAccessKey (可选):AWS 秘密访问密钥
  • sessionToken (可选):AWS 会话令牌

**返回:**带有日志事件的 JSON 字符串,包括timestampmessagelogStreamName

设置

AWS 凭证

确保已配置 AWS 凭证。您可以使用 AWS CLI 或通过设置环境变量来设置它们:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

与 Claude Desktop 一起使用

将以下内容添加到您的claude_desktop_config.json中:

{ "mcpServers": { "cloudwatch-logs": { "command": "python3", "args": ["/path/to/cloudwatch-logs-mcp/main.py"], "env": { "AWS_ACCESS_KEY_ID": "<YOUR_ACCESS_KEY_ID>", "AWS_SECRET_ACCESS_KEY": "<YOUR_SECRET_ACCESS_KEY>", }, "disabled": false, "autoApprove": [] } } }

Docker

如果您希望在 Docker 容器中运行服务器,则可以设置 Dockerfile 并使用以下配置:

{ "mcpServers": { "cloudwatch-logs": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "AWS_ACCESS_KEY_ID", "-e", "AWS_SECRET_ACCESS_KEY", "mcp/cloudwatch-logs" ], "env": { "AWS_ACCESS_KEY_ID": "<YOUR_ACCESS_KEY_ID>", "AWS_SECRET_ACCESS_KEY": "<YOUR_SECRET_ACCESS_KEY>", } } } }

实现细节

此服务器使用 MCP SDK 中的 FastMCP 类构建,该类提供了一种创建 MCP 服务器的简便方法。该服务器公开了两个主要工具:

  1. list_groups :列出可用的 CloudWatch 日志组
  2. get_logs :从特定日志组读取日志条目

每个工具都实现为一个用@mcp.tool()修饰的异步函数。服务器使用 boto3 库与 AWS CloudWatch Logs API 进行交互。

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

MCP 服务器允许 AI 助手通过列出日志组和读取日志条目来访问 AWS CloudWatch 日志。

  1. 可用工具
    1. 列表组
    2. 获取日志
  2. 设置
    1. AWS 凭证
    2. 与 Claude Desktop 一起使用
    3. Docker
  3. 实现细节
    1. 执照

      Related MCP Servers

      • Amazon Web Services
        aws-mcp

        A
        security
        F
        license
        A
        quality
        A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with your AWS environment. This allows for natural language querying and management of your AWS resources during conversations. Think of better Amazon Q alternative.
        Last updated -
        3
        264
        TypeScript
        • Apple
      • A
        security
        A
        license
        A
        quality
        An MCP server that lets AI assistants interact with your Lunchmoney data, enabling natural language queries about transactions, budgets, and spending patterns.
        Last updated -
        4
        3
        8
        TypeScript
        MIT License
      • A
        security
        A
        license
        A
        quality
        MCP-compatible server that enables AI assistants to interact with Lightdash analytics data, providing tools to list and retrieve projects, spaces, charts, dashboards, and metrics through a standardized interface.
        Last updated -
        13
        22
        17
        TypeScript
        MIT License
      • -
        security
        A
        license
        -
        quality
        A lightweight service that enables AI assistants to execute AWS CLI commands through the Model Context Protocol (MCP), allowing AI tools to retrieve AWS documentation and interact with AWS services.
        Last updated -
        57
        Python
        MIT License
        • Apple

      View all related MCP servers

      MCP directory API

      We provide all the information about MCP servers via our MCP API.

      curl -X GET 'https://glama.ai/api/mcp/v1/servers/serkanh/cloudwatch-logs-mcp'

      If you have feedback or need assistance with the MCP directory API, please join our Discord server