AWS CDK MCP Server
Get prescriptive AWS CDK guidance through the Model Context Protocol. Provides best-practice construct patterns, stack architecture advice, and deployment strategies for AWS infrastructure defined in TypeScript or Python.
MCP Server Configuration
Add to .claude/settings.json:
{ "mcpServers": { "aws-cdk": { "command": "npx", "args": ["-y", "@anthropic/claude-mcp-aws-cdk"], "env": { "AWS_REGION": "us-east-1", "AWS_PROFILE": "default" } } } }
Available Tools
| Tool | Description |
|---|---|
GetConstructAdvice | Get best-practice patterns for specific AWS services |
ReviewStack | Analyze a CDK stack for anti-patterns and security issues |
GenerateConstruct | Generate a CDK construct from a description of requirements |
ExplainDeployment | Explain what cdk deploy will do for a given stack |
MigrateCfn | Convert CloudFormation templates to CDK TypeScript |
Common Patterns
VPC with Best Practices
import * as ec2 from 'aws-cdk-lib/aws-ec2'; import { Stack, StackProps } from 'aws-cdk-lib'; export class NetworkStack extends Stack { public readonly vpc: ec2.Vpc; constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); this.vpc = new ec2.Vpc(this, 'MainVpc', { maxAzs: 3, natGateways: 1, // Cost optimization: 1 NAT GW for non-prod subnetConfiguration: [ { name: 'Public', subnetType: ec2.SubnetType.PUBLIC, cidrMask: 24, }, { name: 'Private', subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, cidrMask: 24, }, { name: 'Isolated', subnetType: ec2.SubnetType.PRIVATE_ISOLATED, cidrMask: 24, }, ], flowLogs: { 'FlowLog': { destination: ec2.FlowLogDestination.toCloudWatchLogs(), trafficType: ec2.FlowLogTrafficType.REJECT, }, }, }); } }
Lambda API with API Gateway
import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; import * as apigw from 'aws-cdk-lib/aws-apigateway'; const handler = new lambda.NodejsFunction(this, 'ApiHandler', { entry: 'src/handlers/api.ts', runtime: lambda.Runtime.NODEJS_20_X, memorySize: 256, timeout: Duration.seconds(30), tracing: lambda.Tracing.ACTIVE, environment: { TABLE_NAME: table.tableName, }, bundling: { minify: true, sourceMap: true, }, }); const api = new apigw.RestApi(this, 'Api', { restApiName: 'my-service', deployOptions: { stageName: 'prod', throttlingRateLimit: 1000, throttlingBurstLimit: 500, }, });
Setup
- Install the AWS CDK CLI:
npm install -g aws-cdk - Configure AWS credentials:
aws configureor setAWS_PROFILE - Add the MCP server configuration to
.claude/settings.json - Bootstrap CDK in your account:
cdk bootstrap aws://ACCOUNT/REGION
Security Notes
- The MCP server uses your local AWS credentials (never transmits them)
- Review generated IAM policies before deploying -- prefer least-privilege
- Enable CDK Nag for automated compliance checks:
import { AwsSolutionsChecks } from 'cdk-nag' - Use
cdk diffto review changes beforecdk deploy - Store secrets in AWS Secrets Manager, reference via
secretsmanager.Secret.fromSecretNameV2()
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Database MCP Integration
MCP server configuration for connecting Claude Code to PostgreSQL, MySQL, and MongoDB databases. Enables schema inspection, query building, and migration generation.
Elevenlabs Server
Streamline your workflow with this official, elevenlabs, text, speech. Includes structured workflows, validation checks, and reusable patterns for audio.
Browser Use Portal
Powerful mcp for server, enables, agents, control. Includes structured workflows, validation checks, and reusable patterns for browser_automation.