awslabs.ccapi-mcp-server 1.0.1__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.

Potentially problematic release.


This version of awslabs.ccapi-mcp-server might be problematic. Click here for more details.

Files changed (28) hide show
  1. awslabs/__init__.py +16 -0
  2. awslabs/ccapi_mcp_server/__init__.py +17 -0
  3. awslabs/ccapi_mcp_server/aws_client.py +62 -0
  4. awslabs/ccapi_mcp_server/cloud_control_utils.py +120 -0
  5. awslabs/ccapi_mcp_server/context.py +37 -0
  6. awslabs/ccapi_mcp_server/errors.py +67 -0
  7. awslabs/ccapi_mcp_server/iac_generator.py +203 -0
  8. awslabs/ccapi_mcp_server/impl/__init__.py +13 -0
  9. awslabs/ccapi_mcp_server/impl/tools/__init__.py +13 -0
  10. awslabs/ccapi_mcp_server/impl/tools/explanation.py +325 -0
  11. awslabs/ccapi_mcp_server/impl/tools/infrastructure_generation.py +70 -0
  12. awslabs/ccapi_mcp_server/impl/tools/resource_operations.py +367 -0
  13. awslabs/ccapi_mcp_server/impl/tools/security_scanning.py +223 -0
  14. awslabs/ccapi_mcp_server/impl/tools/session_management.py +221 -0
  15. awslabs/ccapi_mcp_server/impl/utils/__init__.py +13 -0
  16. awslabs/ccapi_mcp_server/impl/utils/validation.py +64 -0
  17. awslabs/ccapi_mcp_server/infrastructure_generator.py +160 -0
  18. awslabs/ccapi_mcp_server/models/__init__.py +13 -0
  19. awslabs/ccapi_mcp_server/models/models.py +118 -0
  20. awslabs/ccapi_mcp_server/schema_manager.py +219 -0
  21. awslabs/ccapi_mcp_server/server.py +733 -0
  22. awslabs/ccapi_mcp_server/static/__init__.py +13 -0
  23. awslabs_ccapi_mcp_server-1.0.1.dist-info/METADATA +656 -0
  24. awslabs_ccapi_mcp_server-1.0.1.dist-info/RECORD +28 -0
  25. awslabs_ccapi_mcp_server-1.0.1.dist-info/WHEEL +4 -0
  26. awslabs_ccapi_mcp_server-1.0.1.dist-info/entry_points.txt +2 -0
  27. awslabs_ccapi_mcp_server-1.0.1.dist-info/licenses/LICENSE +175 -0
  28. awslabs_ccapi_mcp_server-1.0.1.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,656 @@
