@@ -29,6 +29,7 @@ export interface MCPServerStackProps extends cdk.StackProps {
2929 cognitoUserPool : cognito . UserPool ;
3030 userPoolClientId : string ;
3131 userPoolClientSecret : cdk . SecretValue ;
32+ domainSuffix : string ;
3233}
3334
3435/**
@@ -56,9 +57,19 @@ export class MCPServerStack extends cdk.Stack {
5657 // Create shared ECS cluster for all MCP servers
5758 this . cluster = new ecs . Cluster ( this , "MCPCluster" , {
5859 vpc : props . vpc ,
59- containerInsights : true ,
60+ //containerInsights: true,
61+ containerInsightsV2 : ecs . ContainerInsights . ENHANCED
6062 } ) ;
6163
64+ // Add suppression for Container Insight (Deprecated) not be enabled while Container Insight V2 is enabled
65+ NagSuppressions . addResourceSuppressions ( this . cluster , [
66+ {
67+ id : "AwsSolutions-ECS4" ,
68+ reason :
69+ "Container Insights V2 is Enabled with Enhanced capabilities, the Nag findings is about Container Insights (v1) which is deprecated" ,
70+ } ,
71+ ] ) ;
72+
6273 // Create context parameter for optional certificate ARN and custom domain
6374 const certificateArn = this . node . tryGetContext ( "certificateArn" ) ;
6475 const customDomain = this . node . tryGetContext ( "customDomain" ) ;
@@ -199,7 +210,7 @@ export class MCPServerStack extends cdk.Stack {
199210 AWS_REGION : this . region ,
200211 COGNITO_USER_POOL_ID : props . cognitoUserPool . userPoolId ,
201212 COGNITO_CLIENT_ID : props . userPoolClientId ,
202- COGNITO_DOMAIN : `mcp-server-${ props . resourceSuffix } ` ,
213+ COGNITO_DOMAIN : `mcp-server-${ props . domainSuffix } ` ,
203214 TOKEN_TABLE_NAME : tokenTable . tableName , // Pass the DynamoDB table name
204215 } ,
205216 secrets : {
@@ -238,7 +249,7 @@ export class MCPServerStack extends cdk.Stack {
238249 AWS_REGION : this . region ,
239250 COGNITO_USER_POOL_ID : props . cognitoUserPool . userPoolId ,
240251 COGNITO_CLIENT_ID : props . userPoolClientId ,
241- COGNITO_DOMAIN : `mcp-server-${ props . resourceSuffix } ` ,
252+ COGNITO_DOMAIN : `mcp-server-${ props . domainSuffix } ` ,
242253 TOKEN_TABLE_NAME : tokenTable . tableName , // Pass the DynamoDB table name
243254 } ,
244255 tokenTable : tokenTable , // Pass the table resource to grant permissions
@@ -272,7 +283,7 @@ export class MCPServerStack extends cdk.Stack {
272283 AWS_REGION : this . region ,
273284 COGNITO_USER_POOL_ID : props . cognitoUserPool . userPoolId ,
274285 COGNITO_CLIENT_ID : props . userPoolClientId ,
275- COGNITO_DOMAIN : `mcp-server-${ props . resourceSuffix } ` ,
286+ COGNITO_DOMAIN : `mcp-server-${ props . domainSuffix } ` ,
276287 TOKEN_TABLE_NAME : tokenTable . tableName , // Pass the DynamoDB table name
277288 } ,
278289 tokenTable : tokenTable , // Pass the table resource to grant permissions
0 commit comments