Skip to main content

An AWS CDK MCP server that provides guidance on AWS Cloud Development Kit best practices, infrastructure as code patterns, and security compliance with CDK Nag. This server offers tools to validate infrastructure designs, explain CDK Nag rules, analyze suppressions, generate Bedrock Agent schemas, and discover Solutions Constructs patterns.

Project description

AWS CDK MCP Server

⚠️ DEPRECATION NOTICE: This server is deprecated and will be removed in a future release. Please use the AWS IaC MCP Server instead, which provides all CDK functionality along with additional Infrastructure as Code capabilities.

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 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

  1. Install uv from Astral or the GitHub README
  2. Install Python using uv python install 3.10
  3. 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

Kiro Cursor VS Code
Add to Kiro Install MCP Server Install on VS Code

Configure the MCP server in your MCP client configuration (e.g., for Kiro, edit ~/.kiro/settings/mcp.json):

{
  "mcpServers": {
    "awslabs.cdk-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.cdk-mcp-server@latest"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Windows Installation

For Windows users, the MCP server configuration format is slightly different:

{
  "mcpServers": {
    "awslabs.cdk-mcp-server": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "uv",
      "args": [
        "tool",
        "run",
        "--from",
        "awslabs.cdk-mcp-server@latest",
        "awslabs.cdk-mcp-server.exe"
      ],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "AWS_PROFILE": "your-aws-profile",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awslabs_cdk_mcp_server-1.0.15.tar.gz (152.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

awslabs_cdk_mcp_server-1.0.15-py3-none-any.whl (71.2 kB view details)

Uploaded Python 3

File details

Details for the file awslabs_cdk_mcp_server-1.0.15.tar.gz.

File metadata

  • Download URL: awslabs_cdk_mcp_server-1.0.15.tar.gz
  • Upload date:
  • Size: 152.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for awslabs_cdk_mcp_server-1.0.15.tar.gz
Algorithm Hash digest
SHA256 ba900682bd2116024f2bf172aeb77924601fc0516462b9bfe8fcbfce0acf1746
MD5 5ad1e846adaeb0387925b72069989260
BLAKE2b-256 bf62db5551e0dd676f3b52164a7b60af51f0ea0722c556d3c44e1759931e3dcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_cdk_mcp_server-1.0.15.tar.gz:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file awslabs_cdk_mcp_server-1.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for awslabs_cdk_mcp_server-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 25c03cbffcb3afe50ec7276d97ede3cd8d92ee09b97dc3fe8f6edfc0684bec19
MD5 ec2bfc32090622153816db0c3ef589bc
BLAKE2b-256 72def59fde27c7d66fff2dd46d80729eccf50715dd752c1f63631aaa87b2157c

See more details on using hashes here.

Provenance

The following attestation bundles were made for awslabs_cdk_mcp_server-1.0.15-py3-none-any.whl:

Publisher: release.yml on awslabs/mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page