@aws/nx-plugin-mcp 1.0.0-rc.37 → 1.0.0-rc.39
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/bin/aws-nx-mcp.js +328 -132
- package/docs/get_started/building-with-ai.mdx +116 -0
- package/docs/get_started/concepts.mdx +52 -0
- package/docs/get_started/existing-project.mdx +176 -0
- package/docs/get_started/quick-start.mdx +266 -0
- package/docs/get_started/tutorials/contribute-generator.mdx +405 -0
- package/docs/get_started/tutorials/dungeon-game/1.mdx +1205 -0
- package/docs/get_started/tutorials/dungeon-game/2.mdx +237 -0
- package/docs/get_started/tutorials/dungeon-game/3.mdx +76 -0
- package/docs/get_started/tutorials/dungeon-game/4.mdx +162 -0
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +144 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
- package/docs/get_started/tutorials/existing-project.mdx +4 -0
- package/docs/guides/docker-bundling.mdx +55 -1
- package/docs/guides/py-agent.mdx +4 -0
- package/docs/guides/py-mcp-server.mdx +4 -0
- package/docs/guides/py-rdb.mdx +4 -0
- package/docs/guides/ts-agent.mdx +4 -0
- package/docs/guides/ts-mcp-server.mdx +4 -0
- package/docs/guides/ts-rdb.mdx +4 -0
- package/docs/snippets/trivy-image-scan.mdx +27 -0
- package/generators.json +7 -0
- package/package.json +1 -1
- package/src/init/schema.json +35 -0
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -19755,6 +19755,13 @@ const EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
19755
19755
|
//#endregion
|
|
19756
19756
|
//#region ../nx-plugin/generators.json
|
|
19757
19757
|
var generators$1 = {
|
|
19758
|
+
"init": {
|
|
19759
|
+
"factory": "./src/init/generator",
|
|
19760
|
+
"schema": "./src/init/schema.json",
|
|
19761
|
+
"description": "Configure an existing Nx workspace to use the @aws/nx-plugin",
|
|
19762
|
+
"metric": "g57",
|
|
19763
|
+
"guidePages": ["existing-project"]
|
|
19764
|
+
},
|
|
19758
19765
|
"agentcore-gateway": {
|
|
19759
19766
|
"factory": "./src/agentcore-gateway/generator",
|
|
19760
19767
|
"schema": "./src/agentcore-gateway/schema.json",
|
|
@@ -20252,131 +20259,6 @@ const buildGeneratorInfoList = (baseDir) => Object.entries(generators$1).map(([i
|
|
|
20252
20259
|
..."guidePages" in info && info.guidePages ? { guidePages: info.guidePages } : {}
|
|
20253
20260
|
}));
|
|
20254
20261
|
//#endregion
|
|
20255
|
-
//#region ../nx-plugin/src/utils/commands.ts
|
|
20256
|
-
const PACKAGE_MANAGER_COMMANDS = {
|
|
20257
|
-
npm: {
|
|
20258
|
-
exec: "npx",
|
|
20259
|
-
run: "npm run",
|
|
20260
|
-
create: "npm create"
|
|
20261
|
-
},
|
|
20262
|
-
pnpm: {
|
|
20263
|
-
exec: "pnpm",
|
|
20264
|
-
run: "pnpm",
|
|
20265
|
-
create: "pnpm create"
|
|
20266
|
-
},
|
|
20267
|
-
yarn: {
|
|
20268
|
-
exec: "yarn",
|
|
20269
|
-
run: "yarn",
|
|
20270
|
-
create: "yarn create"
|
|
20271
|
-
},
|
|
20272
|
-
bun: {
|
|
20273
|
-
exec: "bunx",
|
|
20274
|
-
run: "bun",
|
|
20275
|
-
create: "bun create"
|
|
20276
|
-
}
|
|
20277
|
-
};
|
|
20278
|
-
/**
|
|
20279
|
-
* Build a package manager exec command (e.g. pnpm cmd, npx cmd, bunx cmd)
|
|
20280
|
-
*/
|
|
20281
|
-
const buildPackageManagerExecCommand = (pm, command) => {
|
|
20282
|
-
return `${PACKAGE_MANAGER_COMMANDS[pm]?.exec ?? pm} ${command}`;
|
|
20283
|
-
};
|
|
20284
|
-
/**
|
|
20285
|
-
* Build a short package manager command (e.g. pnpm build, npm run build)
|
|
20286
|
-
*/
|
|
20287
|
-
const buildPackageManagerShortCommand = (pm, command) => {
|
|
20288
|
-
return `${PACKAGE_MANAGER_COMMANDS[pm]?.run ?? pm} ${command}`;
|
|
20289
|
-
};
|
|
20290
|
-
/**
|
|
20291
|
-
* Build an install command for a given package manager
|
|
20292
|
-
*/
|
|
20293
|
-
const buildInstallCommand = (pm, pkg, dev) => {
|
|
20294
|
-
switch (pm) {
|
|
20295
|
-
case "pnpm": return `pnpm add ${dev ? "-D" : "-"}w ${pkg}`;
|
|
20296
|
-
case "yarn": return `yarn add ${dev ? "-D " : ""}${pkg}`;
|
|
20297
|
-
case "npm": return `npm install --legacy-peer-deps ${dev ? "-D " : ""}${pkg}`;
|
|
20298
|
-
case "bun": return `bun install ${dev ? "-D " : ""}${pkg}`;
|
|
20299
|
-
default: return `${pm} install ${dev ? "-D " : ""}${pkg}`;
|
|
20300
|
-
}
|
|
20301
|
-
};
|
|
20302
|
-
/**
|
|
20303
|
-
* Build a command to create a new workspace using @aws/create-nx-workspace.
|
|
20304
|
-
*
|
|
20305
|
-
* Uses the `create` shorthand for each package manager:
|
|
20306
|
-
* npm create @aws/nx-workspace my-project
|
|
20307
|
-
* pnpm create @aws/nx-workspace my-project
|
|
20308
|
-
* yarn create @aws/nx-workspace my-project
|
|
20309
|
-
* bun create @aws/nx-workspace my-project
|
|
20310
|
-
*
|
|
20311
|
-
* The package manager is auto-detected by @aws/create-nx-workspace from the
|
|
20312
|
-
* invoking command, so --pm is not needed.
|
|
20313
|
-
*/
|
|
20314
|
-
const buildCreateNxWorkspaceCommand = (pm, workspace, iac, tag, module) => {
|
|
20315
|
-
return [
|
|
20316
|
-
PACKAGE_MANAGER_COMMANDS[pm]?.create ?? `${pm} create`,
|
|
20317
|
-
tag ? `@aws/nx-workspace@${tag}` : "@aws/nx-workspace",
|
|
20318
|
-
...pm === "npm" ? ["--"] : [],
|
|
20319
|
-
workspace,
|
|
20320
|
-
...iac ? [`--iac=${iac}`] : [],
|
|
20321
|
-
...module ? [`--module=${module}`] : []
|
|
20322
|
-
].join(" ");
|
|
20323
|
-
};
|
|
20324
|
-
//#endregion
|
|
20325
|
-
//#region ../nx-plugin/src/utils/iac-providers.ts
|
|
20326
|
-
/**
|
|
20327
|
-
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
20328
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
20329
|
-
*/
|
|
20330
|
-
const IAC_PROVIDERS = ["cdk", "terraform"];
|
|
20331
|
-
//#endregion
|
|
20332
|
-
//#region ../nx-plugin/src/mcp-server/schema.ts
|
|
20333
|
-
/**
|
|
20334
|
-
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
20335
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
20336
|
-
*/
|
|
20337
|
-
const PACKAGE_MANAGERS = [
|
|
20338
|
-
"pnpm",
|
|
20339
|
-
"yarn",
|
|
20340
|
-
"npm",
|
|
20341
|
-
"bun"
|
|
20342
|
-
];
|
|
20343
|
-
const PackageManagerSchema = _enum(PACKAGE_MANAGERS);
|
|
20344
|
-
//#endregion
|
|
20345
|
-
//#region ../nx-plugin/src/mcp-server/tools/create-workspace-command.ts
|
|
20346
|
-
/**
|
|
20347
|
-
* Add a tool which tells a model how to create an Nx workspace
|
|
20348
|
-
*/
|
|
20349
|
-
const addCreateWorkspaceCommandTool = (server) => {
|
|
20350
|
-
server.registerTool("create-workspace-command", {
|
|
20351
|
-
description: "Tool to discover how to create a workspace to start a new project.",
|
|
20352
|
-
inputSchema: { packageManager: PackageManagerSchema }
|
|
20353
|
-
}, ({ packageManager }) => ({ content: [{
|
|
20354
|
-
type: "text",
|
|
20355
|
-
text: `Run the following command to create a workspace:
|
|
20356
|
-
|
|
20357
|
-
\`\`\`bash
|
|
20358
|
-
${buildCreateNxWorkspaceCommand(packageManager, "<workspace-name>")} --no-interactive
|
|
20359
|
-
\`\`\`
|
|
20360
|
-
|
|
20361
|
-
This will create a new workspace within the \`<workspace-name>\` directory.
|
|
20362
|
-
|
|
20363
|
-
If you are already inside an empty directory intended for this project, you can pass \`.\` as the workspace name to create the workspace in the current directory:
|
|
20364
|
-
|
|
20365
|
-
\`\`\`bash
|
|
20366
|
-
${buildCreateNxWorkspaceCommand(packageManager, ".")} --no-interactive
|
|
20367
|
-
\`\`\`
|
|
20368
|
-
|
|
20369
|
-
Note that this will prompt for an Infrastructure as Code provider (${IAC_PROVIDERS.join(", ")}).
|
|
20370
|
-
If you know the preferred option, pass ${IAC_PROVIDERS.map((iac) => `\`--iac=${iac}\``).join(" or ")} to the above command to skip the prompt.
|
|
20371
|
-
|
|
20372
|
-
Additional options:
|
|
20373
|
-
- \`--no-gitSecrets\`: Opt out of the default git-secrets pre-commit hook (prevents committing AWS credentials)
|
|
20374
|
-
|
|
20375
|
-
Refer to the \`general-guidance\` tool for full workspace documentation including structure, common commands, and configuration.
|
|
20376
|
-
`
|
|
20377
|
-
}] }));
|
|
20378
|
-
};
|
|
20379
|
-
//#endregion
|
|
20380
20262
|
//#region ../../node_modules/.pnpm/lodash.camelcase@4.3.0/node_modules/lodash.camelcase/index.js
|
|
20381
20263
|
var require_lodash_camelcase = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20382
20264
|
/** `Object#toString` result references. */
|
|
@@ -21402,6 +21284,218 @@ const kebabCase = (str) => {
|
|
|
21402
21284
|
return (0, import_lodash_deburr.default)(str).replace(/[^a-zA-Z0-9]+/g, "-").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/^-+|-+$/g, "");
|
|
21403
21285
|
};
|
|
21404
21286
|
//#endregion
|
|
21287
|
+
//#region ../nx-plugin/src/utils/commands.ts
|
|
21288
|
+
/**
|
|
21289
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
21290
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
21291
|
+
*/
|
|
21292
|
+
/**
|
|
21293
|
+
* The nx version the plugin is built against. Commands that download nx
|
|
21294
|
+
* (e.g. `nx init`) pin to this version so the workspace's nx matches the
|
|
21295
|
+
* plugin's `@nx/*` packages — a mismatch deadlocks `nx sync`.
|
|
21296
|
+
*/
|
|
21297
|
+
const NX_VERSION = {
|
|
21298
|
+
"@a2a-js/sdk": "0.3.14",
|
|
21299
|
+
"@aws/aws-distro-opentelemetry-node-autoinstrumentation": "0.12.0",
|
|
21300
|
+
"@aws-sdk/client-dynamodb": "3.1085.0",
|
|
21301
|
+
"@aws-sdk/client-bedrock-runtime": "3.1085.0",
|
|
21302
|
+
"@aws-sdk/client-s3": "3.1085.0",
|
|
21303
|
+
"@aws-sdk/client-sts": "3.1085.0",
|
|
21304
|
+
"@aws-sdk/credential-providers": "3.1085.0",
|
|
21305
|
+
"@aws-sdk/credential-provider-cognito-identity": "3.972.56",
|
|
21306
|
+
"@aws-sdk/client-secrets-manager": "3.1085.0",
|
|
21307
|
+
"@aws-sdk/rds-signer": "3.1085.0",
|
|
21308
|
+
"@aws-smithy/server-apigateway": "1.0.0-alpha.10",
|
|
21309
|
+
"@aws-smithy/server-node": "1.0.0-alpha.10",
|
|
21310
|
+
"@aws-lambda-powertools/logger": "2.34.0",
|
|
21311
|
+
"@aws-lambda-powertools/metrics": "2.34.0",
|
|
21312
|
+
"@aws-lambda-powertools/parameters": "2.34.0",
|
|
21313
|
+
"@aws-lambda-powertools/tracer": "2.34.0",
|
|
21314
|
+
"@aws-lambda-powertools/parser": "2.34.0",
|
|
21315
|
+
"@aws-sdk/client-appconfigdata": "3.1085.0",
|
|
21316
|
+
"@middy/core": "7.7.0",
|
|
21317
|
+
"@nxlv/python": "22.2.1",
|
|
21318
|
+
"@nx-extend/terraform": "10.3.0",
|
|
21319
|
+
"@nx/devkit": "23.0.2",
|
|
21320
|
+
"@nx/react": "23.0.2",
|
|
21321
|
+
"create-nx-workspace": "23.0.2",
|
|
21322
|
+
"@swc-node/register": "1.11.1",
|
|
21323
|
+
"@swc/core": "1.15.43",
|
|
21324
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
21325
|
+
"@modelcontextprotocol/inspector": "0.22.0",
|
|
21326
|
+
"@ag-ui/aws-strands": "0.2.3",
|
|
21327
|
+
"@ag-ui/client": "0.0.57",
|
|
21328
|
+
"@ag-ui/core": "0.0.57",
|
|
21329
|
+
"@ag-ui/encoder": "0.0.57",
|
|
21330
|
+
"agent-chat-cli": "0.3.0",
|
|
21331
|
+
"@copilotkit/react-core": "1.62.3",
|
|
21332
|
+
rxjs: "7.8.2",
|
|
21333
|
+
"@strands-agents/sdk": "1.9.0",
|
|
21334
|
+
"@tanstack/react-router": "1.170.17",
|
|
21335
|
+
"@tanstack/router-plugin": "1.168.19",
|
|
21336
|
+
"@tanstack/router-generator": "1.167.18",
|
|
21337
|
+
"@tanstack/virtual-file-routes": "1.162.0",
|
|
21338
|
+
"@tanstack/router-utils": "1.162.2",
|
|
21339
|
+
"@cloudscape-design/board-components": "3.0.201",
|
|
21340
|
+
"@cloudscape-design/chat-components": "1.0.149",
|
|
21341
|
+
"@cloudscape-design/components": "3.0.1325",
|
|
21342
|
+
"@cloudscape-design/global-styles": "1.0.62",
|
|
21343
|
+
"@tanstack/react-query": "5.101.2",
|
|
21344
|
+
"@tanstack/react-query-devtools": "5.101.2",
|
|
21345
|
+
"@trpc/tanstack-react-query": "11.18.0",
|
|
21346
|
+
"@trpc/client": "11.18.0",
|
|
21347
|
+
"@trpc/server": "11.18.0",
|
|
21348
|
+
"@types/node": "26.1.1",
|
|
21349
|
+
"@types/aws-lambda": "8.10.162",
|
|
21350
|
+
"@types/cors": "2.8.19",
|
|
21351
|
+
"@types/pg": "8.20.0",
|
|
21352
|
+
"@types/ws": "8.18.1",
|
|
21353
|
+
"@types/express": "5.0.6",
|
|
21354
|
+
"@smithy/config-resolver": "4.6.8",
|
|
21355
|
+
"@smithy/node-config-provider": "4.5.8",
|
|
21356
|
+
"@smithy/node-http-handler": "4.9.5",
|
|
21357
|
+
"@smithy/types": "4.16.1",
|
|
21358
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
21359
|
+
"@vitest/ui": "4.1.10",
|
|
21360
|
+
"@astrojs/react": "6.0.1",
|
|
21361
|
+
"@astrojs/starlight": "0.41.3",
|
|
21362
|
+
astro: "7.0.7",
|
|
21363
|
+
aws4fetch: "1.0.20",
|
|
21364
|
+
"aws-cdk": "2.1130.0",
|
|
21365
|
+
"aws-cdk-lib": "2.261.0",
|
|
21366
|
+
"aws-xray-sdk-core": "3.12.0",
|
|
21367
|
+
constructs: "10.6.0",
|
|
21368
|
+
cors: "2.8.6",
|
|
21369
|
+
chalk: "5.6.2",
|
|
21370
|
+
"class-variance-authority": "0.7.1",
|
|
21371
|
+
clsx: "2.1.1",
|
|
21372
|
+
commander: "15.0.0",
|
|
21373
|
+
electrodb: "3.9.1",
|
|
21374
|
+
esbuild: "0.28.1",
|
|
21375
|
+
"event-source-polyfill": "1.0.31",
|
|
21376
|
+
"@types/event-source-polyfill": "1.0.5",
|
|
21377
|
+
"@biomejs/biome": "2.5.3",
|
|
21378
|
+
"@prisma/adapter-mariadb": "7.8.0",
|
|
21379
|
+
"@prisma/adapter-pg": "7.8.0",
|
|
21380
|
+
"@prisma/client": "7.8.0",
|
|
21381
|
+
ejs: "6.0.1",
|
|
21382
|
+
"@types/ejs": "3.1.5",
|
|
21383
|
+
express: "5.2.1",
|
|
21384
|
+
"fast-glob": "3.3.3",
|
|
21385
|
+
husky: "9.1.7",
|
|
21386
|
+
"fs-extra": "11.3.6",
|
|
21387
|
+
"@types/fs-extra": "11.0.4",
|
|
21388
|
+
"make-dir-cli": "4.0.0",
|
|
21389
|
+
mariadb: "3.5.3",
|
|
21390
|
+
ncp: "2.0.0",
|
|
21391
|
+
npm: "12.0.1",
|
|
21392
|
+
"npm-check-updates": "22.2.9",
|
|
21393
|
+
"oidc-client-ts": "3.5.0",
|
|
21394
|
+
pg: "8.22.0",
|
|
21395
|
+
prisma: "7.8.0",
|
|
21396
|
+
"react-oidc-context": "3.3.1",
|
|
21397
|
+
react: "19.2.7",
|
|
21398
|
+
"react-dom": "19.2.7",
|
|
21399
|
+
rimraf: "6.1.3",
|
|
21400
|
+
rolldown: "1.1.5",
|
|
21401
|
+
"simple-git": "3.36.0",
|
|
21402
|
+
"source-map-support": "0.5.21",
|
|
21403
|
+
"starlight-blog": "0.28.0",
|
|
21404
|
+
tailwindcss: "4.3.2",
|
|
21405
|
+
"@tailwindcss/vite": "4.3.2",
|
|
21406
|
+
tsx: "4.23.0",
|
|
21407
|
+
"lucide-react": "1.24.0",
|
|
21408
|
+
"radix-ui": "1.6.2",
|
|
21409
|
+
shadcn: "4.13.0",
|
|
21410
|
+
"tw-animate-css": "1.4.0",
|
|
21411
|
+
"tailwind-merge": "3.6.0",
|
|
21412
|
+
vite: "8.1.4",
|
|
21413
|
+
typescript: "6.0.3",
|
|
21414
|
+
vitest: "4.1.10",
|
|
21415
|
+
zod: "4.4.3",
|
|
21416
|
+
ws: "8.21.0"
|
|
21417
|
+
}["@nx/devkit"];
|
|
21418
|
+
const PACKAGE_MANAGER_COMMANDS = {
|
|
21419
|
+
npm: {
|
|
21420
|
+
exec: "npx",
|
|
21421
|
+
run: "npm run",
|
|
21422
|
+
create: "npm create"
|
|
21423
|
+
},
|
|
21424
|
+
pnpm: {
|
|
21425
|
+
exec: "pnpm",
|
|
21426
|
+
run: "pnpm",
|
|
21427
|
+
create: "pnpm create"
|
|
21428
|
+
},
|
|
21429
|
+
yarn: {
|
|
21430
|
+
exec: "yarn",
|
|
21431
|
+
run: "yarn",
|
|
21432
|
+
create: "yarn create"
|
|
21433
|
+
},
|
|
21434
|
+
bun: {
|
|
21435
|
+
exec: "bunx",
|
|
21436
|
+
run: "bun",
|
|
21437
|
+
create: "bun create"
|
|
21438
|
+
}
|
|
21439
|
+
};
|
|
21440
|
+
/**
|
|
21441
|
+
* Build a package manager exec command (e.g. pnpm cmd, npx cmd, bunx cmd)
|
|
21442
|
+
*/
|
|
21443
|
+
const buildPackageManagerExecCommand = (pm, command) => {
|
|
21444
|
+
return `${PACKAGE_MANAGER_COMMANDS[pm]?.exec ?? pm} ${command}`;
|
|
21445
|
+
};
|
|
21446
|
+
/**
|
|
21447
|
+
* Build a short package manager command (e.g. pnpm build, npm run build)
|
|
21448
|
+
*/
|
|
21449
|
+
const buildPackageManagerShortCommand = (pm, command) => {
|
|
21450
|
+
return `${PACKAGE_MANAGER_COMMANDS[pm]?.run ?? pm} ${command}`;
|
|
21451
|
+
};
|
|
21452
|
+
/**
|
|
21453
|
+
* Build an install command for a given package manager
|
|
21454
|
+
*/
|
|
21455
|
+
const buildInstallCommand = (pm, pkg, dev) => {
|
|
21456
|
+
switch (pm) {
|
|
21457
|
+
case "pnpm": return `pnpm add ${dev ? "-D" : "-"}w ${pkg}`;
|
|
21458
|
+
case "yarn": return `yarn add ${dev ? "-D " : ""}${pkg}`;
|
|
21459
|
+
case "npm": return `npm install --legacy-peer-deps ${dev ? "-D " : ""}${pkg}`;
|
|
21460
|
+
case "bun": return `bun install ${dev ? "-D " : ""}${pkg}`;
|
|
21461
|
+
default: return `${pm} install ${dev ? "-D " : ""}${pkg}`;
|
|
21462
|
+
}
|
|
21463
|
+
};
|
|
21464
|
+
/**
|
|
21465
|
+
* Build the command that adds Nx to a non-Nx project, pinned to the nx
|
|
21466
|
+
* version the plugin is built against.
|
|
21467
|
+
*/
|
|
21468
|
+
const buildNxInitCommand = (pm) => {
|
|
21469
|
+
return `${{
|
|
21470
|
+
npm: "npx",
|
|
21471
|
+
pnpm: "pnpm dlx",
|
|
21472
|
+
yarn: "yarn dlx",
|
|
21473
|
+
bun: "bunx"
|
|
21474
|
+
}[pm] ?? "npx"} nx@${NX_VERSION} init`;
|
|
21475
|
+
};
|
|
21476
|
+
/**
|
|
21477
|
+
* Build a command to create a new workspace using @aws/create-nx-workspace.
|
|
21478
|
+
*
|
|
21479
|
+
* Uses the `create` shorthand for each package manager:
|
|
21480
|
+
* npm create @aws/nx-workspace my-project
|
|
21481
|
+
* pnpm create @aws/nx-workspace my-project
|
|
21482
|
+
* yarn create @aws/nx-workspace my-project
|
|
21483
|
+
* bun create @aws/nx-workspace my-project
|
|
21484
|
+
*
|
|
21485
|
+
* The package manager is auto-detected by @aws/create-nx-workspace from the
|
|
21486
|
+
* invoking command, so --pm is not needed.
|
|
21487
|
+
*/
|
|
21488
|
+
const buildCreateNxWorkspaceCommand = (pm, workspace, iac, tag, module) => {
|
|
21489
|
+
return [
|
|
21490
|
+
PACKAGE_MANAGER_COMMANDS[pm]?.create ?? `${pm} create`,
|
|
21491
|
+
tag ? `@aws/nx-workspace@${tag}` : "@aws/nx-workspace",
|
|
21492
|
+
...pm === "npm" ? ["--"] : [],
|
|
21493
|
+
workspace,
|
|
21494
|
+
...iac ? [`--iac=${iac}`] : [],
|
|
21495
|
+
...module ? [`--module=${module}`] : []
|
|
21496
|
+
].join(" ");
|
|
21497
|
+
};
|
|
21498
|
+
//#endregion
|
|
21405
21499
|
//#region ../nx-plugin/src/mcp-server/guide-render.ts
|
|
21406
21500
|
/**
|
|
21407
21501
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -53532,12 +53626,22 @@ const stringifyMdx = (tree, deps) => String(deps.unified().use(deps.remarkFrontm
|
|
|
53532
53626
|
fences: true,
|
|
53533
53627
|
listItemIndent: "one"
|
|
53534
53628
|
}).stringify(tree));
|
|
53629
|
+
/**
|
|
53630
|
+
* Remove nodes that are meaningless once the MDX is rendered to plain markdown
|
|
53631
|
+
* for an agent: the YAML frontmatter block and the `import`/`export` (ESM)
|
|
53632
|
+
* statements at the top of every docs page. They add noise and tokens without
|
|
53633
|
+
* conveying guidance.
|
|
53634
|
+
*/
|
|
53635
|
+
const stripFrontmatterAndEsm = (tree) => {
|
|
53636
|
+
tree.children = tree.children.filter((node) => node.type !== "yaml" && node.type !== "mdxjsEsm");
|
|
53637
|
+
};
|
|
53535
53638
|
const postProcessGuideWithRemark = async (guide, opts) => {
|
|
53536
53639
|
const deps = await loadRemarkDeps();
|
|
53537
53640
|
const tree = parseMdxWithDeps(guide, deps);
|
|
53538
53641
|
await inlineSnippets(tree, opts, deps);
|
|
53539
53642
|
applyFilterTransforms(tree, opts.options);
|
|
53540
53643
|
applyComponentTransforms(tree, opts, deps);
|
|
53644
|
+
stripFrontmatterAndEsm(tree);
|
|
53541
53645
|
return stringifyMdx(tree, deps);
|
|
53542
53646
|
};
|
|
53543
53647
|
const inlineSnippets = async (tree, opts, deps) => {
|
|
@@ -53781,6 +53885,7 @@ const renderComponent = (node, opts, pm, deps) => {
|
|
|
53781
53885
|
const iac = readStringAttr(node, "iac");
|
|
53782
53886
|
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, iac))];
|
|
53783
53887
|
}
|
|
53888
|
+
case "NxInitCommand": return [codeBlock(buildNxInitCommand(pm))];
|
|
53784
53889
|
case "InstallCommand": {
|
|
53785
53890
|
const pkg = readStringAttr(node, "pkg") ?? readExpressionAttr(node, "pkg");
|
|
53786
53891
|
if (!pkg) return void 0;
|
|
@@ -54086,19 +54191,29 @@ const parseGuide = async (raw) => {
|
|
|
54086
54191
|
};
|
|
54087
54192
|
};
|
|
54088
54193
|
/**
|
|
54089
|
-
*
|
|
54194
|
+
* Base directories to probe for guide MDX files, relative to this module.
|
|
54195
|
+
* Each is checked in order:
|
|
54090
54196
|
* 1. Bundled docs in the published @aws/nx-plugin-mcp package
|
|
54091
54197
|
* 2. Source checkout when running from the monorepo (dev/test)
|
|
54092
54198
|
* 3. Rolldown-bundled binary in dist/ (monorepo layout)
|
|
54093
54199
|
*/
|
|
54094
|
-
const
|
|
54095
|
-
"../docs
|
|
54096
|
-
"../../../docs/src/content/docs/en
|
|
54097
|
-
"../../../../docs/src/content/docs/en
|
|
54200
|
+
const GUIDE_BASE_PROBES = [
|
|
54201
|
+
"../docs",
|
|
54202
|
+
"../../../docs/src/content/docs/en",
|
|
54203
|
+
"../../../../docs/src/content/docs/en"
|
|
54098
54204
|
];
|
|
54205
|
+
/**
|
|
54206
|
+
* Content sub-directories that hold pages a generator may reference via
|
|
54207
|
+
* `guidePages`. Both the per-generator reference guides (`guides/`) and the
|
|
54208
|
+
* getting-started pages (`get_started/`) are fetchable, so a page can live in
|
|
54209
|
+
* whichever section reads best for humans while still being served by the MCP
|
|
54210
|
+
* tools. Bare `guidePages` names may also include a sub-path (e.g.
|
|
54211
|
+
* `connection/react-trpc`).
|
|
54212
|
+
*/
|
|
54213
|
+
const GUIDE_SECTIONS = ["guides", "get_started"];
|
|
54099
54214
|
const fetchLocalGuide = (guide) => {
|
|
54100
|
-
for (const
|
|
54101
|
-
const candidate = path$3.default.resolve(__dirname,
|
|
54215
|
+
for (const base of GUIDE_BASE_PROBES) for (const section of GUIDE_SECTIONS) {
|
|
54216
|
+
const candidate = path$3.default.resolve(__dirname, base, section, `${guide}.mdx`);
|
|
54102
54217
|
try {
|
|
54103
54218
|
if (fs.default.existsSync(candidate)) return fs.default.readFileSync(candidate, "utf-8");
|
|
54104
54219
|
} catch {}
|
|
@@ -54145,6 +54260,85 @@ const postProcessGuide = async (guide, generators, packageManager, snippetConten
|
|
|
54145
54260
|
});
|
|
54146
54261
|
};
|
|
54147
54262
|
//#endregion
|
|
54263
|
+
//#region ../nx-plugin/src/mcp-server/schema.ts
|
|
54264
|
+
/**
|
|
54265
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
54266
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
54267
|
+
*/
|
|
54268
|
+
const PACKAGE_MANAGERS = [
|
|
54269
|
+
"pnpm",
|
|
54270
|
+
"yarn",
|
|
54271
|
+
"npm",
|
|
54272
|
+
"bun"
|
|
54273
|
+
];
|
|
54274
|
+
const PackageManagerSchema = _enum(PACKAGE_MANAGERS);
|
|
54275
|
+
//#endregion
|
|
54276
|
+
//#region ../nx-plugin/src/mcp-server/tools/add-to-existing-project.ts
|
|
54277
|
+
/**
|
|
54278
|
+
* The guide page (under `get_started/`) that backs this tool, so the tool and
|
|
54279
|
+
* the published docs never drift.
|
|
54280
|
+
*/
|
|
54281
|
+
const EXISTING_PROJECT_GUIDE = "existing-project";
|
|
54282
|
+
/**
|
|
54283
|
+
* Add a tool which guides an agent through adding @aws/nx-plugin to an
|
|
54284
|
+
* existing Nx or non-Nx workspace. Returns the `existing-project` docs page,
|
|
54285
|
+
* which includes the full adoption steps and troubleshooting reference.
|
|
54286
|
+
*/
|
|
54287
|
+
const addToExistingProjectTool = (server, generators) => {
|
|
54288
|
+
server.registerTool("add-to-existing-project", {
|
|
54289
|
+
title: "Add to Existing Project",
|
|
54290
|
+
description: "Tool for adding the Nx Plugin for AWS to an existing Nx workspace or non-Nx monorepo. Use this when a user wants to adopt @aws/nx-plugin in a project that was not created with the plugin preset, or hits configuration errors when running generators in such a workspace.",
|
|
54291
|
+
inputSchema: { packageManager: PackageManagerSchema.optional() }
|
|
54292
|
+
}, async ({ packageManager }) => {
|
|
54293
|
+
return { content: [{
|
|
54294
|
+
type: "text",
|
|
54295
|
+
text: await fetchGuidePages([EXISTING_PROJECT_GUIDE], generators, packageManager)
|
|
54296
|
+
}] };
|
|
54297
|
+
});
|
|
54298
|
+
};
|
|
54299
|
+
//#endregion
|
|
54300
|
+
//#region ../nx-plugin/src/utils/iac-providers.ts
|
|
54301
|
+
/**
|
|
54302
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
54303
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
54304
|
+
*/
|
|
54305
|
+
const IAC_PROVIDERS = ["cdk", "terraform"];
|
|
54306
|
+
//#endregion
|
|
54307
|
+
//#region ../nx-plugin/src/mcp-server/tools/create-workspace-command.ts
|
|
54308
|
+
/**
|
|
54309
|
+
* Add a tool which tells a model how to create an Nx workspace
|
|
54310
|
+
*/
|
|
54311
|
+
const addCreateWorkspaceCommandTool = (server) => {
|
|
54312
|
+
server.registerTool("create-workspace-command", {
|
|
54313
|
+
description: "Tool to discover how to create a workspace to start a new project.",
|
|
54314
|
+
inputSchema: { packageManager: PackageManagerSchema }
|
|
54315
|
+
}, ({ packageManager }) => ({ content: [{
|
|
54316
|
+
type: "text",
|
|
54317
|
+
text: `Run the following command to create a workspace:
|
|
54318
|
+
|
|
54319
|
+
\`\`\`bash
|
|
54320
|
+
${buildCreateNxWorkspaceCommand(packageManager, "<workspace-name>")} --no-interactive
|
|
54321
|
+
\`\`\`
|
|
54322
|
+
|
|
54323
|
+
This will create a new workspace within the \`<workspace-name>\` directory.
|
|
54324
|
+
|
|
54325
|
+
If you are already inside an empty directory intended for this project, you can pass \`.\` as the workspace name to create the workspace in the current directory:
|
|
54326
|
+
|
|
54327
|
+
\`\`\`bash
|
|
54328
|
+
${buildCreateNxWorkspaceCommand(packageManager, ".")} --no-interactive
|
|
54329
|
+
\`\`\`
|
|
54330
|
+
|
|
54331
|
+
Note that this will prompt for an Infrastructure as Code provider (${IAC_PROVIDERS.join(", ")}).
|
|
54332
|
+
If you know the preferred option, pass ${IAC_PROVIDERS.map((iac) => `\`--iac=${iac}\``).join(" or ")} to the above command to skip the prompt.
|
|
54333
|
+
|
|
54334
|
+
Additional options:
|
|
54335
|
+
- \`--no-gitSecrets\`: Opt out of the default git-secrets pre-commit hook (prevents committing AWS credentials)
|
|
54336
|
+
|
|
54337
|
+
Refer to the \`general-guidance\` tool for full workspace documentation including structure, common commands, and configuration.
|
|
54338
|
+
`
|
|
54339
|
+
}] }));
|
|
54340
|
+
};
|
|
54341
|
+
//#endregion
|
|
54148
54342
|
//#region ../nx-plugin/src/mcp-server/tools/list-generators.ts
|
|
54149
54343
|
/**
|
|
54150
54344
|
* Adds a tool which lists details about the available generators.
|
|
@@ -54217,6 +54411,7 @@ const TOOL_SELECTION_GUIDE = `## Tool Selection Guide
|
|
|
54217
54411
|
|
|
54218
54412
|
- Use the \`general-guidance\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.
|
|
54219
54413
|
- Use the \`create-workspace-command\` tool to discover how to create a workspace to start a new project.
|
|
54414
|
+
- Use the \`add-to-existing-project\` tool when adding the plugin to an existing Nx workspace or non-Nx monorepo, or when troubleshooting configuration errors in such a workspace.
|
|
54220
54415
|
- Use the \`list-generators\` tool to discover the available generators and how to run them.
|
|
54221
54416
|
- Use the \`generator-guide\` tool to retrieve detailed information about a specific generator.`;
|
|
54222
54417
|
/**
|
|
@@ -54336,6 +54531,7 @@ ${TOOL_SELECTION_GUIDE}
|
|
|
54336
54531
|
addCreateWorkspaceCommandTool(server);
|
|
54337
54532
|
addListGeneratorsTool(server, generators);
|
|
54338
54533
|
addGeneratorGuideTool(server, generators);
|
|
54534
|
+
addToExistingProjectTool(server, generators);
|
|
54339
54535
|
return server;
|
|
54340
54536
|
};
|
|
54341
54537
|
(async () => {
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Building with AI
|
|
3
|
+
description: Building with AI and the Nx Plugin for AWS MCP Server
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Link from "@components/link.astro";
|
|
7
|
+
import Snippet from "@components/snippet.astro";
|
|
8
|
+
import { Steps, Tabs, TabItem } from "@astrojs/starlight/components";
|
|
9
|
+
|
|
10
|
+
Install the [Claude Plugin](https://code.claude.com/docs/en/plugins), [Kiro Power](https://kiro.dev/docs/powers/), or [MCP Server](https://modelcontextprotocol.io/introduction) to enable AI assistants to work effectively with the plugin. By using these, you can accelerate your development workflow with AI while benefitting from your projects being scaffolded in a consistent fashion, spending less time on setting up the main components and benefitting from the security, observability, type-safety and local development built into the plugin.
|
|
11
|
+
|
|
12
|
+
## Configure your AI Assistant
|
|
13
|
+
|
|
14
|
+
:::tip[Project-level configuration is automatic]
|
|
15
|
+
Workspaces created with the Nx Plugin for AWS preset already include project-level MCP configuration for common coding agents (Claude Code, Cursor, Kiro, Gemini CLI, GitHub Copilot and OpenAI Codex). Any agent working inside the workspace can use the MCP server without further setup. The steps below configure the MCP server globally for use across all of your projects.
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
<Tabs syncKey="ai-assistant">
|
|
19
|
+
<TabItem label="Kiro">
|
|
20
|
+
The Nx Plugin for AWS ships as a [Kiro Power](https://kiro.dev/docs/powers/) that bundles the MCP server with steering documentation and workflow guides.
|
|
21
|
+
|
|
22
|
+
<Steps>
|
|
23
|
+
|
|
24
|
+
1. Open the Powers panel in Kiro and click **Add power from GitHub**
|
|
25
|
+
2. Enter the following URL:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
https://github.com/awslabs/nx-plugin-for-aws/tree/main/powers/nx-plugin-for-aws
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. Click **Install**
|
|
32
|
+
|
|
33
|
+
</Steps>
|
|
34
|
+
|
|
35
|
+
Kiro automatically configures the MCP server — no additional setup required.
|
|
36
|
+
|
|
37
|
+
</TabItem>
|
|
38
|
+
<TabItem label="Kiro CLI">
|
|
39
|
+
Run the following command:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
kiro-cli mcp add \
|
|
43
|
+
--name nx-plugin-for-aws \
|
|
44
|
+
--scope global \
|
|
45
|
+
--command npx \
|
|
46
|
+
--args "-y,@aws/nx-plugin-mcp"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
See the [Kiro CLI MCP docs](https://kiro.dev/docs/cli/mcp/) for more details.
|
|
50
|
+
|
|
51
|
+
</TabItem>
|
|
52
|
+
<TabItem label="Claude Code">
|
|
53
|
+
The Nx Plugin for AWS is distributed as a [Claude Code plugin](https://code.claude.com/docs/en/plugins) that bundles a [Skill](https://code.claude.com/docs/en/skills) with the MCP server.
|
|
54
|
+
|
|
55
|
+
Run the following commands inside Claude Code, one at a time:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
/plugin marketplace add awslabs/nx-plugin-for-aws
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/plugin install nx-plugin-for-aws@nx-plugin-for-aws
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then run `/reload-plugins` to activate the plugin.
|
|
66
|
+
|
|
67
|
+
</TabItem>
|
|
68
|
+
<TabItem label="Cursor">
|
|
69
|
+
Add the following to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your project):
|
|
70
|
+
|
|
71
|
+
<Snippet name="mcp/config" />
|
|
72
|
+
|
|
73
|
+
See the [Cursor MCP docs](https://cursor.com/docs/mcp) for more details.
|
|
74
|
+
|
|
75
|
+
</TabItem>
|
|
76
|
+
<TabItem label="Codex">
|
|
77
|
+
Add the following to `~/.codex/config.toml`:
|
|
78
|
+
|
|
79
|
+
```toml
|
|
80
|
+
[mcp_servers.nx-plugin-for-aws]
|
|
81
|
+
command = "npx"
|
|
82
|
+
args = ["-y", "@aws/nx-plugin-mcp"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
See the [Codex config docs](https://developers.openai.com/codex/config-reference) for more details.
|
|
86
|
+
|
|
87
|
+
</TabItem>
|
|
88
|
+
<TabItem label="Other">
|
|
89
|
+
Most MCP-compatible assistants use a JSON configuration file. Add the following entry:
|
|
90
|
+
|
|
91
|
+
<Snippet name="mcp/config" />
|
|
92
|
+
|
|
93
|
+
If you have issues such as `ENOENT npx`, replace the command with the full path to `npx` (find it with `which npx`).
|
|
94
|
+
|
|
95
|
+
For assistant-specific documentation:
|
|
96
|
+
|
|
97
|
+
<Snippet name="mcp/assistant-docs" />
|
|
98
|
+
|
|
99
|
+
</TabItem>
|
|
100
|
+
</Tabs>
|
|
101
|
+
|
|
102
|
+
## Start Vibe Coding
|
|
103
|
+
|
|
104
|
+
Ask your AI Assistant to build something using the `nx-plugin-for-aws`! It will typically create a workspace, scaffold with the applicable generators, then fill in the business logic.
|
|
105
|
+
|
|
106
|
+
Try a prompt like:
|
|
107
|
+
|
|
108
|
+
> _"Build a multi-agent application using the Nx Plugin for AWS. I want a React frontend that talks to a backend orchestrator agent which delegates to specialised research and writing agents."_
|
|
109
|
+
|
|
110
|
+
Or for a smaller starting point:
|
|
111
|
+
|
|
112
|
+
> _"Use the Nx Plugin for AWS to scaffold a React website backed by a tRPC API, with Cognito auth and CDK infrastructure."_
|
|
113
|
+
|
|
114
|
+
## Build your own MCP Server
|
|
115
|
+
|
|
116
|
+
Check out the <Link path="/guides/ts-mcp-server">`ts#mcp-server` generator guide</Link> for details about building your own MCP Server.
|