awslabs.cloudwatch-applicationsignals-mcp-server 0.1.21__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.
- awslabs/__init__.py +17 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/__init__.py +17 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/audit_presentation_utils.py +288 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/audit_utils.py +912 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/aws_clients.py +120 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/canary_utils.py +910 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-dotnet-enablement.md +435 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-java-enablement.md +321 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-nodejs-enablement.md +420 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ec2/ec2-python-enablement.md +598 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-dotnet-enablement.md +264 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-java-enablement.md +193 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-nodejs-enablement.md +198 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/ecs/ecs-python-enablement.md +236 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-dotnet-enablement.md +166 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-java-enablement.md +166 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-nodejs-enablement.md +166 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/eks/eks-python-enablement.md +169 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-dotnet-enablement.md +336 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-java-enablement.md +336 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-nodejs-enablement.md +336 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_guides/templates/lambda/lambda-python-enablement.md +336 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/enablement_tools.py +147 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/server.py +1505 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/service_audit_utils.py +231 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/service_tools.py +659 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/sli_report_client.py +333 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/slo_tools.py +386 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/trace_tools.py +784 -0
- awslabs/cloudwatch_applicationsignals_mcp_server/utils.py +172 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/METADATA +808 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/RECORD +36 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/WHEEL +4 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/entry_points.txt +2 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/licenses/LICENSE +174 -0
- awslabs_cloudwatch_applicationsignals_mcp_server-0.1.21.dist-info/licenses/NOTICE +2 -0
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
# Add caller suffix if MCP_RUN_FROM is set
|
|
32
|
+
mcp_source = os.environ.get('MCP_RUN_FROM')
|
|
33
|
+
user_agent_suffix = f'/{mcp_source}' if mcp_source else ''
|
|
34
|
+
|
|
35
|
+
config = Config(
|
|
36
|
+
user_agent_extra=f'awslabs.cloudwatch-applicationsignals-mcp-server/{__version__}{user_agent_suffix}'
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Get endpoint URLs from environment variables
|
|
40
|
+
applicationsignals_endpoint = os.environ.get('MCP_APPLICATIONSIGNALS_ENDPOINT')
|
|
41
|
+
logs_endpoint = os.environ.get('MCP_LOGS_ENDPOINT')
|
|
42
|
+
cloudwatch_endpoint = os.environ.get('MCP_CLOUDWATCH_ENDPOINT')
|
|
43
|
+
xray_endpoint = os.environ.get('MCP_XRAY_ENDPOINT')
|
|
44
|
+
synthetics_endpoint = os.environ.get('MCP_SYNTHETICS_ENDPOINT')
|
|
45
|
+
|
|
46
|
+
# Log endpoint overrides
|
|
47
|
+
if applicationsignals_endpoint:
|
|
48
|
+
logger.debug(f'Using Application Signals endpoint override: {applicationsignals_endpoint}')
|
|
49
|
+
if logs_endpoint:
|
|
50
|
+
logger.debug(f'Using CloudWatch Logs endpoint override: {logs_endpoint}')
|
|
51
|
+
if cloudwatch_endpoint:
|
|
52
|
+
logger.debug(f'Using CloudWatch endpoint override: {cloudwatch_endpoint}')
|
|
53
|
+
if xray_endpoint:
|
|
54
|
+
logger.debug(f'Using X-Ray endpoint override: {xray_endpoint}')
|
|
55
|
+
if synthetics_endpoint:
|
|
56
|
+
logger.debug(f'Using Synthetics endpoint override: {synthetics_endpoint}')
|
|
57
|
+
|
|
58
|
+
# Check for AWS_PROFILE environment variable
|
|
59
|
+
if aws_profile := os.environ.get('AWS_PROFILE'):
|
|
60
|
+
logger.debug(f'Using AWS profile: {aws_profile}')
|
|
61
|
+
session = boto3.Session(profile_name=aws_profile, region_name=AWS_REGION)
|
|
62
|
+
logs = session.client('logs', config=config, endpoint_url=logs_endpoint)
|
|
63
|
+
applicationsignals = session.client(
|
|
64
|
+
'application-signals',
|
|
65
|
+
region_name=AWS_REGION,
|
|
66
|
+
config=config,
|
|
67
|
+
endpoint_url=applicationsignals_endpoint,
|
|
68
|
+
)
|
|
69
|
+
cloudwatch = session.client('cloudwatch', config=config, endpoint_url=cloudwatch_endpoint)
|
|
70
|
+
xray = session.client('xray', config=config, endpoint_url=xray_endpoint)
|
|
71
|
+
synthetics = session.client('synthetics', config=config, endpoint_url=synthetics_endpoint)
|
|
72
|
+
s3 = session.client('s3', config=config)
|
|
73
|
+
iam = session.client('iam', config=config)
|
|
74
|
+
lambda_client = session.client('lambda', config=config)
|
|
75
|
+
sts = session.client('sts', config=config)
|
|
76
|
+
else:
|
|
77
|
+
logs = boto3.client(
|
|
78
|
+
'logs', region_name=AWS_REGION, config=config, endpoint_url=logs_endpoint
|
|
79
|
+
)
|
|
80
|
+
applicationsignals = boto3.client(
|
|
81
|
+
'application-signals',
|
|
82
|
+
region_name=AWS_REGION,
|
|
83
|
+
config=config,
|
|
84
|
+
endpoint_url=applicationsignals_endpoint,
|
|
85
|
+
)
|
|
86
|
+
cloudwatch = boto3.client(
|
|
87
|
+
'cloudwatch', region_name=AWS_REGION, config=config, endpoint_url=cloudwatch_endpoint
|
|
88
|
+
)
|
|
89
|
+
xray = boto3.client(
|
|
90
|
+
'xray', region_name=AWS_REGION, config=config, endpoint_url=xray_endpoint
|
|
91
|
+
)
|
|
92
|
+
# Additional clients for canary functionality
|
|
93
|
+
synthetics = boto3.client(
|
|
94
|
+
'synthetics', region_name=AWS_REGION, config=config, endpoint_url=synthetics_endpoint
|
|
95
|
+
)
|
|
96
|
+
s3 = boto3.client('s3', region_name=AWS_REGION, config=config)
|
|
97
|
+
iam = boto3.client('iam', region_name=AWS_REGION, config=config)
|
|
98
|
+
lambda_client = boto3.client('lambda', region_name=AWS_REGION, config=config)
|
|
99
|
+
sts = boto3.client('sts', region_name=AWS_REGION, config=config)
|
|
100
|
+
|
|
101
|
+
logger.debug('AWS clients initialized successfully')
|
|
102
|
+
return logs, applicationsignals, cloudwatch, xray, synthetics, s3, iam, lambda_client, sts
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# Initialize clients at module level
|
|
106
|
+
try:
|
|
107
|
+
(
|
|
108
|
+
logs_client,
|
|
109
|
+
applicationsignals_client,
|
|
110
|
+
cloudwatch_client,
|
|
111
|
+
xray_client,
|
|
112
|
+
synthetics_client,
|
|
113
|
+
s3_client,
|
|
114
|
+
iam_client,
|
|
115
|
+
lambda_client,
|
|
116
|
+
sts_client,
|
|
117
|
+
) = _initialize_aws_clients()
|
|
118
|
+
except Exception as e:
|
|
119
|
+
logger.error(f'Failed to initialize AWS clients: {str(e)}')
|
|
120
|
+
raise
|