1
+ Metadata-Version: 2.4
2
+ Name: awslabs.ccapi-mcp-server
3
+ Version: 1.0.1
4
+ Summary: An AWS Labs Model Context Protocol (MCP) server for managing AWS resources via Cloud Control API
5
+ Project-URL: homepage, https://awslabs.github.io/mcp/
6
+ Project-URL: docs, https://awslabs.github.io/mcp/servers/ccapi-mcp-server/
7
+ Project-URL: documentation, https://awslabs.github.io/mcp/servers/ccapi-mcp-server/
8
+ Project-URL: repository, https://github.com/awslabs/mcp.git
9
+ Project-URL: changelog, https://github.com/awslabs/mcp/blob/main/src/ccapi-mcp-server/CHANGELOG.md
10
+ Author: Amazon Web Services
11
+ Author-email: AWSLabs MCP <203918161+awslabs-mcp@users.noreply.github.com>, Brian Terry <brianter@amazon.com>, Kevon Mayers <kevon@kevonmayers.com>, Karam Singh <karam.singh.vir@gmail.com>, Shardul Vaidya <cam.v737@gmail.com>
12
+ License: Apache-2.0
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: boto3>=1.34.0
25
+ Requires-Dist: botocore>=1.34.0
26
+ Requires-Dist: checkov>=3.0.0
27
+ Requires-Dist: loguru>=0.7.0
28
+ Requires-Dist: mcp[cli]>=1.6.0
29
+ Requires-Dist: pydantic>=2.10.6
30
+ Description-Content-Type: text/markdown
31
+
32
+ # AWS Cloud Control API (CCAPI) MCP Server
33
+
34
+ Model Context Protocol (MCP) server that enables LLMs to directly create and manage over 1,100 AWS resources through natural language using AWS Cloud Control API and IaC Generator with Infrastructure as Code best practices.
35
+
36
+ ## Prerequisites
37
+
38
+ - All prerequisites listed in the [Installation and Setup](https://github.com/awslabs/mcp#installation-and-setup) section within the awslabs/mcp README should be satisfied
39
+ - Valid AWS credentials
40
+ - Ensure your IAM role or user has the necessary permissions (see [Security Considerations](#security-considerations))
41
+
42
+ ## Features
43
+
44
+ - **Resource Creation**: Uses a declarative approach to create any of 1,100+ AWS resources through Cloud Control API
45
+ - **Resource Reading**: Reads all properties and attributes of specific AWS resources
46
+ - **Resource Updates**: Uses a declarative approach to apply changes to existing AWS resources
47
+ - **Resource Deletion**: Safely removes AWS resources with proper validation
48
+ - **Resource Listing**: Enumerates all resources of a specified type across your AWS environment
49
+ - **Schema Information**: Returns detailed CloudFormation schema for any resource to enable more effective operations
50
+ - **Natural Language Interface**: Transform infrastructure-as-code from static authoring to dynamic conversations
51
+ - **Partner Resource Support**: Works with both AWS-native and partner-defined resources
52
+ - **Template Generation**: Generates a template on created/existing resources for a [subset of resource types](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html)
53
+
54
+ ## Secure Workflow
55
+
56
+ For resource creation and updates, the server follows this secure workflow:
57
+
58
+ 1. Check for AWS credentials and display account ID and region to the user
59
+ 2. Generate infrastructure code with properties and CloudFormation template
60
+ 3. **Explain the configuration** - Show user exactly what will be created/modified
61
+ 4. Run security scans against the template (if SECURITY_SCANNING=enabled)
62
+ 5. If checks pass (or security scanning disabled with warning), attempt to create/update resource(s) with the AWS Cloud Control API
63
+ 6. Automatically add default management tags to resources for tracking and support
64
+ 7. Validate that the resource(s) were created/updated successfully
65
+ 8. Provide a summary of what was done, including any security warnings
66
+ 9. (Optional) create an IaC template that aligns to the resources it just created or updated
67
+
68
+ This workflow ensures that:
69
+
70
+ - **Full Transparency**: Users see exactly what will be created/modified before execution via the `explain()` step
71
+ - **Security Validation**: Resources are scanned for security issues before creation/modification (when enabled, default configuration)
72
+ - **Informed Consent**: Users cannot accidentally create resources without understanding the configuration
73
+ - **Audit Trail**: Default management tags are automatically applied for tracking and support
74
+ - **Flexible Security**: Security scanning can be enabled/disabled based on environment needs
75
+ - **IaC Preservation**: Users have the option to preserve their infrastructure as code
76
+ - **Multiple Formats**: Multiple IaC formats are supported for maximum flexibility
77
+
78
+ ## Security Architecture
79
+
80
+ The MCP server uses a token-based workflow system that ensures:
81
+
82
+ - **Sequential validation**: Each step must be completed before the next
83
+ - **Server-side enforcement**: Tokens are generated and validated server-side
84
+ - **No bypass capability**: AI agents cannot skip security steps or fake credentials
85
+ - **Audit trail**: All operations are tracked through the token chain
86
+
87
+ This prevents AI agents from bypassing security scans, credential checks, or user explanations.
88
+
89
+ ## Security Protections
90
+
91
+ The MCP server implements several critical security protections:
92
+
93
+ ### Credential Awareness
94
+
95
+ - Always displays AWS account ID and region before any CREATE/UPDATE operation
96
+ - Ensures users are aware of which account will be affected by changes
97
+
98
+ ### Deletion Safeguards
99
+
100
+ - Requires double confirmation for any resource deletion
101
+ - Prevents mass deletion of AWS infrastructure
102
+ - For cleanup operations, uses IaC Generator to create templates instead of direct deletion
103
+ - Provides safer alternatives with better control and rollback options
104
+
105
+ ### Policy Restrictions
106
+
107
+ - Blocks creation of overly permissive IAM policies
108
+ - Prevents configurations with "AWS": "\*" as a principal
109
+ - Blocks "Effect": "Allow" combined with "Action": "_" and "Resource": "_"
110
+ - Declines requests for public access to sensitive resources
111
+ - Prevents disabling encryption for sensitive data
112
+
113
+ ## Authentication
114
+
115
+ This MCP server requires authentication to an AWS account, as its primary intent is to be able to manage infrastructure. There are multiple options you have for authentication such as:
116
+
117
+ ### AWS Profile
118
+
119
+ This can be set via the AWS CLI by running `aws configure` and following the instructions.
120
+
121
+ ### Environment Variables
122
+
123
+ You can set environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION) by exporting them.
124
+
125
+ ## Environment Variables
126
+
127
+ The MCP server supports several environment variables to control its behavior:
128
+
129
+ ### AWS Configuration
130
+
131
+ | Variable | Default | Description |
132
+ | ------------- | ---------------------- | ------------------------------------------ |
133
+ | `AWS_REGION` | _(see priority below)_ | AWS region for operations |
134
+ | `AWS_PROFILE` | _(empty)_ | AWS profile name to use for authentication |
135
+
136
+ **AWS Region Resolution Order:**
137
+
138
+ The MCP server follows boto3's standard region resolution chain (highest to lowest priority):
139
+
140
+ 1. **Function argument**: `region` parameter passed to MCP tools (highest priority)
141
+ 2. **AWS_REGION environment variable**: Explicitly set region via environment
142
+ 3. **AWS profile region**: Region configured in `~/.aws/config` for the active profile
143
+ 4. **Default fallback**: `us-east-1` as the final fallback
144
+
145
+ This ensures consistent behavior with other AWS tools and SDKs. The region resolution is handled automatically by boto3's credential chain.
146
+
147
+ **When to set AWS_REGION:**
148
+
149
+ - **To override region**: When you want to use a different region than the default
150
+ - **With environment variables**: When using `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` and don't want `us-east-1`
151
+ - **With profiles/SSO**: When you want to override the profile's configured region
152
+ - **Not needed**: When using AWS profiles/SSO and you want the profile's configured region, or when `us-east-1` is acceptable
153
+
154
+ ### AWS Credential Chain
155
+
156
+ The server uses boto3's standard credential chain automatically:
157
+
158
+ 1. Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
159
+ 2. AWS profile from `~/.aws/credentials` or `~/.aws/config`
160
+ 3. IAM roles (EC2 instance, ECS task, EKS pod)
161
+ 4. AWS SSO (if configured in profile)
162
+
163
+ **SSO Token Management**: When SSO tokens expire, the server provides clear instructions to refresh them with `aws sso login --profile your-profile`.
164
+
165
+ ### Server Configuration
166
+
167
+ | Variable | Default | Description |
168
+ | ------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
169
+ | `FASTMCP_LOG_LEVEL` | _(not set)_ | Logging level (ERROR, WARN, INFO, DEBUG) |
170
+ | `SECURITY_SCANNING` | `enabled` | Enable/disable Checkov security scanning (`enabled` or `disabled`). When disabled, shows warning but allows resource operations to proceed. |
171
+
172
+ ### Default Tagging
173
+
174
+ The server automatically adds these identification tags to all supported resources:
175
+
176
+ - `MANAGED_BY`: `CCAPI-MCP-SERVER`
177
+ - `MCP_SERVER_SOURCE_CODE`: `https://github.com/awslabs/mcp/tree/main/src/ccapi-mcp-server`
178
+ - `MCP_SERVER_VERSION`: `1.0.0` (current version)
179
+
180
+ These tags help identify resources created by the MCP server for support and troubleshooting purposes. Users can add additional custom tags through conversation with the LLM.
181
+
182
+ ### AWS Account Information Display
183
+
184
+ The server automatically displays AWS account information on startup:
185
+
186
+ - **AWS Profile**: The profile being used (if any)
187
+ - **Authentication Type**: How you're authenticated (SSO Profile, Standard AWS Profile, Environment Variables, Assume Role Profile)
188
+ - **AWS Account ID**: The AWS account ID
189
+ - **AWS Region**: The region where resources will be created
190
+ - **Read-only Mode**: Whether the server is in read-only mode
191
+ - **Security Scanning**: Whether Checkov security scanning is enabled
192
+
193
+ This ensures you always know which AWS account and region will be affected by operations, and what security measures are in place.
194
+
195
+ ## Installation
196
+
197
+ | Cursor | VS Code |
198
+ |:------:|:-------:|
199
+ | [![Install MCP Server](https://cursor.com/deeplink/mcp-install-light.svg)](https://cursor.com/en/install-mcp?name=awslabs.ccapi-mcp-server&config=eyJjb21tYW5kIjoidXZ4IGF3c2xhYnMuY2NhcGktbWNwLXNlcnZlckBsYXRlc3QiLCJlbnYiOnsiQVdTX1BST0ZJTEUiOiJ5b3VyLWF3cy1wcm9maWxlIiwiQVdTX1JFR0lPTiI6InVzLWVhc3QtMSIsIkZBU1RNQ1BfTE9HX0xFVkVMIjoiRVJST1IifSwiZGlzYWJsZWQiOmZhbHNlLCJhdXRvQXBwcm92ZSI6W119) | [![Install on VS Code](https://img.shields.io/badge/Install_on-VS_Code-FF9900?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=AWS%20Cloud%20Control%20API%20MCP%20Server&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22awslabs.ccapi-mcp-server%40latest%22%5D%2C%22env%22%3A%7B%22AWS_PROFILE%22%3A%22your-aws-profile%22%2C%22AWS_REGION%22%3A%22us-east-1%22%2C%22FASTMCP_LOG_LEVEL%22%3A%22ERROR%22%7D%2C%22disabled%22%3Afalse%2C%22autoApprove%22%3A%5B%5D%7D) |
200
+
201
+ **Before installation, configure AWS credentials using one of these methods:**
202
+
203
+ - **AWS Profile**: Run `aws configure` and set `AWS_PROFILE` environment variable (region from profile used automatically)
204
+ - **Environment Variables**: Export `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` (defaults to `us-east-1`, set `AWS_REGION` to override)
205
+ - **AWS SSO**: Configure SSO profile and set `AWS_PROFILE` (region from profile used automatically)
206
+ - **Instance Role**: Use EC2 instance role or ECS task role (automatic detection, may need `AWS_REGION`)
207
+
208
+ Ensure your IAM role or user has the necessary permissions (see [Security Considerations](#security-considerations)).
209
+
210
+ ### Configuration
211
+
212
+ Configure the MCP server in your MCP client configuration (e.g., for Amazon Q Developer CLI, edit `~/.aws/amazonq/mcp.json`):
213
+
214
+ ```json
215
+ {
216
+ "mcpServers": {
217
+ "awslabs.ccapi-mcp-server": {
218
+ "command": "uvx",
219
+ "args": ["awslabs.ccapi-mcp-server@latest"],
220
+ "env": {
221
+ "AWS_PROFILE": "your-named-profile",
222
+ "DEFAULT_TAGS": "enabled",
223
+ "SECURITY_SCANNING": "enabled",
224
+ "FASTMCP_LOG_LEVEL": "ERROR"
225
+ },
226
+ "disabled": false,
227
+ "autoApprove": []
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ _Note: Uses the default region from your AWS profile. Add `"AWS_REGION": "us-west-2"` (or other desired AWS Region) to override._
234
+
235
+ **Security Scanning Disabled:**
236
+
237
+ You have control on enabling/disabling Checkov security scanning on all infrastructure before creation/updates. The following configuration will disable security scanning:
238
+
239
+ ```json
240
+ {
241
+ "mcpServers": {
242
+ "awslabs.ccapi-mcp-server": {
243
+ "command": "uvx",
244
+ "args": ["awslabs.ccapi-mcp-server@latest"],
245
+ "env": {
246
+ "AWS_PROFILE": "your-named-profile",
247
+ "DEFAULT_TAGS": "enabled",
248
+ "SECURITY_SCANNING": "disabled",
249
+ "FASTMCP_LOG_LEVEL": "ERROR"
250
+ }
251
+ }
252
+ }
253
+ }
254
+ ```
255
+
256
+ **Alternative configurations:**
257
+
258
+ **Using SSO via AWS IAM Identity Center:**
259
+
260
+ ```json
261
+ {
262
+ "mcpServers": {
263
+ "awslabs.ccapi-mcp-server": {
264
+ "command": "uvx",
265
+ "args": ["awslabs.ccapi-mcp-server@latest"],
266
+ "env": {
267
+ "AWS_PROFILE": "your-sso-profile",
268
+ "DEFAULT_TAGS": "enabled",
269
+ "SECURITY_SCANNING": "enabled",
270
+ "FASTMCP_LOG_LEVEL": "ERROR"
271
+ }
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ _Note: Run `aws sso login --profile your-sso-profile` before starting the MCP server_
278
+
279
+ **Using Environment Variables for Credentials:**
280
+
281
+ ```json
282
+ {
283
+ "mcpServers": {
284
+ "awslabs.ccapi-mcp-server": {
285
+ "command": "uvx",
286
+ "args": ["awslabs.ccapi-mcp-server@latest"],
287
+ "env": {
288
+ "AWS_REGION": "us-west-2",
289
+ "DEFAULT_TAGS": "enabled",
290
+ "SECURITY_SCANNING": "enabled",
291
+ "FASTMCP_LOG_LEVEL": "ERROR"
292
+ }
293
+ }
294
+ }
295
+ }
296
+ ```
297
+
298
+ _Note: Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are exported in your shell_
299
+
300
+ **Read-Only Mode (Security Feature):**
301
+
302
+ To prevent the MCP server from performing any mutating actions (Create/Update/Delete), use the `--readonly` command-line flag. This is a security feature that cannot be bypassed via environment variables. Note, this is why the `DEFAULT_TAGS`, and `SECURITY_SCANNING` environment variables are omitted from the follow example. Even if they were present, the `--readonly` flag would prevent any CREATE/UPDATE/DELETE operations, which cause those environment variables to have no use:
303
+
304
+ ```json
305
+ {
306
+ "mcpServers": {
307
+ "awslabs.ccapi-mcp-server": {
308
+ "command": "uvx",
309
+ "args": ["awslabs.ccapi-mcp-server@latest", "--readonly"],
310
+ "env": {
311
+ "AWS_PROFILE": "your-named-profile",
312
+ "FASTMCP_LOG_LEVEL": "ERROR"
313
+ },
314
+ "disabled": false,
315
+ "autoApprove": []
316
+ }
317
+ }
318
+ }
319
+ ```
320
+
321
+ or docker after a successful `docker build -t awslabs/ccapi-mcp-server .`:
322
+
323
+ ```file
324
+ # fictitious `.env` file with AWS temporary credentials
325
+ AWS_ACCESS_KEY_ID=ASIAIOSFODNN7EXAMPLE # pragma: allowlist secret
326
+ AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY # pragma: allowlist secret
327
+ AWS_SESSION_TOKEN=AQoEXAMPLEH4aoAH0gNCAPy...truncated...zrkuWJOgQs8IZZaIv2BXIa2R4Olgk # pragma: allowlist secret
328
+ ```
329
+
330
+ ```json
331
+ {
332
+ "mcpServers": {
333
+ "awslabs.ccapi-mcp-server": {
334
+ "command": "docker",
335
+ "args": [
336
+ "run",
337
+ "--rm",
338
+ "--interactive",
339
+ "--env-file",
340
+ "/full/path/to/file/above/.env",
341
+ "awslabs/ccapi-mcp-server:latest",
342
+ "--readonly" // Optional paramter if you would like to restrict the MCP to only read actions
343
+ ],
344
+ "env": {},
345
+ "disabled": false,
346
+ "autoApprove": []
347
+ }
348
+ }
349
+ }
350
+ ```
351
+
352
+ NOTE: Your credentials will need to be kept refreshed from your host
353
+
354
+ ## Available MCP Tools
355
+
356
+ **Tool Ordering & Workflow Enforcement**: These tools are designed with parameter dependencies that enforce proper workflow order. LLMs must follow the logical sequence: environment setup → security validation → resource operations. This prevents security bypasses and ensures proper credential validation.
357
+
358
+ ### Core Tools
359
+
360
+ #### check_environment_variables()
361
+
362
+ **Requirements**: None (starting point)
363
+
364
+ Checks if AWS credentials are properly configured through AWS_PROFILE or environment variables. Returns detailed information about credential source, authentication type, and configuration status.
365
+ **Example**: Verify that AWS credentials are available before performing operations.
366
+ **Returns**: `environment_token` for use with `get_aws_session_info()`, plus environment variables, AWS profile, region, authentication type (sso_profile, standard_profile, assume_role_profile, env), and configuration status.
367
+
368
+ #### get_aws_session_info()
369
+
370
+ **Requirements**: `environment_token` parameter from `check_environment_variables()`
371
+
372
+ Provides detailed information about the current AWS session including account ID, region, credential source, and masked credential information for security.
373
+ **Example**: Display which AWS account and region will be affected by operations.
374
+ **Use when**: You need detailed session info and have already called `check_environment_variables()`.
375
+ **Security**: Automatically masks sensitive credential information (shows only last 4 characters).
376
+ **Returns**: `credentials_token` for use with `generate_infrastructure_code()`
377
+
378
+ #### get_aws_account_info()
379
+
380
+ **Requirements**: None (calls `check_environment_variables()` internally)
381
+
382
+ Convenience tool that automatically calls `check_environment_variables()` internally, then `get_aws_session_info()`. Returns the same information but requires no parameters.
383
+ **Example**: "What AWS account am I using?" - Quick one-step account info.
384
+ **Use when**: You want account info quickly without calling `check_environment_variables()` first.
385
+
386
+ #### generate_infrastructure_code()
387
+
388
+ **Requirements**: `credentials_token` parameter from `get_aws_session_info()`
389
+
390
+ Prepares resource properties for Cloud Control API operations, applies default management tags, and generates a CloudFormation-format template for security scanning. **Important**: The CloudFormation service is never involved - the template is only used by Checkov for security analysis.
391
+
392
+ **Consistency guarantee**: The exact same properties object is used for both the CF template (for Checkov scanning) and passed to `create_resource()`/`update_resource()` (for CCAPI operations). This ensures what gets security-scanned is identical to what gets deployed.
393
+
394
+ **Example**: Process S3 bucket properties, apply default tags, create CF-format template for Checkov, then use the same properties for CCAPI resource creation.
395
+ **Returns**: `generated_code_token` for use with `explain()`, CloudFormation template for security scanning, and properties for explanation.
396
+ **Workflow**: generate_infrastructure_code() → explain() → run_checkov() (if enabled) → create_resource().
397
+
398
+ #### explain()
399
+
400
+ **Requirements**: `generated_code_token` from `generate_infrastructure_code()` (for infrastructure operations) OR `content` parameter (for general explanations)
401
+
402
+ Explains any data in clear, human-readable format. For infrastructure operations, this tool consumes the `generated_code_token` and returns an `explained_token` that must be used for create/update/delete operations.
403
+
404
+ **Infrastructure workflow**:
405
+
406
+ - Takes `generated_code_token` from `generate_infrastructure_code()`
407
+ - Provides comprehensive explanation of what will be created/updated/deleted
408
+ - Returns `explained_token` for use with `create_resource()`/`update_resource()`/`delete_resource()`
409
+ - **Security**: Ensures users see exactly what will be created/modified before execution.
410
+
411
+ **General data explanation**:
412
+
413
+ - Pass any data in `content` parameter
414
+ - Explains JSON, YAML, dictionaries, lists, API responses, configurations
415
+ - No token workflow required
416
+
417
+ **Example**: Explain S3 bucket configuration when fetching an existing bucket, or explain general API response data.
418
+
419
+ #### run_checkov()
420
+
421
+ **Requirements**: `explained_token` from `explain()`
422
+
423
+ Runs Checkov security and compliance scanner on server-stored CloudFormation template. Returns scan results for user review.
424
+
425
+ **Security validation behavior depends on SECURITY_SCANNING environment variable**:
426
+
427
+ - **When SECURITY_SCANNING=enabled**: This tool is required, returns scan results for user review
428
+ - **When SECURITY_SCANNING=disabled**: Shows warning, proceeds without security validation
429
+
430
+ **Example**: `run_checkov(explained_token)` - Returns security scan results.
431
+ **Returns**: `security_scan_token` for use with `create_resource()` (when security scanning enabled), plus detailed scan results.
432
+
433
+ ### Resource Modification Tools (CRUDL)
434
+
435
+ #### create_resource()
436
+
437
+ **Requirements**: `credentials_token` from `get_aws_session_info()` AND `explained_token` from `explain()`
438
+
439
+ **Security Requirements**:
440
+
441
+ - When SECURITY_SCANNING=enabled: Requires `security_scan_token` from `run_checkov()`
442
+ - When SECURITY_SCANNING=disabled: Shows security warning but proceeds without validation token
443
+
444
+ Creates an AWS resource using the AWS Cloud Control API with a declarative approach. Automatically adds default management tags for tracking and support.
445
+ **Example**: Create an S3 bucket with versioning and encryption enabled.
446
+ **Security**: Uses only properties that were explained to the user via `explain()` tool.
447
+
448
+ #### get_resource()
449
+
450
+ **Requirements**: None
451
+
452
+ Gets details of a specific AWS resource using the AWS Cloud Control API.
453
+ **Example**: Get the configuration of an EC2 instance.
454
+ **Returns**: Resource identifier and detailed properties.
455
+
456
+ #### update_resource()
457
+
458
+ **Requirements**: `credentials_token` from `get_aws_session_info()` AND `explained_token` from `explain()`
459
+
460
+ **Security Requirements**:
461
+
462
+ - When SECURITY_SCANNING=enabled: Requires `security_scan_token` from `run_checkov()`
463
+ - When SECURITY_SCANNING=disabled: Shows security warning but proceeds without validation token
464
+
465
+ Updates an AWS resource using the AWS Cloud Control API with RFC 6902 JSON Patch operations.
466
+ **Example**: Update an RDS instance's storage capacity.
467
+ **Security**: Requires explanation of changes via `explain()` tool before execution.
468
+
469
+ #### delete_resource()
470
+
471
+ **Requirements**: `credentials_token` from `get_aws_session_info()` AND `explained_token` from `explain()`
472
+
473
+ Deletes an AWS resource using the AWS Cloud Control API. Requires explicit confirmation and explanation of what will be deleted.
474
+ **Example**: Remove an unused NAT gateway.
475
+ **Security**: Requires explanation of deletion impact via `explain()` tool and explicit confirmation.
476
+
477
+ #### list_resources()
478
+
479
+ **Requirements**: None
480
+
481
+ Lists AWS resources of a specified type using AWS Cloud Control API.
482
+ **Example**: List all EC2 instances in a region.
483
+
484
+ ### Utility Tools
485
+
486
+ #### get_resource_schema_information()
487
+
488
+ **Requirements**: None
489
+
490
+ Get schema information for an AWS CloudFormation resource.
491
+ **Example**: Get the schema for AWS::S3::Bucket to understand all available properties.
492
+
493
+ #### get_resource_request_status()
494
+
495
+ **Requirements**: `request_token` from create/update/delete operations
496
+
497
+ Get the status of a mutation that was initiated by create/update/delete resource.
498
+ **Example**: Give me the status of the last request I made.
499
+
500
+ #### create_template()
501
+
502
+ **Requirements**: None (but typically used after resource operations)
503
+
504
+ Creates CloudFormation templates from existing AWS resources using AWS CloudFormation's IaC Generator API. **Currently only generates CloudFormation templates** in JSON or YAML format. While this MCP tool doesn't directly generate other IaC formats like Terraform or CDK, LLMs can use their native capabilities to convert the generated CloudFormation template to other formats - though this conversion happens outside the MCP server's scope.
505
+ **Example**: Generate a CloudFormation YAML template from existing S3 buckets and EC2 instances, then ask the LLM to convert it to Terraform HCL.
506
+
507
+ ### Token Workflow Summary
508
+
509
+ **Example workflow for create/update operations:**
510
+
511
+ 1. `check_environment_variables()` → `environment_token`
512
+ 2. `get_aws_session_info(environment_token)` → `credentials_token`
513
+ 3. `generate_infrastructure_code(credentials_token)` → `generated_code_token`
514
+ 4. `explain(generated_code_token)` → `explained_token`
515
+ 5. `run_checkov(explained_token)` → `security_scan_token` (if SECURITY_SCANNING=enabled)
516
+ 6. `create_resource(credentials_token, explained_token, security_scan_token)`
517
+
518
+ **No-token tools:** `get_resource()`, `list_resources()`, `get_resource_schema_information()`, `create_template()`, `get_aws_account_info()`
519
+
520
+ ## LLM Tool Selection Guidelines
521
+
522
+ **Important**: When using multiple MCP servers, LLMs may choose tools from any available server without consideration for which is most appropriate. MCP has no built-in orchestration or enforcement mechanisms at this time - LLMs can use any tool from any server at will.
523
+
524
+ ### Common Tool Selection Conflicts
525
+
526
+ - **Multiple Infrastructure MCP Servers**: Using CCAPI MCP server alongside other MCP servers that perform similar functions (such as Terraform MCP, CDK MCP, CFN MCP) may cause LLMs to randomly choose between them
527
+ - **Built-in Tools**: LLMs may choose built-in tools instead of this MCP server's tools:
528
+ - Amazon Q Developer CLI: `use_aws`, `execute_bash`, `fs_read`, `fs_write`
529
+ - Other tools may have similar built-in AWS or system capabilities
530
+
531
+ #### The `use_aws` Problem
532
+
533
+ **Most Problematic**: The `use_aws` tool (part of Amazon Q Developer CLI) is particularly problematic because it directly competes with this MCP server's AWS operations but operates separately, meaning it won't use any of the helpful features available in this MCP server such as Checkov security scanning.
534
+
535
+ **What happens when LLM uses `use_aws`:**
536
+
537
+ - ❌ No Checkov security scanning
538
+ - ❌ No workflow validation
539
+ - ❌ No credential verification display
540
+ - ❌ No resource tagging
541
+ - ❌ CCAPI MCP Server is not involved at all
542
+
543
+ **If this happens:**
544
+
545
+ 1. Tell the LLM: "Please use the CCAPI MCP Server instead for AWS operations"
546
+ 2. Experiment with prompts like "Using the CCAPI MCP server, create..."
547
+ 3. For a scalable solution, implement the rules/instructions mentioned below
548
+
549
+ **Note**: This is not a limitation of the CCAPI MCP Server - it's a current MCP protocol limitation. MCP has no native tool ordering concept or functionality, allowing LLMs to choose any available MCP server/tool. This flexibility is both good (choice) and problematic (undesirable sever/tool selection). We use a token-based approach to enforce some ordering in tool usage the LLM must follow, however this does not span across multiple MCP servers. It is internal to this MCP server.
550
+
551
+ ### Recommendation
552
+
553
+ Consult your LLM tool's documentation (Cursor, Cline, Amazon Q Developer, etc.) for how to provide rules/context/instructions to guide MCP server/tool selection. Most support some form of instruction mechanism.
554
+
555
+ **Example instruction content:**
556
+
557
+ ```markdown
558
+ # AWS Tool Selection Rules - MANDATORY FOR ALL LLM RESPONSES
559
+
560
+ ## STEP 1: Always Use CCAPI MCP Server First
561
+
562
+ **TRIGGER CONDITIONS:**
563
+
564
+ - ANY mention of AWS services or resources
565
+ - ANY request involving AWS infrastructure, applications, or services
566
+ - When in doubt, default to offering CCAPI MCP Server
567
+
568
+ **REQUIRED ACTION:**
569
+ ASK: "This seems like a good fit for the AWS Cloud Control API MCP server. Would you like to use the CCAPI MCP server for this?"
570
+
571
+ ## STEP 2: Only If CCAPI MCP Server Fails
572
+
573
+ **IF ERROR OCCURS:**
574
+
575
+ 1. Show exact error message to user
576
+ 2. Explain: "⚠️ SECURITY WARNING: Fallback tools (use_aws, aws_cli) will bypass ALL security scanning and the CCAPI MCP Server entirely."
577
+ 3. Ask: "How do you want to proceed: (a) troubleshoot CCAPI MCP, (b) use unsecured AWS CLI, or (c) generate template?"
578
+ 4. Wait for explicit user choice before proceeding
579
+
580
+ ## FORBIDDEN ACTIONS
581
+
582
+ - Never use use_aws, aws_cli, or executeBash for AWS operations without trying CCAPI MCP Server first
583
+ - Never skip the user confirmation steps
584
+ ```
585
+
586
+ ## Basic Usage
587
+
588
+ Examples of how to use the AWS Infrastructure as Code MCP Server:
589
+
590
+ - "Create a new S3 bucket with versioning and encryption enabled"
591
+ - "List all EC2 instances in the production environment"
592
+ - "Update the RDS instance to increase storage to 500GB"
593
+ - "Delete unused NAT gateways in VPC-123"
594
+ - "Set up a three-tier architecture with web, app, and database layers"
595
+ - "Create a disaster recovery environment in us-east-1"
596
+ - "Configure CloudWatch alarms for all production resources"
597
+ - "Implement cross-region replication for critical S3 buckets"
598
+ - "Show me the schema for AWS::Lambda::Function"
599
+ - "Create a template for all the resources we created and modified"
600
+
601
+ ## Resource Type support
602
+
603
+ Resources which are supported by this MCP and the supported operations can be found here: https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html
604
+
605
+ ## Security Considerations
606
+
607
+ When using this MCP server, you should consider:
608
+
609
+ - Ensuring proper IAM permissions are configured before use
610
+ - Use AWS CloudTrail for additional security monitoring
611
+ - Configure resource-specific permissions when possible instead of wildcard permissions
612
+ - Consider using resource tagging for better governance and cost management
613
+ - Review all changes made by the MCP server as part of your regular security reviews
614
+ - If you would like to restrict the MCP to readonly operations, specify --readonly True in the startup arguments for the MCP
615
+
616
+ ### Required IAM Permissions
617
+
618
+ Ensure your AWS credentials have the following minimum permissions:
619
+
620
+ ```json
621
+ {
622
+ "Version": "2012-10-17",
623
+ "Statement": [
624
+ {
625
+ "Effect": "Allow",
626
+ "Action": [
627
+ "cloudcontrol:ListResources",
628
+ "cloudcontrol:GetResource",
629
+ "cloudcontrol:CreateResource",
630
+ "cloudcontrol:DeleteResource",
631
+ "cloudcontrol:UpdateResource",
632
+ "cloudformation:CreateGeneratedTemplate",
633
+ "cloudformation:DescribeGeneratedTemplate",
634
+ "cloudformation:GetGeneratedTemplate"
635
+ ],
636
+ "Resource": "*"
637
+ }
638
+ ]
639
+ }
640
+ ```
641
+
642
+ ## Future Enhancements
643
+
644
+ - **IaC Format Conversion**: Add support for converting CloudFormation templates to other IaC formats (Terraform HCL, CDK TypeScript, CDK Python) in the `create_template` tool
645
+
646
+ ## Limitations
647
+
648
+ - Operations are limited to resources supported by AWS Cloud Control API and Iac Generator
649
+ - Performance depends on the underlying AWS services' response times
650
+ - Some complex resource relationships may require multiple operations
651
+ - This MCP server can only manage resources in the AWS regions where Cloud Control API and/or Iac Generator is available
652
+ - Resource modification operations may be limited by service-specific constraints
653
+ - Rate limiting may affect operations when managing many resources simultaneously
654
+ - Some resource types might not support all operations (create, read, update, delete)
655
+ - Generated templates are primarily intended for importing existing resources into a CloudFormation stack and may not always work for creating new resources (in another account or region)
656
+ - Template generation currently supports CloudFormation format only (JSON/YAML)