home / mcp / cloudwatch mcp server
Provides CloudWatch log groups, alarms, and Logs Insights queries via MCP for easy access
Configuration
View docs{
"mcpServers": {
"charliefng-cloudwatch-mcp": {
"command": "python",
"args": [
"cloudwatch_server.py"
],
"env": {
"AWS_REGION": "us-west-2",
"AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY",
"AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_KEY"
}
}
}
}You can use the CloudWatch MCP Server to interact with AWS CloudWatch resources through the MCP protocol. It exposes log groups, alarms, and Logs Insights queries as accessible resources and tools, letting you list, inspect, and query CloudWatch data from a local MCP client or from an MCP-based workflow.
To use this MCP server, run it from your environment and connect with an MCP client. You can inspect resources such as log groups and alarms, and you can run queries across multiple log groups using CloudWatch Logs Insights. Use the provided tools to discover available fields, check whether specific log groups exist, and fetch saved queries. The server is designed to parse JSON messages in log data automatically and to present structured results that are easy to consume in MCP-enabled tooling.
Prerequisites and setup are as follows. Install Python 3.12 or higher, ensure AWS credentials are configured, and have the MCP CLI available (version 0.1.1 or higher). Then you can run the server directly or via the MCP CLI.
Step-by-step commands you will use:
Run the server directly with Python or via the MCP CLI. The server exposes resources for CloudWatch log groups, alarms, and saved queries, and provides tools to query logs, discover fields, check log group existence, and fetch saved queries. No additional configuration is required beyond your AWS credentials and network access to AWS services.
Start the MCP server using Python: python cloudwatch_server.py.
Start the MCP server using the MCP CLI: mcp run cloudwatch_server.py.
Ensure AWS credentials are accessible to the environment running the server. If you encounter permission errors, verify that your IAM user or role has the necessary CloudWatch permissions. If the server cannot reach AWS endpoints, confirm network access and region configuration.
query_logs — Query CloudWatch logs using CloudWatch Insights across one or more log groups. It automatically parses JSON in the @message field and returns structured data.
cloudwatch://log-groups — Lists all CloudWatch log groups.
You can test by listing resources or running queries through the MCP client. Use the provided test utilities to verify log groups, alarms, and saved queries.
Query CloudWatch logs using CloudWatch Insights across one or more log groups. Automatically parses JSON in the @message field and returns structured results.
Discover available fields across multiple log groups, assuming shared schema. Detects nested JSON fields in @message and identifies field types.
Check whether specified CloudWatch log groups exist and return a map of existence per log group.
Fetch all saved CloudWatch Logs Insights queries with no parameters.