awslabs.cloudwatch-appsignals-mcp-server 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. awslabs/cloudwatch_appsignals_mcp_server/__init__.py +1 -1
  2. awslabs/cloudwatch_appsignals_mcp_server/audit_presentation_utils.py +231 -0
  3. awslabs/cloudwatch_appsignals_mcp_server/audit_utils.py +699 -0
  4. awslabs/cloudwatch_appsignals_mcp_server/aws_clients.py +88 -0
  5. awslabs/cloudwatch_appsignals_mcp_server/server.py +675 -1220
  6. awslabs/cloudwatch_appsignals_mcp_server/service_audit_utils.py +231 -0
  7. awslabs/cloudwatch_appsignals_mcp_server/service_tools.py +659 -0
  8. awslabs/cloudwatch_appsignals_mcp_server/sli_report_client.py +5 -12
  9. awslabs/cloudwatch_appsignals_mcp_server/slo_tools.py +386 -0
  10. awslabs/cloudwatch_appsignals_mcp_server/trace_tools.py +658 -0
  11. awslabs/cloudwatch_appsignals_mcp_server/utils.py +172 -0
  12. awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info/METADATA +636 -0
  13. awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info/RECORD +18 -0
  14. awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info/METADATA +0 -350
  15. awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info/RECORD +0 -10
  16. {awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info → awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info}/WHEEL +0 -0
  17. {awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info → awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info}/entry_points.txt +0 -0
  18. {awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info → awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info}/licenses/LICENSE +0 -0
  19. {awslabs_cloudwatch_appsignals_mcp_server-0.1.7.dist-info → awslabs_cloudwatch_appsignals_mcp_server-0.1.9.dist-info}/licenses/NOTICE +0 -0
@@ -0,0 +1,88 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """CloudWatch Application Signals MCP Server - AWS client initialization."""
16
+
17
+ import boto3
18
+ import os
19
+ from . import __version__
20
+ from botocore.config import Config
21
+ from loguru import logger
22
+
23
+
24
+ # Get AWS region from environment variable or use default
25
+ AWS_REGION = os.environ.get('AWS_REGION', 'us-east-1')
26
+ logger.debug(f'Using AWS region: {AWS_REGION}')
27
+
28
+
29
+ def _initialize_aws_clients():
30
+ """Initialize AWS clients with proper configuration."""
31
+ config = Config(user_agent_extra=f'awslabs.cloudwatch-appsignals-mcp-server/{__version__}')
32
+
33
+ # Get endpoint URLs from environment variables
34
+ appsignals_endpoint = os.environ.get('MCP_APPSIGNALS_ENDPOINT')
35
+ logs_endpoint = os.environ.get('MCP_LOGS_ENDPOINT')
36
+ cloudwatch_endpoint = os.environ.get('MCP_CLOUDWATCH_ENDPOINT')
37
+ xray_endpoint = os.environ.get('MCP_XRAY_ENDPOINT')
38
+
39
+ # Log endpoint overrides
40
+ if appsignals_endpoint:
41
+ logger.debug(f'Using Application Signals endpoint override: {appsignals_endpoint}')
42
+ if logs_endpoint:
43
+ logger.debug(f'Using CloudWatch Logs endpoint override: {logs_endpoint}')
44
+ if cloudwatch_endpoint:
45
+ logger.debug(f'Using CloudWatch endpoint override: {cloudwatch_endpoint}')
46
+ if xray_endpoint:
47
+ logger.debug(f'Using X-Ray endpoint override: {xray_endpoint}')
48
+
49
+ # Check for AWS_PROFILE environment variable
50
+ if aws_profile := os.environ.get('AWS_PROFILE'):
51
+ logger.debug(f'Using AWS profile: {aws_profile}')
52
+ session = boto3.Session(profile_name=aws_profile, region_name=AWS_REGION)
53
+ logs = session.client('logs', config=config, endpoint_url=logs_endpoint)
54
+ appsignals = session.client(
55
+ 'application-signals',
56
+ region_name=AWS_REGION,
57
+ config=config,
58
+ endpoint_url=appsignals_endpoint,
59
+ )
60
+ cloudwatch = session.client('cloudwatch', config=config, endpoint_url=cloudwatch_endpoint)
61
+ xray = session.client('xray', config=config, endpoint_url=xray_endpoint)
62
+ else:
63
+ logs = boto3.client(
64
+ 'logs', region_name=AWS_REGION, config=config, endpoint_url=logs_endpoint
65
+ )
66
+ appsignals = boto3.client(
67
+ 'application-signals',
68
+ region_name=AWS_REGION,
69
+ config=config,
70
+ endpoint_url=appsignals_endpoint,
71
+ )
72
+ cloudwatch = boto3.client(
73
+ 'cloudwatch', region_name=AWS_REGION, config=config, endpoint_url=cloudwatch_endpoint
74
+ )
75
+ xray = boto3.client(
76
+ 'xray', region_name=AWS_REGION, config=config, endpoint_url=xray_endpoint
77
+ )
78
+
79
+ logger.debug('AWS clients initialized successfully')
80
+ return logs, appsignals, cloudwatch, xray
81
+
82
+
83
+ # Initialize clients at module level
84
+ try:
85
+ logs_client, appsignals_client, cloudwatch_client, xray_client = _initialize_aws_clients()
86
+ except Exception as e:
87
+ logger.error(f'Failed to initialize AWS clients: {str(e)}')
88
+ raise