awslabs.cdk-mcp-server 0.0.71717__tar.gz → 0.0.81650__tar.gz
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_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/PKG-INFO +10 -3
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/README.md +9 -2
- awslabs_cdk_mcp_server-0.0.81650/awslabs/__init__.py +10 -0
- awslabs_cdk_mcp_server-0.0.81650/awslabs/cdk_mcp_server/__init__.py +18 -0
- awslabs_cdk_mcp_server-0.0.81650/awslabs/cdk_mcp_server/core/__init__.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/core/resources.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/core/search_utils.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/core/server.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/core/tools.py +43 -0
- awslabs_cdk_mcp_server-0.0.81650/awslabs/cdk_mcp_server/data/__init__.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/cdk_nag_parser.py +12 -1
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/construct_descriptions.py +11 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/genai_cdk_loader.py +16 -5
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/lambda_powertools_loader.py +12 -1
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/schema_generator.py +30 -11
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/data/solutions_constructs_parser.py +11 -0
- awslabs_cdk_mcp_server-0.0.81650/awslabs/cdk_mcp_server/server.py +18 -0
- awslabs_cdk_mcp_server-0.0.81650/awslabs/cdk_mcp_server/static/__init__.py +19 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/pyproject.toml +1 -1
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/uv.lock +1 -1
- awslabs_cdk_mcp_server-0.0.71717/awslabs/__init__.py +0 -2
- awslabs_cdk_mcp_server-0.0.71717/awslabs/cdk_mcp_server/__init__.py +0 -8
- awslabs_cdk_mcp_server-0.0.71717/awslabs/cdk_mcp_server/core/__init__.py +0 -1
- awslabs_cdk_mcp_server-0.0.71717/awslabs/cdk_mcp_server/data/__init__.py +0 -1
- awslabs_cdk_mcp_server-0.0.71717/awslabs/cdk_mcp_server/server.py +0 -7
- awslabs_cdk_mcp_server-0.0.71717/awslabs/cdk_mcp_server/static/__init__.py +0 -9
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/.gitignore +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/.pre-commit-config.yaml +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/.python-version +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/CHANGELOG.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/CDK_GENERAL_GUIDANCE.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/CDK_NAG_GUIDANCE.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/actiongroups.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/alias.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/collaboration.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/creation.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/custom_orchestration.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/overview.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/prompt_override.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/bedrockguardrails.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/chunking.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/datasources.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/kendra.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/overview.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/parsing.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/transformation.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/aurora.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/creation.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/opensearch.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/pinecone.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/bedrock/profiles.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/opensearch-vectorindex/overview.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/genai_cdk/opensearchserverless/overview.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/bedrock.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/cdk.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/dependencies.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/index.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/insights.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/logging.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/metrics.md +0 -0
- {awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/awslabs/cdk_mcp_server/static/lambda_powertools/tracing.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: awslabs.cdk-mcp-server
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.81650
|
|
4
4
|
Summary: An AWS CDK MCP server that provides guidance on AWS Cloud Development Kit best practices, infrastructure as code patterns, and security compliance with CDK Nag. This server offers tools to validate infrastructure designs, explain CDK Nag rules, analyze suppressions, generate Bedrock Agent schemas, and discover Solutions Constructs patterns.
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: aws-lambda-powertools>=2.30.0
|
|
@@ -41,10 +41,16 @@ MCP server for AWS Cloud Development Kit (CDK) best practices, infrastructure as
|
|
|
41
41
|
|
|
42
42
|
### Amazon Bedrock Agent Schema Generation
|
|
43
43
|
|
|
44
|
-
-
|
|
44
|
+
- Use this tool when creating Bedrock Agents with Action Groups that use Lambda functions
|
|
45
45
|
- Streamline the creation of Bedrock Agent schemas
|
|
46
46
|
- Convert code files to compatible OpenAPI specifications
|
|
47
47
|
|
|
48
|
+
#### Developer Notes
|
|
49
|
+
|
|
50
|
+
- **Requirements**: Your Lambda function must use `BedrockAgentResolver` from AWS Lambda Powertools
|
|
51
|
+
- **Lambda Dependencies**: If schema generation fails, a fallback script will be generated. If you see error messages about missing dependencies, install them and then run the script again.
|
|
52
|
+
- **Integration**: Use the generated schema with `bedrock.ApiSchema.fromLocalAsset()` in your CDK code
|
|
53
|
+
|
|
48
54
|
## CDK Implementation Workflow
|
|
49
55
|
|
|
50
56
|
This diagram provides a comprehensive view of the recommended CDK implementation workflow:
|
|
@@ -69,7 +75,8 @@ graph TD
|
|
|
69
75
|
BA --> BS["GenerateBedrockAgentSchema"]
|
|
70
76
|
BS -->|"Success"| JSON["openapi.json created"]
|
|
71
77
|
BS -->|"Import Errors"| BSF["Tool generates<br/>generate_schema.py"]
|
|
72
|
-
BSF
|
|
78
|
+
BSF -->|"Missing dependencies?"| InstallDeps["Install dependencies"]
|
|
79
|
+
InstallDeps --> BSR["Run script manually:<br/>python generate_schema.py"]
|
|
73
80
|
BSR --> JSON["openapi.json created"]
|
|
74
81
|
|
|
75
82
|
%% Use schema in Agent CDK
|
|
@@ -30,10 +30,16 @@ MCP server for AWS Cloud Development Kit (CDK) best practices, infrastructure as
|
|
|
30
30
|
|
|
31
31
|
### Amazon Bedrock Agent Schema Generation
|
|
32
32
|
|
|
33
|
-
-
|
|
33
|
+
- Use this tool when creating Bedrock Agents with Action Groups that use Lambda functions
|
|
34
34
|
- Streamline the creation of Bedrock Agent schemas
|
|
35
35
|
- Convert code files to compatible OpenAPI specifications
|
|
36
36
|
|
|
37
|
+
#### Developer Notes
|
|
38
|
+
|
|
39
|
+
- **Requirements**: Your Lambda function must use `BedrockAgentResolver` from AWS Lambda Powertools
|
|
40
|
+
- **Lambda Dependencies**: If schema generation fails, a fallback script will be generated. If you see error messages about missing dependencies, install them and then run the script again.
|
|
41
|
+
- **Integration**: Use the generated schema with `bedrock.ApiSchema.fromLocalAsset()` in your CDK code
|
|
42
|
+
|
|
37
43
|
## CDK Implementation Workflow
|
|
38
44
|
|
|
39
45
|
This diagram provides a comprehensive view of the recommended CDK implementation workflow:
|
|
@@ -58,7 +64,8 @@ graph TD
|
|
|
58
64
|
BA --> BS["GenerateBedrockAgentSchema"]
|
|
59
65
|
BS -->|"Success"| JSON["openapi.json created"]
|
|
60
66
|
BS -->|"Import Errors"| BSF["Tool generates<br/>generate_schema.py"]
|
|
61
|
-
BSF
|
|
67
|
+
BSF -->|"Missing dependencies?"| InstallDeps["Install dependencies"]
|
|
68
|
+
InstallDeps --> BSR["Run script manually:<br/>python generate_schema.py"]
|
|
62
69
|
BSR --> JSON["openapi.json created"]
|
|
63
70
|
|
|
64
71
|
%% Use schema in Agent CDK
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
"""AWS CDK MCP server package."""
|
|
12
|
+
|
|
13
|
+
# Import the minimal set of essential functions
|
|
14
|
+
from awslabs.cdk_mcp_server.core.server import main, mcp
|
|
15
|
+
|
|
16
|
+
__all__ = ['main', 'mcp']
|
|
17
|
+
|
|
18
|
+
__version__ = '0.0.0'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
"""Core modules for the AWS CDK MCP server."""
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""AWS CDK MCP resource handlers."""
|
|
2
13
|
|
|
3
14
|
import logging
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""Common search utilities for AWS CDK MCP Server."""
|
|
2
13
|
|
|
3
14
|
import re
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""AWS CDK MCP server implementation."""
|
|
2
13
|
|
|
3
14
|
import argparse
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""AWS CDK MCP tool handlers."""
|
|
2
13
|
|
|
3
14
|
import logging
|
|
@@ -230,6 +241,38 @@ async def bedrock_schema_generator_from_file(
|
|
|
230
241
|
output_path=output_path,
|
|
231
242
|
)
|
|
232
243
|
|
|
244
|
+
# Add comprehensive next steps for successful schema generation
|
|
245
|
+
if result.get('status') == 'success':
|
|
246
|
+
output_filename = os.path.basename(output_path)
|
|
247
|
+
output_dir = os.path.dirname(output_path)
|
|
248
|
+
lambda_dir = os.path.dirname(os.path.abspath(lambda_code_path))
|
|
249
|
+
lambda_name = os.path.basename(os.path.dirname(lambda_code_path))
|
|
250
|
+
|
|
251
|
+
# Create a more comprehensive integration example
|
|
252
|
+
result['next_steps'] = {
|
|
253
|
+
'success_message': f'Schema successfully generated and saved to {output_path}',
|
|
254
|
+
'integration_steps': [
|
|
255
|
+
'1. Ensure your Lambda function has the right permissions:',
|
|
256
|
+
' - Add bedrock.amazonaws.com as a principal in permissions',
|
|
257
|
+
' - Include Lambda Powertools and Pydantic as layers',
|
|
258
|
+
'2. Add the ActionGroup to your Bedrock Agent:',
|
|
259
|
+
' - Create an action group with your Lambda as the executor',
|
|
260
|
+
' - Use the generated schema with ApiSchema.fromLocalAsset()',
|
|
261
|
+
'3. Deploy your CDK stack',
|
|
262
|
+
],
|
|
263
|
+
'cdk_example': [
|
|
264
|
+
'// Add the Action Group to your agent',
|
|
265
|
+
'agent.addActionGroup(new bedrock.AgentActionGroup({',
|
|
266
|
+
f" name: '{lambda_name}-action-group',",
|
|
267
|
+
f" description: 'Action group for {lambda_name}',",
|
|
268
|
+
' executor: bedrock.ActionGroupExecutor.fromlambdaFunction(yourLambdaFunction),',
|
|
269
|
+
' apiSchema: bedrock.ApiSchema.fromLocalAsset(',
|
|
270
|
+
f" path.join(__dirname, '{os.path.relpath(output_dir, lambda_dir)}', '{output_filename}')",
|
|
271
|
+
' )',
|
|
272
|
+
'}));',
|
|
273
|
+
],
|
|
274
|
+
}
|
|
275
|
+
|
|
233
276
|
# If fallback script was generated, save it to a file instead of returning it in the response
|
|
234
277
|
if result.get('status') == 'error' and result.get('fallback_script'):
|
|
235
278
|
# Save the script to a file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
"""Data modules for the AWS CDK MCP server."""
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""CDK Nag rules parsing utilities."""
|
|
2
13
|
|
|
3
14
|
import httpx
|
|
@@ -271,7 +282,7 @@ def check_cdk_nag_suppressions(
|
|
|
271
282
|
# If file_path is provided, read the file content
|
|
272
283
|
if file_path is not None:
|
|
273
284
|
try:
|
|
274
|
-
with open(file_path, 'r') as f:
|
|
285
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
275
286
|
code = f.read()
|
|
276
287
|
except Exception as e:
|
|
277
288
|
return {'error': f'Failed to read file: {str(e)}', 'status': 'error'}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""GenAI CDK construct descriptions."""
|
|
2
13
|
|
|
3
14
|
from typing import Dict
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""GenAI CDK constructs static content loader."""
|
|
2
13
|
|
|
3
14
|
import logging
|
|
@@ -60,7 +71,7 @@ def get_genai_cdk_overview(construct_type: str = '') -> str:
|
|
|
60
71
|
'overview.md',
|
|
61
72
|
)
|
|
62
73
|
try:
|
|
63
|
-
with open(file_path, 'r') as f:
|
|
74
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
64
75
|
return f.read()
|
|
65
76
|
except FileNotFoundError:
|
|
66
77
|
return f"Error: Overview file for '{construct_type}' not found."
|
|
@@ -173,7 +184,7 @@ def get_genai_cdk_construct_section(construct_type: str, construct_name: str, se
|
|
|
173
184
|
)
|
|
174
185
|
|
|
175
186
|
try:
|
|
176
|
-
with open(file_path, 'r') as f:
|
|
187
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
177
188
|
return f.read()
|
|
178
189
|
except FileNotFoundError:
|
|
179
190
|
return (
|
|
@@ -296,7 +307,7 @@ def get_genai_cdk_construct(construct_type: str, construct_name: str) -> str:
|
|
|
296
307
|
f'{construct_name_lower}.md',
|
|
297
308
|
)
|
|
298
309
|
try:
|
|
299
|
-
with open(file_path, 'r') as f:
|
|
310
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
300
311
|
return f.read()
|
|
301
312
|
except FileNotFoundError:
|
|
302
313
|
# Try to see if this is a directory with an overview.md file
|
|
@@ -309,7 +320,7 @@ def get_genai_cdk_construct(construct_type: str, construct_name: str) -> str:
|
|
|
309
320
|
'overview.md',
|
|
310
321
|
)
|
|
311
322
|
try:
|
|
312
|
-
with open(overview_path, 'r') as f:
|
|
323
|
+
with open(overview_path, 'r', encoding='utf-8') as f:
|
|
313
324
|
return f.read()
|
|
314
325
|
except FileNotFoundError:
|
|
315
326
|
return f"Error: Documentation for '{construct_name}' in '{construct_type}' not found."
|
|
@@ -408,7 +419,7 @@ def process_directory_files(
|
|
|
408
419
|
# If no fixed description, fall back to current behavior
|
|
409
420
|
if not description:
|
|
410
421
|
try:
|
|
411
|
-
with open(file_path, 'r') as f:
|
|
422
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
412
423
|
first_line = f.readline().strip()
|
|
413
424
|
description = (
|
|
414
425
|
first_line[1:].strip() if first_line.startswith('#') else display_name
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""Lambda Powertools guidance loader module."""
|
|
2
13
|
|
|
3
14
|
import os
|
|
@@ -40,7 +51,7 @@ def get_lambda_powertools_section(topic: str = '') -> str:
|
|
|
40
51
|
) # Go up from 'data' to get to the package root
|
|
41
52
|
file_path = os.path.join(base_dir, 'static', 'lambda_powertools', f'{topic.lower()}.md')
|
|
42
53
|
try:
|
|
43
|
-
with open(file_path, 'r') as f:
|
|
54
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
44
55
|
return f.read()
|
|
45
56
|
except FileNotFoundError:
|
|
46
57
|
return f"Error: File for topic '{topic}' not found. (Looking in: {file_path})"
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""Schema generator for Bedrock Agent Action Groups."""
|
|
2
13
|
|
|
3
14
|
import importlib.util
|
|
@@ -74,7 +85,7 @@ def main():
|
|
|
74
85
|
# Example of creating a simplified version:
|
|
75
86
|
simplified_path = os.path.join(lambda_dir, f"{{module_name}}_simplified.py")
|
|
76
87
|
try:
|
|
77
|
-
with open(LAMBDA_FILE_PATH, 'r') as f:
|
|
88
|
+
with open(LAMBDA_FILE_PATH, 'r', encoding='utf-8') as f:
|
|
78
89
|
content = f.read()
|
|
79
90
|
|
|
80
91
|
# Comment out problematic imports (add more as needed)
|
|
@@ -93,7 +104,7 @@ def main():
|
|
|
93
104
|
|
|
94
105
|
simplified_content = '\\n'.join(lines)
|
|
95
106
|
|
|
96
|
-
with open(simplified_path, 'w') as f:
|
|
107
|
+
with open(simplified_path, 'w', encoding='utf-8') as f:
|
|
97
108
|
f.write(simplified_content)
|
|
98
109
|
|
|
99
110
|
print("Created simplified version with problematic imports commented out")
|
|
@@ -121,12 +132,13 @@ def main():
|
|
|
121
132
|
|
|
122
133
|
# Generate the OpenAPI schema
|
|
123
134
|
print("Generating OpenAPI schema...")
|
|
135
|
+
# Note: This might show a UserWarning about Pydantic v2 and OpenAPI versions
|
|
124
136
|
openapi_schema = json.loads(app.get_openapi_json_schema(openapi_version="3.0.0"))
|
|
125
137
|
|
|
126
138
|
# Fix Pydantic v2 issue (forcing OpenAPI 3.0.0)
|
|
127
139
|
if openapi_schema.get("openapi") != "3.0.0":
|
|
128
140
|
openapi_schema["openapi"] = "3.0.0"
|
|
129
|
-
print("
|
|
141
|
+
print("Note: Adjusted OpenAPI version for compatibility with Bedrock Agents")
|
|
130
142
|
|
|
131
143
|
# Fix operationIds
|
|
132
144
|
for path in openapi_schema['paths']:
|
|
@@ -154,16 +166,23 @@ def main():
|
|
|
154
166
|
os.makedirs(os.path.dirname(os.path.abspath(OUTPUT_PATH)), exist_ok=True)
|
|
155
167
|
|
|
156
168
|
# Save the schema to the output path
|
|
157
|
-
with open(OUTPUT_PATH, 'w') as f:
|
|
169
|
+
with open(OUTPUT_PATH, 'w', encoding='utf-8') as f:
|
|
158
170
|
json.dump(openapi_schema, f, indent=2)
|
|
159
171
|
|
|
160
172
|
print(f"Schema successfully generated and saved to {{OUTPUT_PATH}}")
|
|
173
|
+
print("Next steps: Use this schema in your CDK code with bedrock.ApiSchema.fromLocalAsset()")
|
|
161
174
|
return True
|
|
162
175
|
|
|
163
176
|
except Exception as simplified_error:
|
|
164
177
|
print(f"Error with simplified version: {{str(simplified_error)}}")
|
|
165
|
-
|
|
166
|
-
|
|
178
|
+
if "No module named" in str(simplified_error):
|
|
179
|
+
missing_dep = str(simplified_error).split("'")[-2] if "'" in str(simplified_error) else str(simplified_error).split("No module named ")[-1].strip()
|
|
180
|
+
print("To resolve this error, install the missing dependency:")
|
|
181
|
+
print(" pip install " + missing_dep.replace('_', '-'))
|
|
182
|
+
print("Then run this script again.")
|
|
183
|
+
else:
|
|
184
|
+
print("You may need to manually modify the script to handle this error.")
|
|
185
|
+
print("Focus on preserving the BedrockAgentResolver app definition and routes.")
|
|
167
186
|
return False
|
|
168
187
|
|
|
169
188
|
except Exception as e:
|
|
@@ -199,7 +218,7 @@ def main():
|
|
|
199
218
|
os.makedirs(os.path.dirname(os.path.abspath(OUTPUT_PATH)), exist_ok=True)
|
|
200
219
|
|
|
201
220
|
# Save the schema to the output path
|
|
202
|
-
with open(OUTPUT_PATH, 'w') as f:
|
|
221
|
+
with open(OUTPUT_PATH, 'w', encoding='utf-8') as f:
|
|
203
222
|
json.dump(openapi_schema, f, indent=2)
|
|
204
223
|
|
|
205
224
|
print(f"Schema successfully generated and saved to {{OUTPUT_PATH}}")
|
|
@@ -422,7 +441,7 @@ def generate_bedrock_schema_from_file(
|
|
|
422
441
|
os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True)
|
|
423
442
|
|
|
424
443
|
# Save the schema to the output path
|
|
425
|
-
with open(output_path, 'w') as f:
|
|
444
|
+
with open(output_path, 'w', encoding='utf-8') as f:
|
|
426
445
|
json.dump(openapi_schema, f, indent=2)
|
|
427
446
|
|
|
428
447
|
result['schema'] = openapi_schema
|
|
@@ -441,7 +460,7 @@ def generate_bedrock_schema_from_file(
|
|
|
441
460
|
simplified_path = os.path.join(lambda_dir, f'{module_name}_simplified.py')
|
|
442
461
|
|
|
443
462
|
try:
|
|
444
|
-
with open(lambda_code_path, 'r') as f:
|
|
463
|
+
with open(lambda_code_path, 'r', encoding='utf-8') as f:
|
|
445
464
|
content = f.read()
|
|
446
465
|
|
|
447
466
|
# Define problematic packages
|
|
@@ -475,7 +494,7 @@ def generate_bedrock_schema_from_file(
|
|
|
475
494
|
result['process']['simplified_version']['modifications'] = modifications
|
|
476
495
|
|
|
477
496
|
# Write simplified file
|
|
478
|
-
with open(simplified_path, 'w') as f:
|
|
497
|
+
with open(simplified_path, 'w', encoding='utf-8') as f:
|
|
479
498
|
f.write(simplified_content)
|
|
480
499
|
|
|
481
500
|
try:
|
|
@@ -517,7 +536,7 @@ def generate_bedrock_schema_from_file(
|
|
|
517
536
|
os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True)
|
|
518
537
|
|
|
519
538
|
# Save the schema to the output path
|
|
520
|
-
with open(output_path, 'w') as f:
|
|
539
|
+
with open(output_path, 'w', encoding='utf-8') as f:
|
|
521
540
|
json.dump(openapi_schema, f, indent=2)
|
|
522
541
|
|
|
523
542
|
result['schema'] = openapi_schema
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
1
12
|
"""AWS Solutions Constructs patterns parser module."""
|
|
2
13
|
|
|
3
14
|
import httpx
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
|
|
12
|
+
"""AWS CDK MCP server implementation."""
|
|
13
|
+
|
|
14
|
+
from awslabs.cdk_mcp_server.core.server import main
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if __name__ == '__main__':
|
|
18
|
+
main()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
4
|
+
# with the License. A copy of the License is located at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
9
|
+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
10
|
+
# and limitations under the License.
|
|
11
|
+
from importlib import resources
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
with (
|
|
15
|
+
resources.files('awslabs.cdk_mcp_server.static')
|
|
16
|
+
.joinpath('CDK_GENERAL_GUIDANCE.md')
|
|
17
|
+
.open('r', encoding='utf-8') as f
|
|
18
|
+
):
|
|
19
|
+
CDK_GENERAL_GUIDANCE = f.read()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "awslabs.cdk-mcp-server"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.081650"
|
|
4
4
|
description = "An AWS CDK MCP server that provides guidance on AWS Cloud Development Kit best practices, infrastructure as code patterns, and security compliance with CDK Nag. This server offers tools to validate infrastructure designs, explain CDK Nag rules, analyze suppressions, generate Bedrock Agent schemas, and discover Solutions Constructs patterns."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Core modules for the AWS CDK MCP server."""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Data modules for the AWS CDK MCP server."""
|
|
File without changes
|
{awslabs_cdk_mcp_server-0.0.71717 → awslabs_cdk_mcp_server-0.0.81650}/.pre-commit-config.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|