AWS CDK MCP Server

$npx -y @akm-2018/tmp_cdk_mcp_server
README.md

MCP server for AWS Cloud Development Kit (CDK) best practices and patterns.

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 BedrockAgentResolver from 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 Agentswith Action Groups"| BA["Create Lambda withBedrockAgentResolver"]

    %% Schema generation flow
    BA --> BS["GenerateBedrockAgentSchema"]
    BS -->|"Success"| JSON["openapi.json created"]
    BS -->|"Import Errors"| BSF["Tool generatesgenerate_schema.py"]
    BSF -->|"Missing dependencies?"| InstallDeps["Install dependencies"]
    InstallDeps --> BSR["Run script manually:python generate_schema.py"]
    BSR --> JSON["openapi.json created"]

    %% Use schema in Agent CDK
    JSON --> AgentCDK["Use schema inAgent CDK code"]
    AgentCDK --> D2

    %% Conditional Lambda Powertools implementation
    D1 & D2 & D3 --> HasLambda{"Using LambdaFunctions?"}
    HasLambda --> UseLayer{"Using LambdaLayers?"}
    UseLayer -->|"Yes"| LLDP["LambdaLayerDocumentationProvider"]

    HasLambda -->|"No"| SkipL["Skip"]

    %% Rest of workflow
    LLDP["LambdaLayerDocumentationProvider"] --> Synth["cdk synth"]
    SkipL --> Synth

    Synth --> Nag{"CDK Nagwarnings?"}
    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 implementa

Tools (7)

CDKGeneralGuidanceGet prescriptive advice for building AWS applications with CDK
GetAwsSolutionsConstructPatternFind vetted architecture patterns combining AWS services
SearchGenAICDKConstructsDiscover GenAI CDK constructs by name or features
GenerateBedrockAgentSchemaCreate OpenAPI schemas for Bedrock Agent action groups
LambdaLayerDocumentationProviderAccess documentation for Lambda layers implementation
ExplainCDKNagRuleExplain specific CDK Nag rules with AWS Well-Architected guidance
CheckCDKNagSuppressionsCheck if CDK code contains Nag suppressions that require human review

Configuration

claude_desktop_config.json
{
  "mcpServers": {
    "aws-cdk": {
      "command": "npx",
      "args": ["-y", "@akm-2018/tmp_cdk_mcp_server"]
    }
  }
}

Try it

Search for AWS Solutions Constructs patterns that combine S3 and Lambda.
Explain the CDK Nag rule for S3 Bucket versioning and how to fix it.
Generate an OpenAPI schema for my Bedrock Agent action group from this Lambda function code.
Find GenAI CDK constructs suitable for building a RAG application.
Get documentation and implementation examples for the Python Lambda Powertools layer.

Frequently Asked Questions

What are the key features of AWS CDK MCP Server?

Prescriptive patterns with AWS Solutions Constructs and GenAI CDK libraries.. Security automation through CDK Nag integration and Well-Architected guidance.. Automated Amazon Bedrock Agent schema generation from Lambda code.. Comprehensive documentation provider for AWS Lambda layers and Powertools..

What can I use AWS CDK MCP Server for?

Architecting secure AWS infrastructure using vetted Solutions Constructs.. Resolving security compliance warnings by explaining and fixing CDK Nag violations.. Building Generative AI agents by automatically generating required OpenAPI schemas.. Implementing Lambda functions with standardized layers and best practices..

How do I install AWS CDK MCP Server?

Install AWS CDK MCP Server by running: npx -y @akm-2018/tmp_cdk_mcp_server

What MCP clients work with AWS CDK MCP Server?

AWS CDK MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use AWS CDK MCP Server with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free