
CloudWatch MCP Server
A simplified MCP server that provides a streamlined way to interact with AWS CloudWatch resources (log groups, log queries, and alarms) through the MCP protocol.
README
CloudWatch MCP Server
This simplified MCP server provides a streamlined way to interact with AWS CloudWatch resources through the MCP protocol. It exposes CloudWatch log groups, log queries, and alarms as resources and tools.
Features
- List all CloudWatch log groups with their metadata
- List all CloudWatch alarms with their current states
- Query CloudWatch logs using CloudWatch Insights across multiple log groups
- Discover available fields across multiple log groups with shared schema
- Automatic JSON parsing for @message field in log queries
- Check if specific log groups exist
- Get detailed information about specific log groups
- Filter alarms by state (all alarms or only those in ALARM state)
- Retrieve all saved CloudWatch Logs Insights queries
Prerequisites
- Python 3.12 or higher
- AWS credentials configured (via environment variables, AWS CLI, or IAM role)
- MCP CLI (version 0.1.1 or higher)
- Boto3 (AWS SDK for Python)
Setup
-
Make sure you have Python 3.12+ installed.
-
Create a virtual environment (optional but recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure AWS credentials if you haven't already:
aws configure
Or set environment variables:
export AWS_ACCESS_KEY_ID="your-access-key" export AWS_SECRET_ACCESS_KEY="your-secret-key" export AWS_REGION="your-region"
Project Structure
cloudwatch_server.py
- MCP server implementation for CloudWatch integrationaws_cloudwatch.py
- Simplified AWS CloudWatch integration moduletest_cloudwatch.py
- Command-line utility to test the CloudWatch integration
Running the server
Start the MCP server:
python cloudwatch_server.py
Or using the MCP CLI:
mcp run cloudwatch_server.py
Using the MCP server
Resources
The server exposes the following resources:
cloudwatch://log-groups
- Lists all CloudWatch log groupscloudwatch://log-groups/{log_group_name}
- Gets detailed information about a specific log groupcloudwatch://alarms
- Lists all CloudWatch alarmscloudwatch://alarms/in-alarm
- Lists only CloudWatch alarms currently in ALARM statecloudwatch://saved-queries
- Lists all saved CloudWatch Logs Insights queries
Tools
The server provides the following tools:
-
query_logs
- Query CloudWatch logs using CloudWatch Insights- Parameters:
log_group_names
: Single log group name or list of log group names to queryquery_string
: CloudWatch Insights query stringstart_time
: (Optional) Start time for the query in Unix timestamp millisecondsend_time
: (Optional) End time for the query in Unix timestamp milliseconds
- Features:
- Automatically parses JSON in @message field
- Returns structured data for JSON messages
- Handles multiple log groups in a single query
- Parameters:
-
discover_log_fields
- Discover available fields across multiple log groups- Parameters:
log_group_names
: Single log group name or list of log group names to analyze
- Features:
- Efficiently discovers fields across multiple log groups
- Assumes shared schema across log groups
- Detects nested JSON fields in @message
- Identifies field types (number, boolean, string, array)
- Parameters:
-
log_group_exists
- Check if CloudWatch log groups exist- Parameters:
log_group_names
: Single log group name or list of log group names to check
- Returns:
- Dictionary mapping each log group to its existence status
- Parameters:
-
get_saved_queries
- Fetch all saved CloudWatch Logs Insights queries- No parameters required
Testing the CloudWatch integration
You can test the CloudWatch integration directly using the provided test script:
# Make the test file executable
chmod +x test_cloudwatch.py
# List all log groups
./test_cloudwatch.py log-groups
# List all alarms
./test_cloudwatch.py alarms
# Use a specific AWS profile
./test_cloudwatch.py log-groups --profile my-profile
# Enable verbose logging
./test_cloudwatch.py alarms -v
Examples with MCP CLI
Using the MCP CLI:
# List all log groups
mcp inspect cloudwatch://log-groups
# Get details about a specific log group
mcp inspect cloudwatch://log-groups/my-log-group-name
# List all alarms
mcp inspect cloudwatch://alarms
# List alarms currently in ALARM state
mcp inspect cloudwatch://alarms/in-alarm
# List all saved CloudWatch Logs Insights queries
mcp inspect cloudwatch://saved-queries
# Query logs from multiple log groups using CloudWatch Insights
mcp call query_logs --log_group_names '["log-group-1", "log-group-2"]' --query_string "fields @timestamp, @message | limit 10"
# Query logs from a single log group (still supported)
mcp call query_logs --log_group_names "my-log-group" --query_string "fields @timestamp, @message | limit 10"
# Discover fields across multiple log groups
mcp call discover_log_fields --log_group_names '["log-group-1", "log-group-2"]'
# Check if multiple log groups exist
mcp call log_group_exists --log_group_names '["log-group-1", "log-group-2"]'
# Get all saved CloudWatch Logs Insights queries
mcp call get_saved_queries
License
MIT
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。