AWS CDK MCP Server
Provides guidance and tools for the AWS Cloud Development Kit, including infrastructure patterns, GenAI constructs, and security compliance via CDK Nag. It streamlines development by generating Bedrock Agent schemas and providing comprehensive documentation for Lambda layers and AWS Solutions Constructs.
README
AWS CDK MCP Server
MCP server for AWS Cloud Development Kit (CDK) best practices, infrastructure as code patterns, and security compliance with CDK Nag.
Features
CDK General Guidance
- Prescriptive patterns with AWS Solutions Constructs and GenAI CDK libraries
- Structured decision flow for choosing appropriate implementation approaches
- Security automation through CDK Nag integration and Lambda Powertools
CDK Nag Integration
- Work with CDK Nag rules for security and compliance
- Explain specific CDK Nag rules with AWS Well-Architected guidance
- Check if CDK code contains Nag suppressions that require human review
AWS Solutions Constructs
- Search and discover AWS Solutions Constructs patterns
- Find recommended patterns for common architecture needs
- Get detailed documentation on Solutions Constructs
Generative AI CDK Constructs
- Search for GenAI CDK constructs by name or type
- Discover specialized constructs for AI/ML workloads
- Get implementation guidance for generative AI applications
Lambda Layer Documentation Provider
- Access comprehensive documentation for AWS Lambda layers
- Get code examples for generic Lambda layers and Python-specific layers
- Retrieve directory structure information and implementation best practices
- Seamless integration with AWS Documentation MCP Server for detailed documentation
Amazon Bedrock Agent Schema Generation
- Use this tool when creating Bedrock Agents with Action Groups that use Lambda functions
- Streamline the creation of Bedrock Agent schemas
- Convert code files to compatible OpenAPI specifications
Developer Notes
- Requirements: Your Lambda function must use
BedrockAgentResolverfrom AWS Lambda Powertools - 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.
- Integration: Use the generated schema with
bedrock.ApiSchema.fromLocalAsset()in your CDK code
CDK Implementation Workflow
This diagram provides a comprehensive view of the recommended CDK implementation workflow:
graph TD
Start([Start]) --> A["CDKGeneralGuidance"]
A --> Init["cdk init app"]
Init --> B{Choose Approach}
B -->|"Common Patterns"| C1["GetAwsSolutionsConstructPattern"]
B -->|"GenAI Features"| C2["SearchGenAICDKConstructs"]
B -->|"Custom Needs"| C3["Custom CDK Code"]
C1 --> D1["Implement Solutions Construct"]
C2 --> D2["Implement GenAI Constructs"]
C3 --> D3["Implement Custom Resources"]
%% Bedrock Agent with Action Groups specific flow
D2 -->|"For Bedrock Agents<br/>with Action Groups"| BA["Create Lambda with<br/>BedrockAgentResolver"]
%% Schema generation flow
BA --> BS["GenerateBedrockAgentSchema"]
BS -->|"Success"| JSON["openapi.json created"]
BS -->|"Import Errors"| BSF["Tool generates<br/>generate_schema.py"]
BSF -->|"Missing dependencies?"| InstallDeps["Install dependencies"]
InstallDeps --> BSR["Run script manually:<br/>python generate_schema.py"]
BSR --> JSON["openapi.json created"]
%% Use schema in Agent CDK
JSON --> AgentCDK["Use schema in<br/>Agent CDK code"]
AgentCDK --> D2
%% Conditional Lambda Powertools implementation
D1 & D2 & D3 --> HasLambda{"Using Lambda<br/>Functions?"}
HasLambda --> UseLayer{"Using Lambda<br/>Layers?"}
UseLayer -->|"Yes"| LLDP["LambdaLayerDocumentationProvider"]
HasLambda -->|"No"| SkipL["Skip"]
%% Rest of workflow
LLDP["LambdaLayerDocumentationProvider"] --> Synth["cdk synth"]
SkipL --> Synth
Synth --> Nag{"CDK Nag<br/>warnings?"}
Nag -->|Yes| E["ExplainCDKNagRule"]
Nag -->|No| Deploy["cdk deploy"]
E --> Fix["Fix or Add Suppressions"]
Fix --> CN["CheckCDKNagSuppressions"]
CN --> Synth
%% Styling with darker colors
classDef default fill:#424242,stroke:#ffffff,stroke-width:1px,color:#ffffff;
classDef cmd fill:#4a148c,stroke:#ffffff,stroke-width:1px,color:#ffffff;
classDef tool fill:#01579b,stroke:#ffffff,stroke-width:1px,color:#ffffff;
classDef note fill:#1b5e20,stroke:#ffffff,stroke-width:1px,color:#ffffff;
classDef output fill:#006064,stroke:#ffffff,stroke-width:1px,color:#ffffff;
classDef decision fill:#5d4037,stroke:#ffffff,stroke-width:1px,color:#ffffff;
class Init,Synth,Deploy,BSR cmd;
class A,C1,C2,BS,E,CN,LLDP tool;
class JSON output;
class HasLambda,UseLayer,Nag decision;
Available MCP Tools
- CDKGeneralGuidance: Get prescriptive advice for building AWS applications with CDK
- GetAwsSolutionsConstructPattern: Find vetted architecture patterns combining AWS services
- SearchGenAICDKConstructs: Discover GenAI CDK constructs by name or features
- GenerateBedrockAgentSchema: Create OpenAPI schemas for Bedrock Agent action groups
- LambdaLayerDocumentationProvider: Access documentation for Lambda layers implementation
- ExplainCDKNagRule: Get detailed guidance on CDK Nag security rules
- CheckCDKNagSuppressions: Validate CDK Nag suppressions in your code
Available MCP Resources
- CDK Nag Rules: Access rule packs via
cdk-nag://rules/{rule_pack} - AWS Solutions Constructs: Access patterns via
aws-solutions-constructs://{pattern_name} - GenAI CDK Constructs: Access documentation via
genai-cdk-constructs://{construct_type}/{construct_name} - Lambda Powertools: Get guidance on Lambda Powertools via
lambda-powertools://{topic}
Prerequisites
- Install
uvfrom Astral or the GitHub README - Install Python using
uv python install 3.10 - Install AWS CDK CLI using
npm install -g aws-cdk(Note: The MCP server itself doesn't use the CDK CLI directly, but it guides users through CDK application development that requires the CLI)
Installation
Configure the MCP server in your MCP client configuration (e.g., for Amazon Q Developer CLI, edit ~/.aws/amazonq/mcp.json):
{
"mcpServers": {
"awslabs.cdk-mcp-server": {
"command": "uvx",
"args": ["awslabs.cdk-mcp-server@latest"],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR"
},
"disabled": false,
"autoApprove": []
}
}
}
or docker after a successful docker build -t awslabs/cdk-mcp-server .:
{
"mcpServers": {
"awslabs.cdk-mcp-server": {
"command": "docker",
"args": [
"run",
"--rm",
"--interactive",
"--env",
"FASTMCP_LOG_LEVEL=ERROR",
"awslabs/cdk-mcp-server:latest"
],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
Security Considerations
When using this MCP server, you should consider:
- Reviewing all CDK Nag warnings and errors manually
- Fixing security issues rather than suppressing them whenever possible
- Documenting clear justifications for any necessary suppressions
- Using the CheckCDKNagSuppressions tool to verify no unauthorized suppressions exist
Before applying CDK NAG Suppressions, you should consider conducting your own independent assessment to ensure that your use would comply with your own specific security and quality control practices and standards, as well as the local laws, rules, and regulations that govern you and your content.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。