@aws/nx-plugin 1.0.0-rc.43 → 1.0.0-rc.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +121 -154
- package/generators.json +6 -0
- package/package.json +4 -4
- package/src/agentcore-gateway/files/cedar/policies/README.md +9 -0
- package/src/agentcore-gateway/files/cedar/policies/permit-all.cedar +15 -0
- package/src/agentcore-gateway/generator.js +12 -5
- package/src/agentcore-gateway/generator.js.map +1 -1
- package/src/agentcore-gateway/schema.d.js.map +1 -1
- package/src/agentcore-gateway/schema.d.ts +1 -1
- package/src/agentcore-gateway/schema.json +3 -2
- package/src/connection/generator.js +1 -1
- package/src/connection/generator.js.map +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/mcp-server/tools/general-guidance.js +1 -1
- package/src/mcp-server/tools/general-guidance.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +6 -3
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +6 -6
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +2 -2
- package/src/py/agent/gateway-connection/generator.js +1 -1
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +21 -5
- package/src/py/rdb/files/Dockerfile.create-db-user.template +4 -0
- package/src/py/rdb/files/Dockerfile.migration.template +4 -0
- package/src/sdk/ts.d.ts +2 -0
- package/src/sdk/ts.js +2 -0
- package/src/sdk/ts.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +7 -3
- package/src/ts/agent/files/deploy/Dockerfile.template +5 -1
- package/src/ts/agent/gateway-connection/generator.js +1 -1
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/generator.js +6 -0
- package/src/ts/agent/generator.js.map +1 -1
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +982 -0
- package/src/ts/dcr-proxy/generator.d.ts +10 -0
- package/src/ts/dcr-proxy/generator.js +98 -0
- package/src/ts/dcr-proxy/generator.js.map +1 -0
- package/src/ts/dcr-proxy/schema.d.js +6 -0
- package/src/ts/dcr-proxy/schema.d.js.map +1 -0
- package/src/ts/dcr-proxy/schema.d.ts +13 -0
- package/src/ts/dcr-proxy/schema.json +44 -0
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +4 -8
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/files/Dockerfile.template +5 -1
- package/src/ts/mcp-server/generator.js +1 -0
- package/src/ts/mcp-server/generator.js.map +1 -1
- package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/nx-plugin/files/mcp-server/resources/GENERAL_GUIDANCE.md.template +1 -1
- package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +1 -1
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +11 -4
- package/src/ts/rdb/files/Dockerfile.template +7 -0
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +28 -28
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +1 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js +2 -0
- package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
- package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +38 -3
- package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +13 -3
- package/src/utils/agent-core-constructs/files/terraform/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.tf.template +22 -1
- package/src/utils/commands.js +1 -1
- package/src/utils/commands.js.map +1 -1
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.d.ts +38 -0
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js +93 -0
- package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js.map +1 -0
- package/src/utils/dcr-proxy-constructs/files/cdk/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.ts.template +227 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorization-server-metadata.ts.template +39 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/authorize.ts.template +26 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/mcp-proxy.ts.template +89 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/protected-resource-metadata.ts.template +13 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/register.ts.template +70 -0
- package/src/utils/dcr-proxy-constructs/files/project/src/handlers/token.ts.template +75 -0
- package/src/utils/dcr-proxy-constructs/files/terraform/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.tf.template +410 -0
- package/src/utils/docker.d.ts +4 -3
- package/src/utils/docker.js +11 -7
- package/src/utils/docker.js.map +1 -1
- package/src/utils/files/common/scripts/src/dynamodb/start-container.ts.template +1 -3
- package/src/utils/files/common/scripts/src/rdb/shared/start-container.ts.template +1 -3
- package/src/utils/format.d.ts +1 -1
- package/src/utils/format.js +3 -2
- package/src/utils/format.js.map +1 -1
- package/src/utils/init.js +4 -0
- package/src/utils/init.js.map +1 -1
- package/src/utils/versions.d.ts +53 -51
- package/src/utils/versions.js +53 -49
- package/src/utils/versions.js.map +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
6
|
+
import { type NxGeneratorInfo } from '../../utils/nx';
|
|
7
|
+
import type { TsDcrProxyGeneratorSchema } from './schema';
|
|
8
|
+
export declare const TS_DCR_PROXY_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const tsDcrProxyGenerator: (tree: Tree, options: TsDcrProxyGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default tsDcrProxyGenerator;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import { addDependenciesToPackageJson, generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
|
|
5
|
+
import tsProjectGenerator from "../lib/generator.js";
|
|
6
|
+
import { addTypeScriptBundleTarget } from "../../utils/bundle/bundle.js";
|
|
7
|
+
import { addDcrProxyInfra, DCR_PROXY_HANDLERS } from "../../utils/dcr-proxy-constructs/dcr-proxy-constructs.js";
|
|
8
|
+
import { formatFilesInSubtree } from "../../utils/format.js";
|
|
9
|
+
import { resolveIac } from "../../utils/iac.js";
|
|
10
|
+
import { installDependencies } from "../../utils/install.js";
|
|
11
|
+
import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
|
|
12
|
+
import { kebabCase, toClassName } from "../../utils/names.js";
|
|
13
|
+
import { getNpmScopePrefix } from "../../utils/npm-scope.js";
|
|
14
|
+
import { getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
|
|
15
|
+
import { sortObjectKeys } from "../../utils/object.js";
|
|
16
|
+
import { sharedConstructsGenerator } from "../../utils/shared-constructs.js";
|
|
17
|
+
import { withVersions } from "../../utils/versions.js";
|
|
18
|
+
export const TS_DCR_PROXY_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
|
|
19
|
+
export const tsDcrProxyGenerator = async (tree, options)=>{
|
|
20
|
+
const name = kebabCase(options.name ? options.name : 'dcr-proxy');
|
|
21
|
+
const nameClassName = toClassName(name);
|
|
22
|
+
const iac = await resolveIac(tree, options.iac);
|
|
23
|
+
// The handlers live in a standalone TypeScript project so they can be bundled
|
|
24
|
+
// (rolldown) into deployable artifacts referenced by both CDK and Terraform.
|
|
25
|
+
const namespace = getNpmScopePrefix(tree);
|
|
26
|
+
const proxyProjectName = `${namespace}${name}`;
|
|
27
|
+
let projectExists;
|
|
28
|
+
try {
|
|
29
|
+
readProjectConfigurationUnqualified(tree, proxyProjectName);
|
|
30
|
+
projectExists = true;
|
|
31
|
+
} catch {
|
|
32
|
+
projectExists = false;
|
|
33
|
+
}
|
|
34
|
+
if (!projectExists) {
|
|
35
|
+
await tsProjectGenerator(tree, {
|
|
36
|
+
name,
|
|
37
|
+
directory: options.directory,
|
|
38
|
+
subDirectory: options.subDirectory,
|
|
39
|
+
preferInstallDependencies: false
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const projectConfig = readProjectConfigurationUnqualified(tree, proxyProjectName);
|
|
43
|
+
const proxyRoot = projectConfig.root;
|
|
44
|
+
// Place the Lambda handlers in the project source
|
|
45
|
+
generateFiles(tree, joinPathFragments(import.meta.dirname, '..', '..', 'utils', 'dcr-proxy-constructs', 'files', 'project'), proxyRoot, {
|
|
46
|
+
nameClassName,
|
|
47
|
+
nameKebabCase: name
|
|
48
|
+
}, {
|
|
49
|
+
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
50
|
+
});
|
|
51
|
+
// The token handler imports @aws-sdk/client-secrets-manager (provided by the
|
|
52
|
+
// Lambda runtime but needed for type-checking and local dev) and the handlers
|
|
53
|
+
// are typed against @types/aws-lambda.
|
|
54
|
+
addDependenciesToPackageJson(tree, withVersions([
|
|
55
|
+
'@aws-sdk/client-secrets-manager'
|
|
56
|
+
]), withVersions([
|
|
57
|
+
'@types/aws-lambda'
|
|
58
|
+
]));
|
|
59
|
+
// Bundle each handler independently to dist/<root>/bundle/<handler>/index.js
|
|
60
|
+
for (const handler of DCR_PROXY_HANDLERS){
|
|
61
|
+
await addTypeScriptBundleTarget(tree, projectConfig, {
|
|
62
|
+
targetFilePath: `src/handlers/${handler}.ts`,
|
|
63
|
+
bundleOutputDir: handler,
|
|
64
|
+
external: [
|
|
65
|
+
/@aws-sdk\/.*/
|
|
66
|
+
],
|
|
67
|
+
platform: 'node'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
projectConfig.targets = sortObjectKeys(projectConfig.targets);
|
|
71
|
+
updateProjectConfiguration(tree, projectConfig.name, projectConfig);
|
|
72
|
+
const bundlePathsFromRoot = Object.fromEntries(DCR_PROXY_HANDLERS.map((handler)=>[
|
|
73
|
+
handler,
|
|
74
|
+
joinPathFragments('dist', proxyRoot, 'bundle', handler)
|
|
75
|
+
]));
|
|
76
|
+
await sharedConstructsGenerator(tree, {
|
|
77
|
+
iac
|
|
78
|
+
});
|
|
79
|
+
await addDcrProxyInfra(tree, {
|
|
80
|
+
dcrProxyNameClassName: nameClassName,
|
|
81
|
+
dcrProxyNameKebabCase: name,
|
|
82
|
+
proxyProjectName,
|
|
83
|
+
bundlePathsFromRoot,
|
|
84
|
+
iac
|
|
85
|
+
});
|
|
86
|
+
await addGeneratorMetricsIfApplicable(tree, [
|
|
87
|
+
TS_DCR_PROXY_GENERATOR_INFO
|
|
88
|
+
]);
|
|
89
|
+
await formatFilesInSubtree(tree);
|
|
90
|
+
return ()=>installDependencies(tree, options.preferInstallDependencies, {
|
|
91
|
+
languages: [
|
|
92
|
+
'typescript'
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
export default tsDcrProxyGenerator;
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dcr-proxy/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport tsProjectGenerator from '../../ts/lib/generator';\nimport { addTypeScriptBundleTarget } from '../../utils/bundle/bundle';\nimport {\n addDcrProxyInfra,\n DCR_PROXY_HANDLERS,\n type DcrProxyHandler,\n} from '../../utils/dcr-proxy-constructs/dcr-proxy-constructs';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScopePrefix } from '../../utils/npm-scope';\nimport {\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { withVersions } from '../../utils/versions';\nimport type { TsDcrProxyGeneratorSchema } from './schema';\n\nexport const TS_DCR_PROXY_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsDcrProxyGenerator = async (\n tree: Tree,\n options: TsDcrProxyGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const name = kebabCase(options.name ? options.name : 'dcr-proxy');\n const nameClassName = toClassName(name);\n\n const iac = await resolveIac(tree, options.iac);\n\n // The handlers live in a standalone TypeScript project so they can be bundled\n // (rolldown) into deployable artifacts referenced by both CDK and Terraform.\n const namespace = getNpmScopePrefix(tree);\n const proxyProjectName = `${namespace}${name}`;\n\n let projectExists: boolean;\n try {\n readProjectConfigurationUnqualified(tree, proxyProjectName);\n projectExists = true;\n } catch {\n projectExists = false;\n }\n\n if (!projectExists) {\n await tsProjectGenerator(tree, {\n name,\n directory: options.directory,\n subDirectory: options.subDirectory,\n preferInstallDependencies: false,\n });\n }\n\n const projectConfig = readProjectConfigurationUnqualified(\n tree,\n proxyProjectName,\n );\n const proxyRoot = projectConfig.root;\n\n // Place the Lambda handlers in the project source\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n '..',\n '..',\n 'utils',\n 'dcr-proxy-constructs',\n 'files',\n 'project',\n ),\n proxyRoot,\n { nameClassName, nameKebabCase: name },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n\n // The token handler imports @aws-sdk/client-secrets-manager (provided by the\n // Lambda runtime but needed for type-checking and local dev) and the handlers\n // are typed against @types/aws-lambda.\n addDependenciesToPackageJson(\n tree,\n withVersions(['@aws-sdk/client-secrets-manager']),\n withVersions(['@types/aws-lambda']),\n );\n\n // Bundle each handler independently to dist/<root>/bundle/<handler>/index.js\n for (const handler of DCR_PROXY_HANDLERS) {\n await addTypeScriptBundleTarget(tree, projectConfig, {\n targetFilePath: `src/handlers/${handler}.ts`,\n bundleOutputDir: handler,\n external: [/@aws-sdk\\/.*/], // lambda runtime provides the aws sdk\n platform: 'node',\n });\n }\n\n projectConfig.targets = sortObjectKeys(projectConfig.targets);\n updateProjectConfiguration(tree, projectConfig.name, projectConfig);\n\n const bundlePathsFromRoot = Object.fromEntries(\n DCR_PROXY_HANDLERS.map((handler) => [\n handler,\n joinPathFragments('dist', proxyRoot, 'bundle', handler),\n ]),\n ) as Record<DcrProxyHandler, string>;\n\n await sharedConstructsGenerator(tree, { iac });\n\n await addDcrProxyInfra(tree, {\n dcrProxyNameClassName: nameClassName,\n dcrProxyNameKebabCase: name,\n proxyProjectName,\n bundlePathsFromRoot,\n iac,\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_DCR_PROXY_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsDcrProxyGenerator;\n"],"names":["addDependenciesToPackageJson","generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","tsProjectGenerator","addTypeScriptBundleTarget","addDcrProxyInfra","DCR_PROXY_HANDLERS","formatFilesInSubtree","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","getNpmScopePrefix","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","sharedConstructsGenerator","withVersions","TS_DCR_PROXY_GENERATOR_INFO","filename","tsDcrProxyGenerator","tree","options","name","nameClassName","iac","namespace","proxyProjectName","projectExists","directory","subDirectory","preferInstallDependencies","projectConfig","proxyRoot","root","dirname","nameKebabCase","overwriteStrategy","KeepExisting","handler","targetFilePath","bundleOutputDir","external","platform","targets","bundlePathsFromRoot","Object","fromEntries","map","dcrProxyNameClassName","dcrProxyNameKebabCase","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAE5BC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,OAAOC,wBAAwB,sBAAyB;AACxD,SAASC,yBAAyB,QAAQ,+BAA4B;AACtE,SACEC,gBAAgB,EAChBC,kBAAkB,QAEb,2DAAwD;AAC/D,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,uBAAoB;AAC3D,SAASC,iBAAiB,QAAQ,2BAAwB;AAC1D,SACEC,gBAAgB,EAEhBC,mCAAmC,QAC9B,oBAAiB;AACxB,SAASC,cAAc,QAAQ,wBAAqB;AACpD,SAASC,yBAAyB,Q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ACF;IAEAX,cAAcY,OAAO,GAAG7B,eAAeiB,cAAcY,OAAO;IAC5D3C,2BAA2BoB,MAAMW,cAAcT,IAAI,EAAES;IAErD,MAAMa,sBAAsBC,OAAOC,WAAW,CAC5C1C,mBAAmB2C,GAAG,CAAC,CAACT,UAAY;YAClCA;YACAxC,kBAAkB,QAAQkC,WAAW,UAAUM;SAChD;IAGH,MAAMvB,0BAA0BK,MAAM;QAAEI;IAAI;IAE5C,MAAMrB,iBAAiBiB,MAAM;QAC3B4B,uBAAuBzB;QACvB0B,uBAAuB3B;QACvBI;QACAkB;QACApB;IACF;IAEA,MAAMhB,gCAAgCY,MAAM;QAACH;KAA4B;IAEzE,MAAMZ,qBAAqBe;IAC3B,OAAO,IACLb,oBAAoBa,MAAMC,QAAQS,yBAAyB,EAAE;YAC3DoB,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe/B,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/dcr-proxy/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { IacOption } from '../../utils/iac';\n\nexport interface TsDcrProxyGeneratorSchema {\n name?: string;\n directory?: string;\n subDirectory?: string;\n iac: IacOption;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD,WAMC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import type { IacOption } from '../../utils/iac';
|
|
6
|
+
|
|
7
|
+
export interface TsDcrProxyGeneratorSchema {
|
|
8
|
+
name?: string;
|
|
9
|
+
directory?: string;
|
|
10
|
+
subDirectory?: string;
|
|
11
|
+
iac: IacOption;
|
|
12
|
+
preferInstallDependencies?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ts#dcr-proxy",
|
|
4
|
+
"title": "ts#dcr-proxy",
|
|
5
|
+
"description": "Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of your DCR proxy, used for its TypeScript handler project, the construct/module class name, and its directory under common/constructs or common/terraform",
|
|
11
|
+
"default": "dcr-proxy",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "What would you like to call your DCR proxy?",
|
|
17
|
+
"x-priority": "important"
|
|
18
|
+
},
|
|
19
|
+
"directory": {
|
|
20
|
+
"description": "The directory to store the DCR proxy handler project in.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"alias": "dir",
|
|
23
|
+
"x-priority": "important",
|
|
24
|
+
"default": "packages"
|
|
25
|
+
},
|
|
26
|
+
"subDirectory": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "The sub directory the handler project is placed in. By default this is the project name."
|
|
29
|
+
},
|
|
30
|
+
"iac": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The preferred IaC provider (cdk or terraform). By default this is inherited from your initial selection.",
|
|
33
|
+
"enum": ["inherit", "cdk", "terraform"],
|
|
34
|
+
"x-priority": "important",
|
|
35
|
+
"default": "inherit",
|
|
36
|
+
"x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
|
|
37
|
+
},
|
|
38
|
+
"preferInstallDependencies": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
|
|
41
|
+
"default": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -35,7 +35,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
|
|
|
35
35
|
required_providers {
|
|
36
36
|
aws = {
|
|
37
37
|
source = "hashicorp/aws"
|
|
38
|
-
version = "6.
|
|
38
|
+
version = "6.55.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -192,7 +192,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
|
|
|
192
192
|
required_providers {
|
|
193
193
|
aws = {
|
|
194
194
|
source = "hashicorp/aws"
|
|
195
|
-
version = "6.
|
|
195
|
+
version = "6.55.0"
|
|
196
196
|
}
|
|
197
197
|
random = {
|
|
198
198
|
source = "hashicorp/random"
|
|
@@ -604,9 +604,7 @@ process.on('SIGTERM', cleanup);
|
|
|
604
604
|
process.on('SIGINT', cleanup);
|
|
605
605
|
process.on('SIGHUP', cleanup);
|
|
606
606
|
|
|
607
|
-
logs.on('exit',
|
|
608
|
-
if (!exiting) process.exit(code ?? 0);
|
|
609
|
-
});
|
|
607
|
+
logs.on('exit', cleanup);
|
|
610
608
|
"
|
|
611
609
|
`;
|
|
612
610
|
|
|
@@ -1254,9 +1252,7 @@ process.on('SIGTERM', cleanup);
|
|
|
1254
1252
|
process.on('SIGINT', cleanup);
|
|
1255
1253
|
process.on('SIGHUP', cleanup);
|
|
1256
1254
|
|
|
1257
|
-
logs.on('exit',
|
|
1258
|
-
if (!exiting) process.exit(code ?? 0);
|
|
1259
|
-
});
|
|
1255
|
+
logs.on('exit', cleanup);
|
|
1260
1256
|
"
|
|
1261
1257
|
`;
|
|
1262
1258
|
|
|
@@ -139,7 +139,7 @@ exports[`ts-lambda-function generator > terraform iac > should generate terrafor
|
|
|
139
139
|
required_providers {
|
|
140
140
|
aws = {
|
|
141
141
|
source = "hashicorp/aws"
|
|
142
|
-
version = "6.
|
|
142
|
+
version = "6.55.0"
|
|
143
143
|
}
|
|
144
144
|
archive = {
|
|
145
145
|
source = "hashicorp/archive"
|
|
@@ -320,7 +320,7 @@ exports[`ts-lambda-function generator > terraform iac > should match snapshot fo
|
|
|
320
320
|
required_providers {
|
|
321
321
|
aws = {
|
|
322
322
|
source = "hashicorp/aws"
|
|
323
|
-
version = "6.
|
|
323
|
+
version = "6.55.0"
|
|
324
324
|
}
|
|
325
325
|
archive = {
|
|
326
326
|
source = "hashicorp/archive"
|
|
@@ -152,7 +152,7 @@ exports[`ts#mcp-server generator > should match snapshot for Terraform generated
|
|
|
152
152
|
required_providers {
|
|
153
153
|
aws = {
|
|
154
154
|
source = "hashicorp/aws"
|
|
155
|
-
version = "6.
|
|
155
|
+
version = "6.55.0"
|
|
156
156
|
}
|
|
157
157
|
null = {
|
|
158
158
|
source = "hashicorp/null"
|
|
@@ -560,7 +560,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
560
560
|
|
|
561
561
|
provisioner "local-exec" {
|
|
562
562
|
command = <<-EOT
|
|
563
|
-
uv run --with boto3==1.43.
|
|
563
|
+
uv run --with boto3==1.43.51 python -c "
|
|
564
564
|
import boto3
|
|
565
565
|
import json
|
|
566
566
|
import os
|
|
@@ -7,7 +7,11 @@ WORKDIR /app
|
|
|
7
7
|
|
|
8
8
|
# Add AWS Distro for OpenTelemetry for observability
|
|
9
9
|
# https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/observability-configure.html
|
|
10
|
-
|
|
10
|
+
# The override pins @opentelemetry/propagator-jaeger above the version the
|
|
11
|
+
# autoinstrumentation package resolves transitively, clearing CVE-2026-59892.
|
|
12
|
+
RUN npm init -y \
|
|
13
|
+
&& npm pkg set "overrides.@opentelemetry/propagator-jaeger=<%- jaegerVersion %>" \
|
|
14
|
+
&& npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation@<%- adotVersion %>
|
|
11
15
|
|
|
12
16
|
# Copy bundled streamable http server
|
|
13
17
|
COPY index.js /app
|
|
@@ -51,6 +51,7 @@ export const tsMcpServerGenerator = async (tree, options)=>{
|
|
|
51
51
|
esm,
|
|
52
52
|
distDir,
|
|
53
53
|
adotVersion: TS_VERSIONS['@aws/aws-distro-opentelemetry-node-autoinstrumentation'],
|
|
54
|
+
jaegerVersion: TS_VERSIONS['@opentelemetry/propagator-jaeger'],
|
|
54
55
|
nodeBaseImage: BASE_IMAGES.node,
|
|
55
56
|
npmVersion: TS_VERSIONS.npm
|
|
56
57
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readJson,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addTypeScriptBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { addDockerScanTarget } from '../../utils/docker';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { isEsmWorkspace } from '../../utils/module-format';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { assignPort } from '../../utils/port';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { BASE_IMAGES, TS_VERSIONS, withVersions } from '../../utils/versions';\nimport type { TsMcpServerGeneratorSchema } from './schema';\n\nexport const TS_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsMcpServerGenerator = async (\n tree: Tree,\n options: TsMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-mcp-server`;\n const name = kebabCase(options.name || defaultName);\n const mcpServerNameClassName = toClassName(name);\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n mcpTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n const projectPackageJsonPath = joinPathFragments(\n project.root,\n 'package.json',\n );\n\n // Generate esm if the module system is esm, otherwise commonjs. Projects\n // don't typically have their own package.json (dependencies are declared in\n // the workspace root), so fall back to the workspace format when absent.\n const esm = tree.exists(projectPackageJsonPath)\n ? readJson(tree, projectPackageJsonPath).type === 'module'\n : isEsmWorkspace(tree);\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n targetSourceDir,\n {\n name,\n esm,\n distDir,\n adotVersion:\n TS_VERSIONS['@aws/aws-distro-opentelemetry-node-autoinstrumentation'],\n nodeBaseImage: BASE_IMAGES.node,\n npmVersion: TS_VERSIONS.npm,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add dependencies\n const deps = withVersions([\n '@modelcontextprotocol/sdk',\n 'zod',\n 'express',\n '@aws-lambda-powertools/parameters',\n '@aws-sdk/client-appconfigdata',\n ]);\n const devDeps = withVersions([\n 'tsx',\n '@types/express',\n '@modelcontextprotocol/inspector',\n ]);\n\n // Add hosting based on infra\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(tree, project, {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/http.ts`,\n bundleOutputDir: joinPathFragments('mcp', name),\n });\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'mcp',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n outputs: [`{workspaceRoot}/${dockerOutputDir}/Dockerfile`],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n addDockerScanTarget(tree, {\n project,\n containerEngine: containers,\n trivyTargetName: `${mcpTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n });\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n } else {\n // No Dockerfile needed for non-hosted MCP\n tree.delete(joinPathFragments(targetSourceDir, 'Dockerfile'));\n }\n\n addDependenciesToPackageJson(tree, deps, devDeps);\n // Add to the project's package.json too if it has one (e.g. nx plugins),\n // otherwise dependencies live in the workspace root only.\n if (tree.exists(projectPackageJsonPath)) {\n addDependenciesToPackageJson(tree, deps, devDeps, projectPackageJsonPath);\n }\n\n // @modelcontextprotocol/sdk declares zod as a peer dependency with a wide range\n // (^3.25 || ^4.0). Yarn does not dedupe the peer to the workspace's pinned zod, so\n // without a resolution it installs a separate zod under the SDK's own node_modules.\n // The two zod copies have structurally incompatible types, which breaks type\n // inference for registerTool inputSchema. Scope the resolution to the SDK so\n // other consumers (e.g. @tanstack/router-generator pinning zod@3) are unaffected.\n if (detectPackageManager() === 'yarn') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.resolutions = {\n ...packageJson.resolutions,\n '**/@modelcontextprotocol/sdk/zod': TS_VERSIONS['zod'],\n };\n return packageJson;\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: TS_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/stdio.ts`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- tsx --watch ${relativeSourceDir}/stdio.ts`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(mcpTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_MCP_SERVER_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readJson","updateJson","updateProjectConfiguration","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addTypeScriptBundleTarget","resolveContainers","addDockerScanTarget","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","kebabCase","toClassName","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","assignPort","sharedConstructsGenerator","BASE_IMAGES","TS_VERSIONS","withVersions","TS_MCP_SERVER_GENERATOR_INFO","filename","tsMcpServerGenerator","tree","options","project","exists","root","Error","defaultName","name","split","pop","mcpServerNameClassName","mcpTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","auth","console","warn","projectPackageJsonPath","esm","type","dirname","adotVersion","nodeBaseImage","node","npmVersion","npm","overwriteStrategy","KeepExisting","deps","devDeps","containers","dockerImageTag","targetFilePath","bundleOutputDir","dockerOutputDir","dockerTargetName","fs","targets","cache","outputs","executor","commands","cp","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","iac","mcpServerNameKebabCase","projectName","delete","packageJson","resolutions","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SAASC,wBAAwB,QAAQ,oCAAiC;AAC1E,SAASC,iBAAiB,QAAQ,6DAA0D;AAC5F,SAASC,yBAAyB,QAAQ,+BAA4B;AACtE,SAASC,iBAAiB,QAAQ,4BAAyB;AAC3D,SAASC,mBAAmB,QAAQ,wBAAqB;AACzD,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,UAAU,QAAQ,oBAAiB;AAC5C,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,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,CAAC,EAAE;YACpCiC,UAAU;YACVkB,YAAY;YACZ7D,SAAS;gBACP4C,UAAU;oBACR,CAAC,6BAA6B,EAAE/B,kBAAkB,SAAS,CAAC;iBAC7D;gBACDiD,KAAK;YACP;QACF;IACF;IAEA,8DAA8D;IAC9D7E,sBAAsB2E,YAAY,GAAGlD,gBAAgB,IAAI,CAAC;IAE1DzC,2BAA2B8B,MAAME,QAAQK,IAAI,EAAE;QAC7C,GAAGL,OAAO;QACV,yEAAyE;QACzE,uBAAuB;QACvBuC,SAASlD,eAAesE;IAC1B;IAEA1E,8BACEa,MACAE,QAAQK,IAAI,EACZV,8BACAe,sCACAD,iBACA;QACEwD,MAAMT;QACNU,IAAI1D;QACJQ;IACF;IAGF,MAAMrC,gCAAgCmB,MAAM;QAACH;KAA6B;IAE1E,MAAM1B,wBAAwB6B,MAAM5B;IAEpC,MAAMK,qBAAqBuB;IAC3B,OAAO,IACLpB,oBAAoBoB,MAAMC,QAAQoE,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAevE,qBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n detectPackageManager,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readJson,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addTypeScriptBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { addDockerScanTarget } from '../../utils/docker';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { isEsmWorkspace } from '../../utils/module-format';\nimport { kebabCase, toClassName } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { assignPort } from '../../utils/port';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { BASE_IMAGES, TS_VERSIONS, withVersions } from '../../utils/versions';\nimport type { TsMcpServerGeneratorSchema } from './schema';\n\nexport const TS_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsMcpServerGenerator = async (\n tree: Tree,\n options: TsMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n if (!tree.exists(joinPathFragments(project.root, 'tsconfig.json'))) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a TypeScript project (with a tsconfig.json)`,\n );\n }\n\n const defaultName = `${kebabCase(project.name.split('/').pop())}-mcp-server`;\n const name = kebabCase(options.name || defaultName);\n const mcpServerNameClassName = toClassName(name);\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n const targetSourceDirRelativeToProjectRoot = joinPathFragments(\n 'src',\n mcpTargetPrefix,\n );\n const targetSourceDir = joinPathFragments(\n project.root,\n targetSourceDirRelativeToProjectRoot,\n );\n const relativeSourceDir = targetSourceDir.replace(project.root + '/', './');\n const distDir = joinPathFragments('dist', project.root);\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n const projectPackageJsonPath = joinPathFragments(\n project.root,\n 'package.json',\n );\n\n // Generate esm if the module system is esm, otherwise commonjs. Projects\n // don't typically have their own package.json (dependencies are declared in\n // the workspace root), so fall back to the workspace format when absent.\n const esm = tree.exists(projectPackageJsonPath)\n ? readJson(tree, projectPackageJsonPath).type === 'module'\n : isEsmWorkspace(tree);\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n targetSourceDir,\n {\n name,\n esm,\n distDir,\n adotVersion:\n TS_VERSIONS['@aws/aws-distro-opentelemetry-node-autoinstrumentation'],\n jaegerVersion: TS_VERSIONS['@opentelemetry/propagator-jaeger'],\n nodeBaseImage: BASE_IMAGES.node,\n npmVersion: TS_VERSIONS.npm,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Add dependencies\n const deps = withVersions([\n '@modelcontextprotocol/sdk',\n 'zod',\n 'express',\n '@aws-lambda-powertools/parameters',\n '@aws-sdk/client-appconfigdata',\n ]);\n const devDeps = withVersions([\n 'tsx',\n '@types/express',\n '@modelcontextprotocol/inspector',\n ]);\n\n // Add hosting based on infra\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n await addTypeScriptBundleTarget(tree, project, {\n targetFilePath: `${targetSourceDirRelativeToProjectRoot}/http.ts`,\n bundleOutputDir: joinPathFragments('mcp', name),\n });\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'bundle',\n 'mcp',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n outputs: [`{workspaceRoot}/${dockerOutputDir}/Dockerfile`],\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: ['bundle'],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n addDockerScanTarget(tree, {\n project,\n containerEngine: containers,\n trivyTargetName: `${mcpTargetPrefix}-trivy`,\n dockerTargetName,\n imageTags: [dockerImageTag],\n });\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n } else {\n // No Dockerfile needed for non-hosted MCP\n tree.delete(joinPathFragments(targetSourceDir, 'Dockerfile'));\n }\n\n addDependenciesToPackageJson(tree, deps, devDeps);\n // Add to the project's package.json too if it has one (e.g. nx plugins),\n // otherwise dependencies live in the workspace root only.\n if (tree.exists(projectPackageJsonPath)) {\n addDependenciesToPackageJson(tree, deps, devDeps, projectPackageJsonPath);\n }\n\n // @modelcontextprotocol/sdk declares zod as a peer dependency with a wide range\n // (^3.25 || ^4.0). Yarn does not dedupe the peer to the workspace's pinned zod, so\n // without a resolution it installs a separate zod under the SDK's own node_modules.\n // The two zod copies have structurally incompatible types, which breaks type\n // inference for registerTool inputSchema. Scope the resolution to the SDK so\n // other consumers (e.g. @tanstack/router-generator pinning zod@3) are unaffected.\n if (detectPackageManager() === 'yarn') {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.resolutions = {\n ...packageJson.resolutions,\n '**/@modelcontextprotocol/sdk/zod': TS_VERSIONS['zod'],\n };\n return packageJson;\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: TS_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/stdio.ts`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`tsx --watch ${relativeSourceDir}/http.ts`],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- tsx --watch ${relativeSourceDir}/stdio.ts`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n // Sort targets so their order is stable regardless of insertion order on\n // first run vs re-run.\n targets: sortObjectKeys(mcpTargets),\n });\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_MCP_SERVER_GENERATOR_INFO,\n targetSourceDirRelativeToProjectRoot,\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [TS_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","detectPackageManager","generateFiles","joinPathFragments","OverwriteStrategy","readJson","updateJson","updateProjectConfiguration","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addTypeScriptBundleTarget","resolveContainers","addDockerScanTarget","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","kebabCase","toClassName","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","assignPort","sharedConstructsGenerator","BASE_IMAGES","TS_VERSIONS","withVersions","TS_MCP_SERVER_GENERATOR_INFO","filename","tsMcpServerGenerator","tree","options","project","exists","root","Error","defaultName","name","split","pop","mcpServerNameClassName","mcpTargetPrefix","targetSourceDirRelativeToProjectRoot","targetSourceDir","relativeSourceDir","replace","distDir","infra","auth","console","warn","projectPackageJsonPath","esm","type","dirname","adotVersion","jaegerVersion","nodeBaseImage","node","npmVersion","npm","overwriteStrategy","KeepExisting","deps","devDeps","containers","dockerImageTag","targetFilePath","bundleOutputDir","dockerOutputDir","dockerTargetName","fs","targets","cache","outputs","executor","commands","cp","parallel","dependsOn","containerEngine","trivyTargetName","imageTags","iac","mcpServerNameKebabCase","projectName","delete","packageJson","resolutions","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,oBAAoB,EAEpBC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,UAAU,EACVC,0B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EAAEhC,kBAAkB,QAAQ,CAAC;iBAAC;gBACtDkD,KAAK;gBACLC,KAAK;oBACHC,MAAM,GAAGP,cAAc;oBACvBQ,WAAW;gBACb;YACF;QACF;QACA,CAAC,GAAGxD,gBAAgB,QAAQ,CAAC,CAAC,EAAE;YAC9BkC,UAAU;YACVkB,YAAY;YACZ,uEAAuE;YACvE,wEAAwE;YACxE,aAAa;YACbd,WAAW;gBAAC,GAAGtC,gBAAgB,IAAI,CAAC;aAAC;YACrCV,SAAS;gBACP6C,UAAU;oBACR,CAAC,6DAA6D,EAAEa,aAAa,IAAI,CAAC;iBACnF;gBACDK,KAAK;YACP;QACF;QACA,CAAC,GAAGrD,gBAAgB,cAAc,CAAC,CAAC,EAAE;YACpCkC,UAAU;YACVkB,YAAY;YACZ9D,SAAS;gBACP6C,UAAU;oBACR,CAAC,6BAA6B,EAAEhC,kBAAkB,SAAS,CAAC;iBAC7D;gBACDkD,KAAK;YACP;QACF;IACF;IAEA,8DAA8D;IAC9D9E,sBAAsB4E,YAAY,GAAGnD,gBAAgB,IAAI,CAAC;IAE1DzC,2BAA2B8B,MAAME,QAAQK,IAAI,EAAE;QAC7C,GAAGL,OAAO;QACV,yEAAyE;QACzE,uBAAuB;QACvBwC,SAASnD,eAAeuE;IAC1B;IAEA3E,8BACEa,MACAE,QAAQK,IAAI,EACZV,8BACAe,sCACAD,iBACA;QACEyD,MAAMT;QACNU,IAAI3D;QACJQ;IACF;IAGF,MAAMrC,gCAAgCmB,MAAM;QAACH;KAA6B;IAE1E,MAAM1B,wBAAwB6B,MAAM5B;IAEpC,MAAMK,qBAAqBuB;IAC3B,OAAO,IACLpB,oBAAoBoB,MAAMC,QAAQqE,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAexE,qBAAqB"}
|
|
@@ -127,7 +127,7 @@ exports[`ts#nx-plugin generator > should generate MCP server files > test-plugin
|
|
|
127
127
|
- pnpm add -w -D <package>
|
|
128
128
|
- yarn add -D <package>
|
|
129
129
|
- npm install --legacy-peer-deps -D <package>
|
|
130
|
-
- bun
|
|
130
|
+
- bun add -D <package>
|
|
131
131
|
- (Omit -D for production dependencies)
|
|
132
132
|
- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \`@workspace-name/project-name\`. Check the \`project.json\` file for the specific package to find its fully qualified name
|
|
133
133
|
- When no generator exists for a specific framework required, look for more generic project generators if availalbe and build on top of these.
|
|
@@ -482,7 +482,7 @@ export const buildInstallCommand = (pm: string, pkg: string) =>
|
|
|
482
482
|
pnpm: \`pnpm add -Dw \${pkg}\`,
|
|
483
483
|
yarn: \`yarn add -D \${pkg}\`,
|
|
484
484
|
npm: \`npm install --legacy-peer-deps -D \${pkg}\`,
|
|
485
|
-
bun: \`bun
|
|
485
|
+
bun: \`bun add -D \${pkg}\`,
|
|
486
486
|
})[pm];
|
|
487
487
|
|
|
488
488
|
const renderSchema = (schema: any) =>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
- pnpm add -w -D <package>
|
|
31
31
|
- yarn add -D <package>
|
|
32
32
|
- npm install --legacy-peer-deps -D <package>
|
|
33
|
-
- bun
|
|
33
|
+
- bun add -D <package>
|
|
34
34
|
- (Omit -D for production dependencies)
|
|
35
35
|
- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example `@workspace-name/project-name`. Check the `project.json` file for the specific package to find its fully qualified name
|
|
36
36
|
- When no generator exists for a specific framework required, look for more generic project generators if availalbe and build on top of these.
|
|
@@ -56,7 +56,7 @@ export const buildInstallCommand = (pm: string, pkg: string) =>
|
|
|
56
56
|
pnpm: `pnpm add -Dw ${pkg}`,
|
|
57
57
|
yarn: `yarn add -D ${pkg}`,
|
|
58
58
|
npm: `npm install --legacy-peer-deps -D ${pkg}`,
|
|
59
|
-
bun: `bun
|
|
59
|
+
bun: `bun add -D ${pkg}`,
|
|
60
60
|
})[pm];
|
|
61
61
|
|
|
62
62
|
const renderSchema = (schema: any) =>
|
|
@@ -797,7 +797,7 @@ terraform {
|
|
|
797
797
|
required_providers {
|
|
798
798
|
aws = {
|
|
799
799
|
source = "hashicorp/aws"
|
|
800
|
-
version = "6.
|
|
800
|
+
version = "6.55.0"
|
|
801
801
|
}
|
|
802
802
|
null = {
|
|
803
803
|
source = "hashicorp/null"
|
|
@@ -1551,7 +1551,7 @@ exports[`ts#rdb generator > should generate terraform modules when iac is Terraf
|
|
|
1551
1551
|
}
|
|
1552
1552
|
aws = {
|
|
1553
1553
|
source = "hashicorp/aws"
|
|
1554
|
-
version = "6.
|
|
1554
|
+
version = "6.55.0"
|
|
1555
1555
|
}
|
|
1556
1556
|
null = {
|
|
1557
1557
|
source = "hashicorp/null"
|
|
@@ -2283,7 +2283,7 @@ terraform {
|
|
|
2283
2283
|
required_providers {
|
|
2284
2284
|
aws = {
|
|
2285
2285
|
source = "hashicorp/aws"
|
|
2286
|
-
version = "6.
|
|
2286
|
+
version = "6.55.0"
|
|
2287
2287
|
}
|
|
2288
2288
|
null = {
|
|
2289
2289
|
source = "hashicorp/null"
|
|
@@ -3037,7 +3037,7 @@ exports[`ts#rdb generator > should generate terraform modules with MySQL engine
|
|
|
3037
3037
|
}
|
|
3038
3038
|
aws = {
|
|
3039
3039
|
source = "hashicorp/aws"
|
|
3040
|
-
version = "6.
|
|
3040
|
+
version = "6.55.0"
|
|
3041
3041
|
}
|
|
3042
3042
|
null = {
|
|
3043
3043
|
source = "hashicorp/null"
|
|
@@ -4669,6 +4669,13 @@ exports[`ts#rdb generator > should generate the aurora shared construct 4`] = `
|
|
|
4669
4669
|
# Upgrade npm to a version free of known HIGH/CRITICAL vulnerabilities
|
|
4670
4670
|
RUN npm install -g npm@12.0.1
|
|
4671
4671
|
|
|
4672
|
+
# Patch OS packages beyond the base image's pinned release, and drop the
|
|
4673
|
+
# runtime's convenience copy of the AWS SDK (the handler bundle inlines its
|
|
4674
|
+
# own dependencies), keeping the image free of known HIGH/CRITICAL
|
|
4675
|
+
# vulnerabilities
|
|
4676
|
+
RUN microdnf upgrade -y --releasever latest && microdnf clean all \\
|
|
4677
|
+
&& rm -rf /var/runtime/node_modules/@aws-sdk
|
|
4678
|
+
|
|
4672
4679
|
WORKDIR \${LAMBDA_TASK_ROOT}
|
|
4673
4680
|
|
|
4674
4681
|
# npm blocks dependency install scripts by default; allow prisma's so its
|
|
@@ -3,6 +3,13 @@ FROM public.ecr.aws/lambda/nodejs:24
|
|
|
3
3
|
# Upgrade npm to a version free of known HIGH/CRITICAL vulnerabilities
|
|
4
4
|
RUN npm install -g npm@<%= npmVersion %>
|
|
5
5
|
|
|
6
|
+
# Patch OS packages beyond the base image's pinned release, and drop the
|
|
7
|
+
# runtime's convenience copy of the AWS SDK (the handler bundle inlines its
|
|
8
|
+
# own dependencies), keeping the image free of known HIGH/CRITICAL
|
|
9
|
+
# vulnerabilities
|
|
10
|
+
RUN microdnf upgrade -y --releasever latest && microdnf clean all \
|
|
11
|
+
&& rm -rf /var/runtime/node_modules/@aws-sdk
|
|
12
|
+
|
|
6
13
|
WORKDIR ${LAMBDA_TASK_ROOT}
|
|
7
14
|
|
|
8
15
|
# npm blocks dependency install scripts by default; allow prisma's so its
|