@aws/nx-plugin-mcp 1.0.0-rc.36 → 1.0.0-rc.38
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 +327 -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/connection/agentcore-gateway-mcp.mdx +1 -1
- package/docs/guides/connection/react-py-agent.mdx +4 -10
- package/docs/guides/connection/react-ts-agent.mdx +3 -3
- package/docs/guides/py-agent.mdx +5 -5
- package/docs/guides/ts-agent.mdx +3 -3
- package/docs/snippets/agent/runtime-arn.mdx +21 -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,217 @@ 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-check-updates": "22.2.9",
|
|
21392
|
+
"oidc-client-ts": "3.5.0",
|
|
21393
|
+
pg: "8.22.0",
|
|
21394
|
+
prisma: "7.8.0",
|
|
21395
|
+
"react-oidc-context": "3.3.1",
|
|
21396
|
+
react: "19.2.7",
|
|
21397
|
+
"react-dom": "19.2.7",
|
|
21398
|
+
rimraf: "6.1.3",
|
|
21399
|
+
rolldown: "1.1.5",
|
|
21400
|
+
"simple-git": "3.36.0",
|
|
21401
|
+
"source-map-support": "0.5.21",
|
|
21402
|
+
"starlight-blog": "0.28.0",
|
|
21403
|
+
tailwindcss: "4.3.2",
|
|
21404
|
+
"@tailwindcss/vite": "4.3.2",
|
|
21405
|
+
tsx: "4.23.0",
|
|
21406
|
+
"lucide-react": "1.24.0",
|
|
21407
|
+
"radix-ui": "1.6.2",
|
|
21408
|
+
shadcn: "4.13.0",
|
|
21409
|
+
"tw-animate-css": "1.4.0",
|
|
21410
|
+
"tailwind-merge": "3.6.0",
|
|
21411
|
+
vite: "8.1.4",
|
|
21412
|
+
typescript: "6.0.3",
|
|
21413
|
+
vitest: "4.1.10",
|
|
21414
|
+
zod: "4.4.3",
|
|
21415
|
+
ws: "8.21.0"
|
|
21416
|
+
}["@nx/devkit"];
|
|
21417
|
+
const PACKAGE_MANAGER_COMMANDS = {
|
|
21418
|
+
npm: {
|
|
21419
|
+
exec: "npx",
|
|
21420
|
+
run: "npm run",
|
|
21421
|
+
create: "npm create"
|
|
21422
|
+
},
|
|
21423
|
+
pnpm: {
|
|
21424
|
+
exec: "pnpm",
|
|
21425
|
+
run: "pnpm",
|
|
21426
|
+
create: "pnpm create"
|
|
21427
|
+
},
|
|
21428
|
+
yarn: {
|
|
21429
|
+
exec: "yarn",
|
|
21430
|
+
run: "yarn",
|
|
21431
|
+
create: "yarn create"
|
|
21432
|
+
},
|
|
21433
|
+
bun: {
|
|
21434
|
+
exec: "bunx",
|
|
21435
|
+
run: "bun",
|
|
21436
|
+
create: "bun create"
|
|
21437
|
+
}
|
|
21438
|
+
};
|
|
21439
|
+
/**
|
|
21440
|
+
* Build a package manager exec command (e.g. pnpm cmd, npx cmd, bunx cmd)
|
|
21441
|
+
*/
|
|
21442
|
+
const buildPackageManagerExecCommand = (pm, command) => {
|
|
21443
|
+
return `${PACKAGE_MANAGER_COMMANDS[pm]?.exec ?? pm} ${command}`;
|
|
21444
|
+
};
|
|
21445
|
+
/**
|
|
21446
|
+
* Build a short package manager command (e.g. pnpm build, npm run build)
|
|
21447
|
+
*/
|
|
21448
|
+
const buildPackageManagerShortCommand = (pm, command) => {
|
|
21449
|
+
return `${PACKAGE_MANAGER_COMMANDS[pm]?.run ?? pm} ${command}`;
|
|
21450
|
+
};
|
|
21451
|
+
/**
|
|
21452
|
+
* Build an install command for a given package manager
|
|
21453
|
+
*/
|
|
21454
|
+
const buildInstallCommand = (pm, pkg, dev) => {
|
|
21455
|
+
switch (pm) {
|
|
21456
|
+
case "pnpm": return `pnpm add ${dev ? "-D" : "-"}w ${pkg}`;
|
|
21457
|
+
case "yarn": return `yarn add ${dev ? "-D " : ""}${pkg}`;
|
|
21458
|
+
case "npm": return `npm install --legacy-peer-deps ${dev ? "-D " : ""}${pkg}`;
|
|
21459
|
+
case "bun": return `bun install ${dev ? "-D " : ""}${pkg}`;
|
|
21460
|
+
default: return `${pm} install ${dev ? "-D " : ""}${pkg}`;
|
|
21461
|
+
}
|
|
21462
|
+
};
|
|
21463
|
+
/**
|
|
21464
|
+
* Build the command that adds Nx to a non-Nx project, pinned to the nx
|
|
21465
|
+
* version the plugin is built against.
|
|
21466
|
+
*/
|
|
21467
|
+
const buildNxInitCommand = (pm) => {
|
|
21468
|
+
return `${{
|
|
21469
|
+
npm: "npx",
|
|
21470
|
+
pnpm: "pnpm dlx",
|
|
21471
|
+
yarn: "yarn dlx",
|
|
21472
|
+
bun: "bunx"
|
|
21473
|
+
}[pm] ?? "npx"} nx@${NX_VERSION} init`;
|
|
21474
|
+
};
|
|
21475
|
+
/**
|
|
21476
|
+
* Build a command to create a new workspace using @aws/create-nx-workspace.
|
|
21477
|
+
*
|
|
21478
|
+
* Uses the `create` shorthand for each package manager:
|
|
21479
|
+
* npm create @aws/nx-workspace my-project
|
|
21480
|
+
* pnpm create @aws/nx-workspace my-project
|
|
21481
|
+
* yarn create @aws/nx-workspace my-project
|
|
21482
|
+
* bun create @aws/nx-workspace my-project
|
|
21483
|
+
*
|
|
21484
|
+
* The package manager is auto-detected by @aws/create-nx-workspace from the
|
|
21485
|
+
* invoking command, so --pm is not needed.
|
|
21486
|
+
*/
|
|
21487
|
+
const buildCreateNxWorkspaceCommand = (pm, workspace, iac, tag, module) => {
|
|
21488
|
+
return [
|
|
21489
|
+
PACKAGE_MANAGER_COMMANDS[pm]?.create ?? `${pm} create`,
|
|
21490
|
+
tag ? `@aws/nx-workspace@${tag}` : "@aws/nx-workspace",
|
|
21491
|
+
...pm === "npm" ? ["--"] : [],
|
|
21492
|
+
workspace,
|
|
21493
|
+
...iac ? [`--iac=${iac}`] : [],
|
|
21494
|
+
...module ? [`--module=${module}`] : []
|
|
21495
|
+
].join(" ");
|
|
21496
|
+
};
|
|
21497
|
+
//#endregion
|
|
21405
21498
|
//#region ../nx-plugin/src/mcp-server/guide-render.ts
|
|
21406
21499
|
/**
|
|
21407
21500
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -53532,12 +53625,22 @@ const stringifyMdx = (tree, deps) => String(deps.unified().use(deps.remarkFrontm
|
|
|
53532
53625
|
fences: true,
|
|
53533
53626
|
listItemIndent: "one"
|
|
53534
53627
|
}).stringify(tree));
|
|
53628
|
+
/**
|
|
53629
|
+
* Remove nodes that are meaningless once the MDX is rendered to plain markdown
|
|
53630
|
+
* for an agent: the YAML frontmatter block and the `import`/`export` (ESM)
|
|
53631
|
+
* statements at the top of every docs page. They add noise and tokens without
|
|
53632
|
+
* conveying guidance.
|
|
53633
|
+
*/
|
|
53634
|
+
const stripFrontmatterAndEsm = (tree) => {
|
|
53635
|
+
tree.children = tree.children.filter((node) => node.type !== "yaml" && node.type !== "mdxjsEsm");
|
|
53636
|
+
};
|
|
53535
53637
|
const postProcessGuideWithRemark = async (guide, opts) => {
|
|
53536
53638
|
const deps = await loadRemarkDeps();
|
|
53537
53639
|
const tree = parseMdxWithDeps(guide, deps);
|
|
53538
53640
|
await inlineSnippets(tree, opts, deps);
|
|
53539
53641
|
applyFilterTransforms(tree, opts.options);
|
|
53540
53642
|
applyComponentTransforms(tree, opts, deps);
|
|
53643
|
+
stripFrontmatterAndEsm(tree);
|
|
53541
53644
|
return stringifyMdx(tree, deps);
|
|
53542
53645
|
};
|
|
53543
53646
|
const inlineSnippets = async (tree, opts, deps) => {
|
|
@@ -53781,6 +53884,7 @@ const renderComponent = (node, opts, pm, deps) => {
|
|
|
53781
53884
|
const iac = readStringAttr(node, "iac");
|
|
53782
53885
|
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, iac))];
|
|
53783
53886
|
}
|
|
53887
|
+
case "NxInitCommand": return [codeBlock(buildNxInitCommand(pm))];
|
|
53784
53888
|
case "InstallCommand": {
|
|
53785
53889
|
const pkg = readStringAttr(node, "pkg") ?? readExpressionAttr(node, "pkg");
|
|
53786
53890
|
if (!pkg) return void 0;
|
|
@@ -54086,19 +54190,29 @@ const parseGuide = async (raw) => {
|
|
|
54086
54190
|
};
|
|
54087
54191
|
};
|
|
54088
54192
|
/**
|
|
54089
|
-
*
|
|
54193
|
+
* Base directories to probe for guide MDX files, relative to this module.
|
|
54194
|
+
* Each is checked in order:
|
|
54090
54195
|
* 1. Bundled docs in the published @aws/nx-plugin-mcp package
|
|
54091
54196
|
* 2. Source checkout when running from the monorepo (dev/test)
|
|
54092
54197
|
* 3. Rolldown-bundled binary in dist/ (monorepo layout)
|
|
54093
54198
|
*/
|
|
54094
|
-
const
|
|
54095
|
-
"../docs
|
|
54096
|
-
"../../../docs/src/content/docs/en
|
|
54097
|
-
"../../../../docs/src/content/docs/en
|
|
54199
|
+
const GUIDE_BASE_PROBES = [
|
|
54200
|
+
"../docs",
|
|
54201
|
+
"../../../docs/src/content/docs/en",
|
|
54202
|
+
"../../../../docs/src/content/docs/en"
|
|
54098
54203
|
];
|
|
54204
|
+
/**
|
|
54205
|
+
* Content sub-directories that hold pages a generator may reference via
|
|
54206
|
+
* `guidePages`. Both the per-generator reference guides (`guides/`) and the
|
|
54207
|
+
* getting-started pages (`get_started/`) are fetchable, so a page can live in
|
|
54208
|
+
* whichever section reads best for humans while still being served by the MCP
|
|
54209
|
+
* tools. Bare `guidePages` names may also include a sub-path (e.g.
|
|
54210
|
+
* `connection/react-trpc`).
|
|
54211
|
+
*/
|
|
54212
|
+
const GUIDE_SECTIONS = ["guides", "get_started"];
|
|
54099
54213
|
const fetchLocalGuide = (guide) => {
|
|
54100
|
-
for (const
|
|
54101
|
-
const candidate = path$3.default.resolve(__dirname,
|
|
54214
|
+
for (const base of GUIDE_BASE_PROBES) for (const section of GUIDE_SECTIONS) {
|
|
54215
|
+
const candidate = path$3.default.resolve(__dirname, base, section, `${guide}.mdx`);
|
|
54102
54216
|
try {
|
|
54103
54217
|
if (fs.default.existsSync(candidate)) return fs.default.readFileSync(candidate, "utf-8");
|
|
54104
54218
|
} catch {}
|
|
@@ -54145,6 +54259,85 @@ const postProcessGuide = async (guide, generators, packageManager, snippetConten
|
|
|
54145
54259
|
});
|
|
54146
54260
|
};
|
|
54147
54261
|
//#endregion
|
|
54262
|
+
//#region ../nx-plugin/src/mcp-server/schema.ts
|
|
54263
|
+
/**
|
|
54264
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
54265
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
54266
|
+
*/
|
|
54267
|
+
const PACKAGE_MANAGERS = [
|
|
54268
|
+
"pnpm",
|
|
54269
|
+
"yarn",
|
|
54270
|
+
"npm",
|
|
54271
|
+
"bun"
|
|
54272
|
+
];
|
|
54273
|
+
const PackageManagerSchema = _enum(PACKAGE_MANAGERS);
|
|
54274
|
+
//#endregion
|
|
54275
|
+
//#region ../nx-plugin/src/mcp-server/tools/add-to-existing-project.ts
|
|
54276
|
+
/**
|
|
54277
|
+
* The guide page (under `get_started/`) that backs this tool, so the tool and
|
|
54278
|
+
* the published docs never drift.
|
|
54279
|
+
*/
|
|
54280
|
+
const EXISTING_PROJECT_GUIDE = "existing-project";
|
|
54281
|
+
/**
|
|
54282
|
+
* Add a tool which guides an agent through adding @aws/nx-plugin to an
|
|
54283
|
+
* existing Nx or non-Nx workspace. Returns the `existing-project` docs page,
|
|
54284
|
+
* which includes the full adoption steps and troubleshooting reference.
|
|
54285
|
+
*/
|
|
54286
|
+
const addToExistingProjectTool = (server, generators) => {
|
|
54287
|
+
server.registerTool("add-to-existing-project", {
|
|
54288
|
+
title: "Add to Existing Project",
|
|
54289
|
+
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.",
|
|
54290
|
+
inputSchema: { packageManager: PackageManagerSchema.optional() }
|
|
54291
|
+
}, async ({ packageManager }) => {
|
|
54292
|
+
return { content: [{
|
|
54293
|
+
type: "text",
|
|
54294
|
+
text: await fetchGuidePages([EXISTING_PROJECT_GUIDE], generators, packageManager)
|
|
54295
|
+
}] };
|
|
54296
|
+
});
|
|
54297
|
+
};
|
|
54298
|
+
//#endregion
|
|
54299
|
+
//#region ../nx-plugin/src/utils/iac-providers.ts
|
|
54300
|
+
/**
|
|
54301
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
54302
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
54303
|
+
*/
|
|
54304
|
+
const IAC_PROVIDERS = ["cdk", "terraform"];
|
|
54305
|
+
//#endregion
|
|
54306
|
+
//#region ../nx-plugin/src/mcp-server/tools/create-workspace-command.ts
|
|
54307
|
+
/**
|
|
54308
|
+
* Add a tool which tells a model how to create an Nx workspace
|
|
54309
|
+
*/
|
|
54310
|
+
const addCreateWorkspaceCommandTool = (server) => {
|
|
54311
|
+
server.registerTool("create-workspace-command", {
|
|
54312
|
+
description: "Tool to discover how to create a workspace to start a new project.",
|
|
54313
|
+
inputSchema: { packageManager: PackageManagerSchema }
|
|
54314
|
+
}, ({ packageManager }) => ({ content: [{
|
|
54315
|
+
type: "text",
|
|
54316
|
+
text: `Run the following command to create a workspace:
|
|
54317
|
+
|
|
54318
|
+
\`\`\`bash
|
|
54319
|
+
${buildCreateNxWorkspaceCommand(packageManager, "<workspace-name>")} --no-interactive
|
|
54320
|
+
\`\`\`
|
|
54321
|
+
|
|
54322
|
+
This will create a new workspace within the \`<workspace-name>\` directory.
|
|
54323
|
+
|
|
54324
|
+
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:
|
|
54325
|
+
|
|
54326
|
+
\`\`\`bash
|
|
54327
|
+
${buildCreateNxWorkspaceCommand(packageManager, ".")} --no-interactive
|
|
54328
|
+
\`\`\`
|
|
54329
|
+
|
|
54330
|
+
Note that this will prompt for an Infrastructure as Code provider (${IAC_PROVIDERS.join(", ")}).
|
|
54331
|
+
If you know the preferred option, pass ${IAC_PROVIDERS.map((iac) => `\`--iac=${iac}\``).join(" or ")} to the above command to skip the prompt.
|
|
54332
|
+
|
|
54333
|
+
Additional options:
|
|
54334
|
+
- \`--no-gitSecrets\`: Opt out of the default git-secrets pre-commit hook (prevents committing AWS credentials)
|
|
54335
|
+
|
|
54336
|
+
Refer to the \`general-guidance\` tool for full workspace documentation including structure, common commands, and configuration.
|
|
54337
|
+
`
|
|
54338
|
+
}] }));
|
|
54339
|
+
};
|
|
54340
|
+
//#endregion
|
|
54148
54341
|
//#region ../nx-plugin/src/mcp-server/tools/list-generators.ts
|
|
54149
54342
|
/**
|
|
54150
54343
|
* Adds a tool which lists details about the available generators.
|
|
@@ -54217,6 +54410,7 @@ const TOOL_SELECTION_GUIDE = `## Tool Selection Guide
|
|
|
54217
54410
|
|
|
54218
54411
|
- Use the \`general-guidance\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.
|
|
54219
54412
|
- Use the \`create-workspace-command\` tool to discover how to create a workspace to start a new project.
|
|
54413
|
+
- 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
54414
|
- Use the \`list-generators\` tool to discover the available generators and how to run them.
|
|
54221
54415
|
- Use the \`generator-guide\` tool to retrieve detailed information about a specific generator.`;
|
|
54222
54416
|
/**
|
|
@@ -54336,6 +54530,7 @@ ${TOOL_SELECTION_GUIDE}
|
|
|
54336
54530
|
addCreateWorkspaceCommandTool(server);
|
|
54337
54531
|
addListGeneratorsTool(server, generators);
|
|
54338
54532
|
addGeneratorGuideTool(server, generators);
|
|
54533
|
+
addToExistingProjectTool(server, generators);
|
|
54339
54534
|
return server;
|
|
54340
54535
|
};
|
|
54341
54536
|
(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.
|