awslabs.cfn-mcp-server 1.0.3__py3-none-any.whl → 1.0.5__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 CHANGED
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  # This file is part of the awslabs namespace.
13
16
  # It is intentionally minimal to support PEP 420 namespace packages.
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  """awslabs.cfn-mcp-server"""
13
16
 
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  import botocore.config
13
16
  import sys
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  from awslabs.cfn_mcp_server.errors import ClientError
13
16
 
@@ -33,19 +36,18 @@ def validate_patch(patch_document: list):
33
36
  raise ClientError(f"The '{patch_op['op']}' operation requires a 'from' field")
34
37
 
35
38
 
36
- def progress_event(response_event) -> dict[str, str]:
39
+ def progress_event(response_event, hooks_events) -> dict[str, str]:
37
40
  """Map a CloudControl API response to a standard output format for the MCP."""
38
41
  response = {
39
42
  'status': response_event['OperationStatus'],
40
43
  'resource_type': response_event['TypeName'],
41
- 'is_complete': response_event['OperationStatus'] == 'SUCCESS',
44
+ 'is_complete': response_event['OperationStatus'] == 'SUCCESS'
45
+ or response_event['OperationStatus'] == 'FAILED',
42
46
  'request_token': response_event['RequestToken'],
43
47
  }
44
48
 
45
49
  if response_event.get('Identifier', None):
46
50
  response['identifier'] = response_event['Identifier']
47
- if response_event.get('StatusMessage', None):
48
- response['status_message'] = response_event['StatusMessage']
49
51
  if response_event.get('ResourceModel', None):
50
52
  response['resource_info'] = response_event['ResourceModel']
51
53
  if response_event.get('ErrorCode', None):
@@ -55,4 +57,21 @@ def progress_event(response_event) -> dict[str, str]:
55
57
  if response_event.get('RetryAfter', None):
56
58
  response['retry_after'] = response_event['RetryAfter']
57
59
 
60
+ # CloudControl returns a list of hooks events which may also contain a message which should
61
+ # take precedent over the status message returned from CloudControl directly
62
+ hooks_status_message = None
63
+ if hooks_events:
64
+ failed_hook_event_messages = (
65
+ hook_event['HookStatusMessage']
66
+ for hook_event in hooks_events
67
+ if hook_event.get('HookStatus', None) == 'HOOK_COMPLETE_FAILED'
68
+ or hook_event.get('HookStatus', None) == 'HOOK_FAILED'
69
+ )
70
+ hooks_status_message = next(failed_hook_event_messages, None)
71
+
72
+ if hooks_status_message:
73
+ response['status_message'] = hooks_status_message
74
+ elif response_event.get('StatusMessage', None):
75
+ response['status_message'] = response_event['StatusMessage']
76
+
58
77
  return response
@@ -1,3 +1,17 @@
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
+
1
15
  from awslabs.cfn_mcp_server.errors import ServerError
2
16
 
3
17
 
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
 
13
16
  def handle_aws_api_error(e: Exception) -> Exception:
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  """CloudFormation IaC Generator tool implementation."""
13
16
 
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  import json
13
16
  import os
@@ -1,13 +1,16 @@
1
1
  # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
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
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
5
6
  #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # http://www.apache.org/licenses/LICENSE-2.0
7
8
  #
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.
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.
11
14
 
12
15
  """awslabs CFN MCP Server implementation."""
13
16
 
