Skip to main content
Glama

CloudWatch MCP Server

by CharlieFng
test_cloudwatch.py1.65 kB
#!/usr/bin/env python3 import logging import argparse import json from aws_cloudwatch import CloudWatchIntegration def setup_logging(verbose=False): """Configure logging based on verbosity level""" log_level = logging.DEBUG if verbose else logging.INFO logging.basicConfig( level=log_level, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) def main(): """Main function to test CloudWatch integration""" parser = argparse.ArgumentParser(description='Test AWS CloudWatch Integration') # Add command argument parser.add_argument('command', choices=['log-groups', 'alarms', 'saved-queries'], help='Command to execute') # Add optional arguments parser.add_argument('--profile', default='default', help='AWS profile name (default: default)') parser.add_argument('-v', '--verbose', action='store_true', help='Enable verbose logging') args = parser.parse_args() # Setup logging setup_logging(args.verbose) # Initialize CloudWatch integration cw = CloudWatchIntegration(profile_name=args.profile) # Process commands if args.command == 'log-groups': log_groups = cw.get_log_groups() print(json.dumps(log_groups, indent=2)) elif args.command == 'alarms': alarms = cw.get_formatted_alarms() print(json.dumps(alarms, indent=2)) elif args.command == 'saved-queries': saved_queries = cw.get_saved_queries() print(json.dumps(saved_queries, indent=2)) if __name__ == '__main__': main()

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/CharlieFng/cloudwatch-mcp'

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