|
| 1 | +# AWS CDK MCP Server |
| 2 | + |
| 3 | +AWS Cloud Development Kit (CDK) best practices, infrastructure as code patterns, and security compliance with CDK Nag. |
| 4 | + |
| 5 | +[What is an MCP Server?](https://www.anthropic.com/news/model-context-protocol) |
| 6 | + |
| 7 | +## Characteristics |
| 8 | +Attribute|Details| |
| 9 | +|-|-| |
| 10 | +**Image Source**|Official Image |
| 11 | +**Docker Image**|[mcp/aws-cdk-mcp-server](https://hub.docker.com/repository/docker/mcp/aws-cdk-mcp-server) |
| 12 | +**Author**|[awslabs](https://github.com/awslabs) |
| 13 | +**Repository**|https://github.com/awslabs/mcp |
| 14 | +**Dockerfile**|https://github.com/awslabs/mcp/blob/main/src/cdk-mcp-server/Dockerfile |
| 15 | +**Docker Image built by**|Docker Inc. |
| 16 | +**Docker Scout Health Score**|  |
| 17 | +**Verify Signature**|`COSIGN_REPOSITORY=mcp/signatures cosign verify mcp/aws-cdk-mcp-server --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub` |
| 18 | +**Licence**|Apache License 2.0 |
| 19 | + |
| 20 | +## Available Tools |
| 21 | +Tools provided by this Server|Short Description |
| 22 | +-|- |
| 23 | +`CDKGeneralGuidance`|Use this tool to get prescriptive CDK advice for building applications on AWS.| |
| 24 | +`CheckCDKNagSuppressions`|Check if CDK code contains Nag suppressions that require human review.| |
| 25 | +`ExplainCDKNagRule`|Explain a specific CDK Nag rule with AWS Well-Architected guidance.| |
| 26 | +`GenerateBedrockAgentSchema`|Generate OpenAPI schema for Bedrock Agent Action Groups from a file.| |
| 27 | +`GetAwsSolutionsConstructPattern`|Search and discover AWS Solutions Constructs patterns.| |
| 28 | +`LambdaLayerDocumentationProvider`|Provide documentation sources for Lambda layers.| |
| 29 | +`SearchGenAICDKConstructs`|Search for GenAI CDK constructs by name or type.| |
| 30 | + |
| 31 | +--- |
| 32 | +## Tools Details |
| 33 | + |
| 34 | +#### Tool: **`CDKGeneralGuidance`** |
| 35 | +Use this tool to get prescriptive CDK advice for building applications on AWS. |
| 36 | +#### Tool: **`CheckCDKNagSuppressions`** |
| 37 | +Check if CDK code contains Nag suppressions that require human review. |
| 38 | + |
| 39 | + Scans TypeScript/JavaScript code for NagSuppressions usage to ensure security |
| 40 | + suppressions receive proper human oversight and justification. |
| 41 | +Parameters|Type|Description |
| 42 | +-|-|- |
| 43 | +`code`|`string` *optional*|CDK code to analyze (TypeScript/JavaScript) |
| 44 | +`file_path`|`string` *optional*|Path to a file containing CDK code to analyze |
| 45 | + |
| 46 | +--- |
| 47 | +#### Tool: **`ExplainCDKNagRule`** |
| 48 | +Explain a specific CDK Nag rule with AWS Well-Architected guidance. |
| 49 | + |
| 50 | + CDK Nag is a crucial tool for ensuring your CDK applications follow AWS security best practices. |
| 51 | + |
| 52 | + Basic implementation: |
| 53 | + ```typescript |
| 54 | + import { App } from 'aws-cdk-lib'; |
| 55 | + import { AwsSolutionsChecks } from 'cdk-nag'; |
| 56 | + |
| 57 | + const app = new App(); |
| 58 | + // Create your stack |
| 59 | + const stack = new MyStack(app, 'MyStack'); |
| 60 | + // Apply CDK Nag |
| 61 | + AwsSolutionsChecks.check(app); |
| 62 | + ``` |
| 63 | + |
| 64 | + Optional integration patterns: |
| 65 | + |
| 66 | + 1. Using environment variables: |
| 67 | + ```typescript |
| 68 | + if (process.env.ENABLE_CDK_NAG === 'true') { |
| 69 | + AwsSolutionsChecks.check(app); |
| 70 | + } |
| 71 | + ``` |
| 72 | + |
| 73 | + 2. Using CDK context parameters: |
| 74 | + ```typescript |
| 75 | + 3. Environment-specific application: |
| 76 | + ```typescript |
| 77 | + const environment = app.node.tryGetContext('environment') || 'development'; |
| 78 | + if (['production', 'staging'].includes(environment)) { |
| 79 | + AwsSolutionsChecks.check(stack); |
| 80 | + } |
| 81 | + ``` |
| 82 | + |
| 83 | + For more information on specific rule packs: |
| 84 | + - Use resource `cdk-nag://rules/{rule_pack}` to get all rules for a specific pack |
| 85 | + - Use resource `cdk-nag://warnings/{rule_pack}` to get warnings for a specific pack |
| 86 | + - Use resource `cdk-nag://errors/{rule_pack}` to get errors for a specific pack |
| 87 | +Parameters|Type|Description |
| 88 | +-|-|- |
| 89 | +`rule_id`|`string`|The CDK Nag rule ID (e.g., 'AwsSolutions-IAM4') |
| 90 | + |
| 91 | +--- |
| 92 | +#### Tool: **`GenerateBedrockAgentSchema`** |
| 93 | +Generate OpenAPI schema for Bedrock Agent Action Groups from a file. |
| 94 | + |
| 95 | + This tool converts a Lambda file with BedrockAgentResolver into a Bedrock-compatible |
| 96 | + OpenAPI schema. It uses a progressive approach to handle common issues: |
| 97 | + 1. Direct import of the Lambda file |
| 98 | + 2. Simplified version with problematic imports commented out |
| 99 | + 3. Fallback script generation if needed |
| 100 | +Parameters|Type|Description |
| 101 | +-|-|- |
| 102 | +`lambda_code_path`|`string`|Path to Python file containing BedrockAgentResolver app |
| 103 | +`output_path`|`string`|Where to save the generated schema |
| 104 | + |
| 105 | +--- |
| 106 | +#### Tool: **`GetAwsSolutionsConstructPattern`** |
| 107 | +Search and discover AWS Solutions Constructs patterns. |
| 108 | + |
| 109 | + AWS Solutions Constructs are vetted architecture patterns that combine multiple |
| 110 | + AWS services to solve common use cases following AWS Well-Architected best practices. |
| 111 | + |
| 112 | + Key benefits: |
| 113 | + - Accelerated Development: Implement common patterns without boilerplate code |
| 114 | + - Best Practices Built-in: Security, reliability, and performance best practices |
| 115 | + - Reduced Complexity: Simplified interfaces for multi-service architectures |
| 116 | + - Well-Architected: Patterns follow AWS Well-Architected Framework principles |
| 117 | + |
| 118 | + When to use Solutions Constructs: |
| 119 | + - Implementing common architecture patterns (e.g., API + Lambda + DynamoDB) |
| 120 | + - You want secure defaults and best practices applied automatically |
| 121 | + - You need to quickly prototype or build production-ready infrastructure |
| 122 | + |
| 123 | + This tool provides metadata about patterns. For complete documentation, |
| 124 | + use the resource URI returned in the 'documentation_uri' field. |
| 125 | +Parameters|Type|Description |
| 126 | +-|-|- |
| 127 | +`pattern_name`|`string` *optional*|Optional name of the specific pattern (e.g., 'aws-lambda-dynamodb') |
| 128 | +`services`|`string` *optional*|Optional list of AWS services to search for patterns that use them |
| 129 | + |
| 130 | +--- |
| 131 | +#### Tool: **`LambdaLayerDocumentationProvider`** |
| 132 | +Provide documentation sources for Lambda layers. |
| 133 | + |
| 134 | + This tool returns information about where to find documentation for Lambda layers |
| 135 | + and instructs the MCP Client to fetch and process this documentation. |
| 136 | +Parameters|Type|Description |
| 137 | +-|-|- |
| 138 | +`layer_type`|`string`|Type of layer ("generic" or "python") |
| 139 | + |
| 140 | +--- |
| 141 | +#### Tool: **`SearchGenAICDKConstructs`** |
| 142 | +Search for GenAI CDK constructs by name or type. |
| 143 | + |
| 144 | + The search is flexible and will match any of your search terms (OR logic). |
| 145 | + It handles common variations like singular/plural forms and terms with/without spaces. |
| 146 | + Content is fetched dynamically from GitHub to ensure the most up-to-date documentation. |
| 147 | + |
| 148 | + Examples: |
| 149 | + - "bedrock agent" - Returns all agent-related constructs |
| 150 | + - "knowledgebase vector" - Returns knowledge base constructs related to vector stores |
| 151 | + - "agent actiongroups" - Returns action groups for agents |
| 152 | + - "opensearch vector" - Returns OpenSearch vector constructs |
| 153 | + |
| 154 | + The search supports subdirectory content (like knowledge bases and their sections) |
| 155 | + and will find matches across all available content. |
| 156 | +Parameters|Type|Description |
| 157 | +-|-|- |
| 158 | +`construct_type`|`string` *optional*|Optional filter by construct type ('bedrock', 'opensearchserverless', etc.) |
| 159 | +`query`|`string` *optional*|Search term(s) to find constructs by name or description |
| 160 | + |
| 161 | +--- |
| 162 | +## Use this MCP Server |
| 163 | + |
| 164 | +```json |
| 165 | +{ |
| 166 | + "mcpServers": { |
| 167 | + "aws-cdk-mcp-server": { |
| 168 | + "command": "docker", |
| 169 | + "args": [ |
| 170 | + "run", |
| 171 | + "-i", |
| 172 | + "--rm", |
| 173 | + "mcp/aws-cdk-mcp-server" |
| 174 | + ] |
| 175 | + } |
| 176 | + } |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +[Why is it safer to run MCP Servers with Docker?](https://www.docker.com/blog/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker/) |
0 commit comments