@@ -202,7 +205,7 @@ async def update_resource(
202
205
  except Exception as e:
203
206
  raise handle_aws_api_error(e)
204
207
 
205
- return progress_event(response['ProgressEvent'])
208
+ return progress_event(response['ProgressEvent'], None)
206
209
 
207
210
 
208
211
  @mcp.tool()
@@ -253,7 +256,7 @@ async def create_resource(
253
256
  except Exception as e:
254
257
  raise handle_aws_api_error(e)
255
258
 
256
- return progress_event(response['ProgressEvent'])
259
+ return progress_event(response['ProgressEvent'], None)
257
260
 
258
261
 
259
262
  @mcp.tool()
@@ -305,7 +308,7 @@ async def delete_resource(
305
308
  except Exception as e:
306
309
  raise handle_aws_api_error(e)
307
310
 
308
- return progress_event(response['ProgressEvent'])
311
+ return progress_event(response['ProgressEvent'], None)
309
312
 
310
313
 
311
314
  @mcp.tool()
@@ -347,7 +350,7 @@ async def get_resource_request_status(
347
350
  except Exception as e:
348
351
  raise handle_aws_api_error(e)
349
352
 
350
- return progress_event(response['ProgressEvent'])
353
+ return progress_event(response['ProgressEvent'], response.get('HooksProgressEvent', None))
351
354
 
352
355
 
353
356
  @mcp.tool()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: awslabs.cfn-mcp-server
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: An AWS Labs Model Context Protocol (MCP) server for doing common cloudformation tasks and for managing your resources in your AWS account
5
5
  Project-URL: homepage, https://awslabs.github.io/mcp/
6
6
  Project-URL: docs, https://awslabs.github.io/mcp/servers/cfn-mcp-server/
@@ -0,0 +1,15 @@
1
+ awslabs/__init__.py,sha256=WuqxdDgUZylWNmVoPKiK7qGsTB_G4UmuXIrJ-VBwDew,731
2
+ awslabs/cfn_mcp_server/__init__.py,sha256=UVFyAMX0Igl13L8zK7uhYmoTVwkzH9BjiteNwMDA0jo,668
3
+ awslabs/cfn_mcp_server/aws_client.py,sha256=L8NzRVsFT7zuyFsnOXqyJyLM-JE5VQ_3MDlKOIOdtgo,2840
4
+ awslabs/cfn_mcp_server/cloud_control_utils.py,sha256=P-LXQc4PAOmimnva9DquI1WooxQj2Fl3rSqy9v0PmvY,3771
5
+ awslabs/cfn_mcp_server/context.py,sha256=5Uitekl1BfXDPVFS65qmESbrDKEz1tgGHuEC3tDWcO8,1393
6
+ awslabs/cfn_mcp_server/errors.py,sha256=w4fYUoxZj0rUlc_Kvj5w7N_wl2L_CgvOjnpIVlCcOFo,4538
7
+ awslabs/cfn_mcp_server/iac_generator.py,sha256=og3nzBhGum_ps2NjtruG5RehWeEtIMRN0bo9JdE4dTU,7938
8
+ awslabs/cfn_mcp_server/schema_manager.py,sha256=I6EigsAx8dbxRWNDZKz5r0piqiavTE2oKzDSQlwxHH0,6832
9
+ awslabs/cfn_mcp_server/server.py,sha256=GD3FBcMkQ7hgM53e4KvY5XcfGMcnAgHZ2XbKGoPY1_o,16854
10
+ awslabs_cfn_mcp_server-1.0.5.dist-info/METADATA,sha256=M8NKPyz0VAKuYBmKB3iqbdtY8XP5dq7Ch_WW-MrQ_2A,9121
11
+ awslabs_cfn_mcp_server-1.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ awslabs_cfn_mcp_server-1.0.5.dist-info/entry_points.txt,sha256=Hartc24s_fYgi3o2m2tBHahod0pqXYwpebQy2_tXL7s,78
13
+ awslabs_cfn_mcp_server-1.0.5.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
14
+ awslabs_cfn_mcp_server-1.0.5.dist-info/licenses/NOTICE,sha256=bcw4NZAgn5eQZzrtuDiwOe23BRSm_JiRzn0gxBLDzlg,90
15
+ awslabs_cfn_mcp_server-1.0.5.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- awslabs/__init__.py,sha256=47wJeKcStxEJwX7SVVV2pnAWYR8FxcaYoT3YTmZ5Plg,674
2
- awslabs/cfn_mcp_server/__init__.py,sha256=83bE3XbvOF6sigHPxEk0J9k7lNU9bzTwoCLde-IKQNA,611
3
- awslabs/cfn_mcp_server/aws_client.py,sha256=w0cwuQq7b34IUaABEwZYpEols1QoMjO2gd3T98K5FcE,2783
4
- awslabs/cfn_mcp_server/cloud_control_utils.py,sha256=wUDT-J9iEAOYnqZAG2vDtBsXUp0EUZ__jQzJ4RJ6AvM,2973
5
- awslabs/cfn_mcp_server/context.py,sha256=YpJZPjyzHW7df9O-lyj2j8yuenZI-yPxLuVuyvmnAnE,777
6
- awslabs/cfn_mcp_server/errors.py,sha256=0ADg9EesPyvjNZD-J89QLQ5OFcD6aSKDaMfW_4RQjfo,4481
7
- awslabs/cfn_mcp_server/iac_generator.py,sha256=iTZ6tM92m430GHM60lH1qR5nlRdhSbx2m0_WTbkU1f8,7881
8
- awslabs/cfn_mcp_server/schema_manager.py,sha256=7dw2W2hgdn1ODRU5PrUmOG9_rvnKUhGD51q8Wz4Ksks,6775
9
- awslabs/cfn_mcp_server/server.py,sha256=Fw7vMYfzxGCTaJD_MHj1EmGVlTO_CmtOKjzicGj8uYw,16737
10
- awslabs_cfn_mcp_server-1.0.3.dist-info/METADATA,sha256=rnKRPLiaG5-n1zVWpwJ5WtbUL_41ChoqlCqsdjjnd64,9121
11
- awslabs_cfn_mcp_server-1.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- awslabs_cfn_mcp_server-1.0.3.dist-info/entry_points.txt,sha256=Hartc24s_fYgi3o2m2tBHahod0pqXYwpebQy2_tXL7s,78
13
- awslabs_cfn_mcp_server-1.0.3.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
14
- awslabs_cfn_mcp_server-1.0.3.dist-info/licenses/NOTICE,sha256=bcw4NZAgn5eQZzrtuDiwOe23BRSm_JiRzn0gxBLDzlg,90
15
- awslabs_cfn_mcp_server-1.0.3.dist-info/RECORD,,