AWS Cloud Development Kit MCP server

Integration for AWS Cloud Development Kit (CDK) best practices, infrastructure as code patterns, and security compliance with CDK Nag.
Back to servers
Setup instructions
Provider
AWS
Release date
Apr 04, 2025
Language
Python
Package
Stats
6.2K stars

The AWS CDK MCP Server is a specialized tool that provides prescriptive guidance, infrastructure patterns, and security compliance features for AWS Cloud Development Kit (CDK) applications. It offers integration with CDK Nag for security checks, AWS Solutions Constructs for common patterns, and specialized tools for generative AI applications.

Installation

Prerequisites

  1. Install uv package manager from Astral's documentation
  2. Install Python using uv python install 3.10
  3. Install AWS CDK CLI using npm install -g aws-cdk

Setup Instructions

Configure the MCP server in your MCP client configuration file. 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": []
    }
  }
}

Windows-Specific Installation

For Windows users, use this configuration format:

{
  "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"
      }
    }
  }
}

Docker Installation

If using Docker, build the image first with docker build -t awslabs/cdk-mcp-server . and then use:

{
  "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": []
    }
  }
}

Features and Usage

CDK General Guidance

The server provides prescriptive patterns with AWS Solutions Constructs and GenAI CDK libraries to help you make informed decisions about implementation approaches.

CDK Nag Integration

  • Work with CDK Nag rules for security and compliance
  • Get explanations for specific CDK Nag rules with AWS Well-Architected guidance
  • Validate if your CDK code contains Nag suppressions that require review

AWS Solutions Constructs

  • Search and discover pre-built AWS Solutions Constructs patterns
  • Find recommended patterns for common architecture needs
  • Access detailed documentation on Solutions Constructs implementation

Generative AI CDK Constructs

  • Search for specialized GenAI CDK constructs by name or type
  • Discover constructs designed for AI/ML workloads
  • Get implementation guidance for generative AI applications

Lambda Layer Documentation

  • 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

Bedrock Agent Schema Generation

For Bedrock Agents with Action Groups using Lambda functions:

  1. Create a Lambda function that uses BedrockAgentResolver from AWS Lambda Powertools
  2. Use the GenerateBedrockAgentSchema tool to convert code to OpenAPI specifications
  3. If schema generation fails, a fallback script will be generated
  4. Use the generated schema with bedrock.ApiSchema.fromLocalAsset() in your CDK code

Available MCP Tools

The server provides several specialized tools:

  • CDKGeneralGuidance: Get prescriptive advice for building AWS applications with CDK
  • GetAwsSolutionsConstructPattern: Find vetted architecture patterns
  • SearchGenAICDKConstructs: Discover GenAI CDK constructs
  • GenerateBedrockAgentSchema: Create OpenAPI schemas for Bedrock Agent action groups
  • LambdaLayerDocumentationProvider: Access Lambda layers documentation
  • ExplainCDKNagRule: Get detailed guidance on security rules
  • CheckCDKNagSuppressions: Validate CDK Nag suppressions in your code

Security Considerations

When using this MCP server:

  • Review all CDK Nag warnings and errors manually
  • Fix security issues rather than suppressing them when possible
  • Document clear justifications for any necessary suppressions
  • Use the CheckCDKNagSuppressions tool to verify no unauthorized suppressions exist

Before applying CDK NAG Suppressions, conduct your own independent security assessment to ensure compliance with your organization's security standards and applicable regulations.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later