@aws/nx-plugin-mcp 0.121.0 → 1.0.0-rc.1
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 +63 -18
- package/docs/guides/astro-docs.mdx +5 -3
- package/docs/guides/connection/py-agent-a2a.mdx +1 -1
- package/docs/guides/connection/py-agent-mcp.mdx +1 -1
- package/docs/guides/connection/react-agui.mdx +3 -3
- package/docs/guides/connection/react-fastapi.mdx +1 -1
- package/docs/guides/connection/react-py-agent.mdx +3 -3
- package/docs/guides/connection/react-smithy.mdx +1 -1
- package/docs/guides/connection/react-trpc.mdx +2 -2
- package/docs/guides/connection/react-ts-agent.mdx +3 -3
- package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
- package/docs/guides/connection/ts-agent-mcp.mdx +1 -1
- package/docs/guides/docs.mdx +21 -0
- package/docs/guides/fastapi.mdx +11 -9
- package/docs/guides/py-agent.mdx +18 -18
- package/docs/guides/py-api.mdx +22 -0
- package/docs/guides/py-mcp-server.mdx +5 -5
- package/docs/guides/python-lambda-function.mdx +4 -4
- package/docs/guides/react-website-auth.mdx +3 -3
- package/docs/guides/react-website.mdx +8 -5
- package/docs/guides/trpc.mdx +18 -16
- package/docs/guides/ts-agent.mdx +18 -18
- package/docs/guides/ts-api.mdx +28 -0
- package/docs/guides/ts-lambda-function.mdx +4 -4
- package/docs/guides/ts-mcp-server.mdx +5 -5
- package/docs/guides/ts-rdb.mdx +3 -3
- package/docs/guides/ts-smithy-api.mdx +8 -6
- package/docs/guides/website.mdx +21 -0
- package/docs/guides/workspace.mdx +2 -2
- package/docs/snippets/agent/architecture.mdx +4 -4
- package/docs/snippets/agent/bedrock-deployment.mdx +2 -2
- package/docs/snippets/api/api-architecture.mdx +2 -2
- package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
- package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
- package/docs/snippets/api/type-safe-api-integrations.mdx +2 -2
- package/docs/snippets/lambda-function/deploying-your-function.mdx +2 -2
- package/docs/snippets/mcp/architecture.mdx +4 -4
- package/docs/snippets/mcp/bedrock-deployment.mdx +2 -2
- package/generators.json +47 -6
- package/package.json +1 -1
- package/src/infra/app/schema.json +1 -1
- package/src/preset/schema.json +4 -4
- package/src/py/agent/schema.json +18 -18
- package/src/py/api/schema.json +100 -0
- package/src/py/fast-api/schema.json +15 -15
- package/src/py/lambda-function/schema.json +7 -7
- package/src/py/mcp-server/schema.json +15 -15
- package/src/py/project/schema.json +2 -2
- package/src/smithy/ts/api/schema.json +15 -15
- package/src/trpc/backend/schema.json +15 -15
- package/src/ts/agent/schema.json +18 -18
- package/src/ts/api/schema.json +105 -0
- package/src/ts/docs/schema.json +70 -0
- package/src/ts/lambda-function/schema.json +7 -7
- package/src/ts/mcp-server/schema.json +15 -15
- package/src/ts/rdb/schema.json +13 -13
- package/src/ts/react-website/app/schema.json +13 -13
- package/src/ts/react-website/cognito-auth/schema.json +4 -4
- package/src/ts/website/app/schema.json +97 -0
- package/src/ts/website/auth/schema.json +46 -0
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -19072,12 +19072,20 @@ var generators$1 = {
|
|
|
19072
19072
|
"metric": "g20",
|
|
19073
19073
|
"hidden": true
|
|
19074
19074
|
},
|
|
19075
|
+
"py#api": {
|
|
19076
|
+
"factory": "./src/py/api/generator",
|
|
19077
|
+
"schema": "./src/py/api/schema.json",
|
|
19078
|
+
"description": "Create a Python API",
|
|
19079
|
+
"metric": "g45",
|
|
19080
|
+
"guidePages": ["py-api", "fastapi"]
|
|
19081
|
+
},
|
|
19075
19082
|
"py#fast-api": {
|
|
19076
19083
|
"factory": "./src/py/fast-api/generator",
|
|
19077
19084
|
"schema": "./src/py/fast-api/schema.json",
|
|
19078
19085
|
"description": "Generates a FastAPI Python project",
|
|
19079
19086
|
"metric": "g3",
|
|
19080
|
-
"guidePages": ["fastapi"]
|
|
19087
|
+
"guidePages": ["fastapi"],
|
|
19088
|
+
"hidden": true
|
|
19081
19089
|
},
|
|
19082
19090
|
"py#fast-api#react-connection": {
|
|
19083
19091
|
"factory": "./src/py/fast-api/react/generator",
|
|
@@ -19147,12 +19155,20 @@ var generators$1 = {
|
|
|
19147
19155
|
"metric": "g23",
|
|
19148
19156
|
"guidePages": ["terraform-project"]
|
|
19149
19157
|
},
|
|
19158
|
+
"ts#docs": {
|
|
19159
|
+
"factory": "./src/ts/docs/generator",
|
|
19160
|
+
"schema": "./src/ts/docs/schema.json",
|
|
19161
|
+
"description": "Generates a documentation site",
|
|
19162
|
+
"metric": "g43",
|
|
19163
|
+
"guidePages": ["docs", "astro-docs"]
|
|
19164
|
+
},
|
|
19150
19165
|
"ts#astro-docs": {
|
|
19151
19166
|
"factory": "./src/ts/astro-docs/generator",
|
|
19152
19167
|
"schema": "./src/ts/astro-docs/schema.json",
|
|
19153
19168
|
"description": "Generates an Astro + Starlight documentation site with localisation, snippets, blog, and optional automated documentation translation",
|
|
19154
19169
|
"metric": "g37",
|
|
19155
|
-
"guidePages": ["astro-docs"]
|
|
19170
|
+
"guidePages": ["astro-docs"],
|
|
19171
|
+
"hidden": true
|
|
19156
19172
|
},
|
|
19157
19173
|
"ts#infra": {
|
|
19158
19174
|
"factory": "./src/infra/app/generator",
|
|
@@ -19193,19 +19209,35 @@ var generators$1 = {
|
|
|
19193
19209
|
"metric": "g1",
|
|
19194
19210
|
"guidePages": ["typescript-project"]
|
|
19195
19211
|
},
|
|
19212
|
+
"ts#website": {
|
|
19213
|
+
"factory": "./src/ts/website/app/generator",
|
|
19214
|
+
"schema": "./src/ts/website/app/schema.json",
|
|
19215
|
+
"description": "Generates a website application",
|
|
19216
|
+
"metric": "g43",
|
|
19217
|
+
"guidePages": ["website", "react-website"]
|
|
19218
|
+
},
|
|
19219
|
+
"ts#website#auth": {
|
|
19220
|
+
"factory": "./src/ts/website/auth/generator",
|
|
19221
|
+
"schema": "./src/ts/website/auth/schema.json",
|
|
19222
|
+
"description": "Adds auth to an existing website",
|
|
19223
|
+
"metric": "g44",
|
|
19224
|
+
"guidePages": ["react-website-auth"]
|
|
19225
|
+
},
|
|
19196
19226
|
"ts#react-website": {
|
|
19197
19227
|
"factory": "./src/ts/react-website/app/generator",
|
|
19198
19228
|
"schema": "./src/ts/react-website/app/schema.json",
|
|
19199
19229
|
"description": "Generates a React static website",
|
|
19200
19230
|
"metric": "g5",
|
|
19201
|
-
"guidePages": ["react-website"]
|
|
19231
|
+
"guidePages": ["react-website"],
|
|
19232
|
+
"hidden": true
|
|
19202
19233
|
},
|
|
19203
19234
|
"ts#react-website#auth": {
|
|
19204
19235
|
"factory": "./src/ts/react-website/cognito-auth/generator",
|
|
19205
19236
|
"schema": "./src/ts/react-website/cognito-auth/schema.json",
|
|
19206
19237
|
"description": "Adds auth to an existing React website",
|
|
19207
19238
|
"metric": "g6",
|
|
19208
|
-
"guidePages": ["react-website-auth"]
|
|
19239
|
+
"guidePages": ["react-website-auth"],
|
|
19240
|
+
"hidden": true
|
|
19209
19241
|
},
|
|
19210
19242
|
"ts#react-website#runtime-config": {
|
|
19211
19243
|
"factory": "./src/ts/react-website/runtime-config/generator",
|
|
@@ -19218,7 +19250,8 @@ var generators$1 = {
|
|
|
19218
19250
|
"factory": "./src/smithy/ts/api/generator",
|
|
19219
19251
|
"schema": "./src/smithy/ts/api/schema.json",
|
|
19220
19252
|
"description": "Create an API using Smithy and the Smithy TypeScript Server SDK",
|
|
19221
|
-
"metric": "g26"
|
|
19253
|
+
"metric": "g26",
|
|
19254
|
+
"hidden": true
|
|
19222
19255
|
},
|
|
19223
19256
|
"ts#agent": {
|
|
19224
19257
|
"factory": "./src/ts/agent/generator",
|
|
@@ -19261,12 +19294,24 @@ var generators$1 = {
|
|
|
19261
19294
|
"metric": "g29",
|
|
19262
19295
|
"hidden": true
|
|
19263
19296
|
},
|
|
19297
|
+
"ts#api": {
|
|
19298
|
+
"factory": "./src/ts/api/generator",
|
|
19299
|
+
"schema": "./src/ts/api/schema.json",
|
|
19300
|
+
"description": "Create a TypeScript API",
|
|
19301
|
+
"metric": "g46",
|
|
19302
|
+
"guidePages": [
|
|
19303
|
+
"ts-api",
|
|
19304
|
+
"trpc",
|
|
19305
|
+
"ts-smithy-api"
|
|
19306
|
+
]
|
|
19307
|
+
},
|
|
19264
19308
|
"ts#trpc-api": {
|
|
19265
19309
|
"factory": "./src/trpc/backend/generator",
|
|
19266
19310
|
"schema": "./src/trpc/backend/schema.json",
|
|
19267
19311
|
"description": "creates a trpc backend",
|
|
19268
19312
|
"metric": "g9",
|
|
19269
|
-
"guidePages": ["trpc"]
|
|
19313
|
+
"guidePages": ["trpc"],
|
|
19314
|
+
"hidden": true
|
|
19270
19315
|
},
|
|
19271
19316
|
"ts#trpc-api#react-connection": {
|
|
19272
19317
|
"factory": "./src/trpc/react/generator",
|
|
@@ -19347,7 +19392,7 @@ const PackageManagerSchema = _enum(PACKAGE_MANAGERS);
|
|
|
19347
19392
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
19348
19393
|
* SPDX-License-Identifier: Apache-2.0
|
|
19349
19394
|
*/
|
|
19350
|
-
const IAC_PROVIDERS = ["
|
|
19395
|
+
const IAC_PROVIDERS = ["cdk", "terraform"];
|
|
19351
19396
|
//#endregion
|
|
19352
19397
|
//#region ../nx-plugin/src/utils/commands.ts
|
|
19353
19398
|
const PACKAGE_MANAGER_COMMANDS = {
|
|
@@ -19408,13 +19453,13 @@ const buildInstallCommand = (pm, pkg, dev) => {
|
|
|
19408
19453
|
* The package manager is auto-detected by @aws/create-nx-workspace from the
|
|
19409
19454
|
* invoking command, so --pm is not needed.
|
|
19410
19455
|
*/
|
|
19411
|
-
const buildCreateNxWorkspaceCommand = (pm, workspace,
|
|
19456
|
+
const buildCreateNxWorkspaceCommand = (pm, workspace, iac, tag) => {
|
|
19412
19457
|
return [
|
|
19413
19458
|
PACKAGE_MANAGER_COMMANDS[pm]?.create ?? `${pm} create`,
|
|
19414
19459
|
tag ? `@aws/nx-workspace@${tag}` : "@aws/nx-workspace",
|
|
19415
19460
|
...pm === "npm" ? ["--"] : [],
|
|
19416
19461
|
workspace,
|
|
19417
|
-
...
|
|
19462
|
+
...iac ? [`--iac=${iac}`] : []
|
|
19418
19463
|
].join(" ");
|
|
19419
19464
|
};
|
|
19420
19465
|
//#endregion
|
|
@@ -19443,7 +19488,7 @@ ${buildCreateNxWorkspaceCommand(packageManager, ".")} --no-interactive
|
|
|
19443
19488
|
\`\`\`
|
|
19444
19489
|
|
|
19445
19490
|
Note that this will prompt for an Infrastructure as Code provider (${IAC_PROVIDERS.join(", ")}).
|
|
19446
|
-
If you know the preferred option, pass ${IAC_PROVIDERS.map((iac) => `\`--
|
|
19491
|
+
If you know the preferred option, pass ${IAC_PROVIDERS.map((iac) => `\`--iac=${iac}\``).join(" or ")} to the above command to skip the prompt.
|
|
19447
19492
|
|
|
19448
19493
|
Additional options:
|
|
19449
19494
|
- \`--no-gitSecrets\`: Opt out of the default git-secrets pre-commit hook (prevents committing AWS credentials)
|
|
@@ -52240,7 +52285,7 @@ const inlineSnippets = async (tree, opts, deps) => {
|
|
|
52240
52285
|
}
|
|
52241
52286
|
};
|
|
52242
52287
|
const applyFilterTransforms = (tree, options) => {
|
|
52243
|
-
const
|
|
52288
|
+
const iac = options?.iac;
|
|
52244
52289
|
const transform = (parent) => {
|
|
52245
52290
|
const children = parent.children;
|
|
52246
52291
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -52259,12 +52304,12 @@ const applyFilterTransforms = (tree, options) => {
|
|
|
52259
52304
|
continue;
|
|
52260
52305
|
}
|
|
52261
52306
|
if (child.name === "Infrastructure") {
|
|
52262
|
-
if (
|
|
52307
|
+
if (iac === "cdk" || iac === "terraform") {
|
|
52263
52308
|
const pseudo = {
|
|
52264
52309
|
type: "mdxJsxFlowElement",
|
|
52265
52310
|
name: "tmp",
|
|
52266
52311
|
attributes: [],
|
|
52267
|
-
children: selectInfrastructureSlot(child,
|
|
52312
|
+
children: selectInfrastructureSlot(child, iac)
|
|
52268
52313
|
};
|
|
52269
52314
|
transform(pseudo);
|
|
52270
52315
|
children.splice(i, 1, ...pseudo.children);
|
|
@@ -52295,8 +52340,8 @@ const applyFilterTransforms = (tree, options) => {
|
|
|
52295
52340
|
};
|
|
52296
52341
|
transform(tree);
|
|
52297
52342
|
};
|
|
52298
|
-
const selectInfrastructureSlot = (node,
|
|
52299
|
-
const slotName =
|
|
52343
|
+
const selectInfrastructureSlot = (node, iac) => {
|
|
52344
|
+
const slotName = iac.toLowerCase();
|
|
52300
52345
|
return node.children.find((c) => isJsxElement(c) && c.name === "Fragment" && readStringAttr(c, "slot") === slotName)?.children ?? [];
|
|
52301
52346
|
};
|
|
52302
52347
|
/**
|
|
@@ -52410,7 +52455,7 @@ const renderComponent = (node, opts, pm, deps) => {
|
|
|
52410
52455
|
case "CreateNxWorkspaceCommand": {
|
|
52411
52456
|
const workspace = readStringAttr(node, "workspace");
|
|
52412
52457
|
if (!workspace) return void 0;
|
|
52413
|
-
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, readStringAttr(node, "
|
|
52458
|
+
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, readStringAttr(node, "iac")))];
|
|
52414
52459
|
}
|
|
52415
52460
|
case "InstallCommand": {
|
|
52416
52461
|
const pkg = readStringAttr(node, "pkg") ?? readExpressionAttr(node, "pkg");
|
|
@@ -52807,11 +52852,11 @@ const addListGeneratorsTool = (server, generators) => {
|
|
|
52807
52852
|
*/
|
|
52808
52853
|
const addGeneratorGuideTool = (server, generators) => {
|
|
52809
52854
|
server.registerTool("generator-guide", {
|
|
52810
|
-
description: "Tool to retrieve detailed information about a specific generator. Pass `options` with the values you intend to use for any filterable option (e.g.
|
|
52855
|
+
description: "Tool to retrieve detailed information about a specific generator. Pass `options` with the values you intend to use for any filterable option (e.g. infra, iac, auth, ux, protocol, sourceType, targetType) to receive only the guide content relevant to those choices — this cuts noise and avoids suggesting configuration from a different branch. The filterable keys and their valid values for each generator are listed by the `list-generators` tool; call it first if you are not sure which keys to pass. When the combination you pick is not supported by the generator (e.g. connection from ts#trpc-api to smithy), the tool returns an \"Unsupported combination\" warning with the list of supported pairs. When `options` is omitted, every conditional section is included and prefixed with a `> [!NOTE] Only when …` marker so you can see the branching condition.",
|
|
52811
52856
|
inputSchema: {
|
|
52812
52857
|
packageManager: PackageManagerSchema,
|
|
52813
52858
|
generator: _enum(generators.map((g) => g.id)),
|
|
52814
|
-
options: record(string$2(), string$2()).optional().describe("Optional map of generator option values (e.g. {
|
|
52859
|
+
options: record(string$2(), string$2()).optional().describe("Optional map of generator option values (e.g. { infra: \"rest-lambda\", iac: \"cdk\" }) used to filter the guide to content that applies to those choices.")
|
|
52815
52860
|
}
|
|
52816
52861
|
}, async ({ packageManager, generator: generatorId, options }) => {
|
|
52817
52862
|
const generator = generators.find((g) => g.id === generatorId);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Astro Docs
|
|
3
3
|
description: Reference documentation for an Astro + Starlight documentation site
|
|
4
|
-
|
|
4
|
+
when:
|
|
5
|
+
framework:
|
|
6
|
+
- astro
|
|
5
7
|
---
|
|
6
8
|
import { FileTree } from '@astrojs/starlight/components';
|
|
7
9
|
import RunGenerator from '@components/run-generator.astro';
|
|
@@ -23,11 +25,11 @@ By default it also scaffolds an automated translation pipeline powered by a
|
|
|
23
25
|
|
|
24
26
|
You can generate a new Astro docs site in two ways:
|
|
25
27
|
|
|
26
|
-
<RunGenerator generator="ts#
|
|
28
|
+
<RunGenerator generator="ts#docs" />
|
|
27
29
|
|
|
28
30
|
### Options
|
|
29
31
|
|
|
30
|
-
<GeneratorParameters generator="ts#
|
|
32
|
+
<GeneratorParameters generator="ts#docs" />
|
|
31
33
|
|
|
32
34
|
## Generator Output
|
|
33
35
|
|
|
@@ -24,7 +24,7 @@ Before using this generator, ensure you have:
|
|
|
24
24
|
|
|
25
25
|
1. A Python project with a <Link path="guides/py-agent">Strands Agent</Link> component (any protocol)
|
|
26
26
|
2. A project with an Agent component generated with `--protocol=A2A` and `--auth=IAM` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
|
|
27
|
-
3. Both components created with `
|
|
27
|
+
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
@@ -24,7 +24,7 @@ Before using this generator, ensure you have:
|
|
|
24
24
|
|
|
25
25
|
1. A Python project with a <Link path="guides/py-agent">Strands Agent</Link> component
|
|
26
26
|
2. A project with an MCP server component (either <Link path="guides/ts-mcp-server">`ts#mcp-server`</Link> or <Link path="guides/py-mcp-server">`py#mcp-server`</Link>)
|
|
27
|
-
3. Both components created with `
|
|
27
|
+
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
@@ -6,7 +6,7 @@ when:
|
|
|
6
6
|
targetType:
|
|
7
7
|
- ts#agent
|
|
8
8
|
- py#agent
|
|
9
|
-
protocol:
|
|
9
|
+
protocol: ag-ui
|
|
10
10
|
---
|
|
11
11
|
import { FileTree } from '@astrojs/starlight/components';
|
|
12
12
|
import Link from '@components/link.astro';
|
|
@@ -21,9 +21,9 @@ Nx Plugin for AWS provides a generator to connect a React website to an Agent th
|
|
|
21
21
|
|
|
22
22
|
Before using this generator, ensure you have:
|
|
23
23
|
|
|
24
|
-
1. A React website (generated using the <Link path="guides/react-website">`ts#
|
|
24
|
+
1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
|
|
25
25
|
2. A TypeScript or Python Agent with `protocol=AG-UI` (generated using the <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link> generator)
|
|
26
|
-
3. For deployed agents, Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
26
|
+
3. For deployed agents, Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
@@ -22,7 +22,7 @@ Before using this generator, ensure your React application has:
|
|
|
22
22
|
|
|
23
23
|
1. A `main.tsx` file that renders your application
|
|
24
24
|
2. A working FastAPI backend (generated using the FastAPI generator)
|
|
25
|
-
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
25
|
+
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
|
|
26
26
|
|
|
27
27
|
<details>
|
|
28
28
|
<summary>Example of required `main.tsx` structure</summary>
|
|
@@ -4,7 +4,7 @@ description: Connect a React website to a Python Agent
|
|
|
4
4
|
when:
|
|
5
5
|
sourceType: react
|
|
6
6
|
targetType: py#agent
|
|
7
|
-
protocol:
|
|
7
|
+
protocol: http
|
|
8
8
|
---
|
|
9
9
|
import { FileTree } from '@astrojs/starlight/components';
|
|
10
10
|
import Link from '@components/link.astro';
|
|
@@ -23,9 +23,9 @@ If your Python Agent was generated with `protocol=AG-UI`, the connection generat
|
|
|
23
23
|
|
|
24
24
|
Before using this generator, ensure you have:
|
|
25
25
|
|
|
26
|
-
1. A React website (generated using the <Link path="guides/react-website">`ts#
|
|
26
|
+
1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
|
|
27
27
|
2. A Python Agent with `protocol=HTTP` (generated using the <Link path="guides/py-agent">`py#agent` generator</Link>)
|
|
28
|
-
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
28
|
+
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
@@ -22,7 +22,7 @@ Before using this generator, ensure your React application has:
|
|
|
22
22
|
|
|
23
23
|
1. A `main.tsx` file that renders your application
|
|
24
24
|
2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link>)
|
|
25
|
-
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
25
|
+
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
|
|
26
26
|
|
|
27
27
|
<details>
|
|
28
28
|
<summary>Example of required `main.tsx` structure</summary>
|
|
@@ -19,7 +19,7 @@ Before using this generator, ensure your React application has:
|
|
|
19
19
|
1. A `main.tsx` file that renders your application
|
|
20
20
|
2. An `<App/>` JSX element where the tRPC provider will be automatically injected
|
|
21
21
|
3. A working tRPC API (generated using the tRPC API generator)
|
|
22
|
-
4. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
22
|
+
4. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
|
|
23
23
|
|
|
24
24
|
<details>
|
|
25
25
|
<summary>Example of required `main.tsx` structure</summary>
|
|
@@ -170,7 +170,7 @@ function MyComponent() {
|
|
|
170
170
|
### Subscriptions (Streaming)
|
|
171
171
|
|
|
172
172
|
:::caution[Subscriptions Compute Type]
|
|
173
|
-
Subscriptions are only supported when the tRPC API uses `
|
|
173
|
+
Subscriptions are only supported when the tRPC API uses `rest-lambda` (REST API) as the compute type. API Gateway HTTP APIs do not support response streaming.
|
|
174
174
|
:::
|
|
175
175
|
|
|
176
176
|
When connecting to a REST API tRPC backend, the generated client is automatically configured with a `splitLink` that routes subscription operations through `httpSubscriptionLink` (using SSE) and regular queries/mutations through `httpLink`. This means subscriptions work out of the box with no additional configuration.
|
|
@@ -4,7 +4,7 @@ description: Connect a React website to a TypeScript Agent
|
|
|
4
4
|
when:
|
|
5
5
|
sourceType: react
|
|
6
6
|
targetType: ts#agent
|
|
7
|
-
protocol:
|
|
7
|
+
protocol: http
|
|
8
8
|
---
|
|
9
9
|
import { FileTree } from '@astrojs/starlight/components';
|
|
10
10
|
import Link from '@components/link.astro';
|
|
@@ -18,9 +18,9 @@ Nx Plugin for AWS provides a generator to quickly integrate your <Link path="gui
|
|
|
18
18
|
|
|
19
19
|
Before using this generator, ensure you have:
|
|
20
20
|
|
|
21
|
-
1. A React website (generated using the <Link path="guides/react-website">`ts#
|
|
21
|
+
1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
|
|
22
22
|
2. A TypeScript Agent (generated using the <Link path="guides/ts-agent">`ts#agent` generator</Link>)
|
|
23
|
-
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#
|
|
23
|
+
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
@@ -24,7 +24,7 @@ Before using this generator, ensure you have:
|
|
|
24
24
|
|
|
25
25
|
1. A TypeScript project with a <Link path="guides/ts-agent">Strands Agent</Link> component (any protocol)
|
|
26
26
|
2. A project with an Agent component generated with `--protocol=A2A` and `--auth=IAM` (either <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link>)
|
|
27
|
-
3. Both components created with `
|
|
27
|
+
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
@@ -24,7 +24,7 @@ Before using this generator, ensure you have:
|
|
|
24
24
|
|
|
25
25
|
1. A TypeScript project with a <Link path="guides/ts-agent">Strands Agent</Link> component
|
|
26
26
|
2. A project with an MCP server component (either <Link path="guides/ts-mcp-server">`ts#mcp-server`</Link> or <Link path="guides/py-mcp-server">`py#mcp-server`</Link>)
|
|
27
|
-
3. Both components created with `
|
|
27
|
+
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Documentation Site
|
|
3
|
+
description: Reference documentation for the ts#docs generator
|
|
4
|
+
generator: ts#docs
|
|
5
|
+
---
|
|
6
|
+
import Astro from '@astrojs/react';
|
|
7
|
+
import { CardGrid } from '@astrojs/starlight/components';
|
|
8
|
+
import FrameworkCard from '@components/framework-card.astro';
|
|
9
|
+
|
|
10
|
+
This generator creates a documentation site for your project. Use the `framework` option to select which documentation framework to use.
|
|
11
|
+
|
|
12
|
+
## Frameworks
|
|
13
|
+
|
|
14
|
+
<CardGrid>
|
|
15
|
+
<FrameworkCard
|
|
16
|
+
title="Astro + Starlight"
|
|
17
|
+
description="Documentation site powered by Astro and the Starlight docs theme with localisation, snippets, blog, and automated translation."
|
|
18
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/astro-docs`}
|
|
19
|
+
logo="astro"
|
|
20
|
+
/>
|
|
21
|
+
</CardGrid>
|
package/docs/guides/fastapi.mdx
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
title: FastAPI
|
|
3
3
|
description: Reference documentation for FastAPI
|
|
4
4
|
generator: py#fast-api
|
|
5
|
+
when:
|
|
6
|
+
framework: [fastapi]
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
@@ -33,7 +35,7 @@ You can generate a new FastAPI in two ways:
|
|
|
33
35
|
<Snippet name="api/api-choice-note" />
|
|
34
36
|
|
|
35
37
|
:::tip[API Type]
|
|
36
|
-
Select `
|
|
38
|
+
Select `rest-lambda` (default) as your `infra` if you intend to build any streaming operations.
|
|
37
39
|
:::
|
|
38
40
|
|
|
39
41
|
:::tip[Integration Pattern]
|
|
@@ -183,7 +185,7 @@ Unhandled exceptions are caught by the middleware and:
|
|
|
183
185
|
It's recommended to specify response models for your API operations for better code generation if using the `connection` generator. <Link path="guides/connection/react-fastapi#errors">See here for more details</Link>.
|
|
184
186
|
:::
|
|
185
187
|
|
|
186
|
-
<OptionFilter when={{
|
|
188
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Streaming — REST API only">
|
|
187
189
|
### Streaming
|
|
188
190
|
|
|
189
191
|
The generated FastAPI supports streaming responses out of the box when using a REST API. The infrastructure is configured to use the [AWS Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) to run your FastAPI via uvicorn inside Lambda, with `ResponseTransferMode.STREAM` in API Gateway for all REST API operations, which enables streaming to work alongside non-streaming operations.
|
|
@@ -254,7 +256,7 @@ This sets up:
|
|
|
254
256
|
|
|
255
257
|
<Snippet name="api/cors-configuration-cdk-note" />
|
|
256
258
|
|
|
257
|
-
<OptionFilter when={{ auth: '
|
|
259
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Cognito identity construct wiring">
|
|
258
260
|
:::note[Cognito Authentication]
|
|
259
261
|
If you selected to use `Cognito` authentication, you will need to supply the `identity` property to the API construct:
|
|
260
262
|
|
|
@@ -273,11 +275,11 @@ export class ExampleStack extends Stack {
|
|
|
273
275
|
}
|
|
274
276
|
```
|
|
275
277
|
|
|
276
|
-
The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#
|
|
278
|
+
The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
|
|
277
279
|
:::
|
|
278
280
|
</OptionFilter>
|
|
279
281
|
|
|
280
|
-
<OptionFilter when={{ auth: '
|
|
282
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer CDK usage">
|
|
281
283
|
:::caution[Custom Lambda Authorizer]
|
|
282
284
|
When using `Custom` auth, the construct creates a Lambda Authorizer internally from the generated `authorizer.py` file, which **denies all requests by default**. You must implement your authorization logic in that file before your API will accept any traffic.
|
|
283
285
|
:::
|
|
@@ -324,7 +326,7 @@ This sets up:
|
|
|
324
326
|
|
|
325
327
|
<Snippet name="api/cors-configuration-terraform-note" />
|
|
326
328
|
|
|
327
|
-
<OptionFilter when={{ auth: '
|
|
329
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Cognito module wiring">
|
|
328
330
|
:::note[Cognito Authentication]
|
|
329
331
|
If you selected to use `Cognito` authentication, you will need to supply the Cognito configuration:
|
|
330
332
|
|
|
@@ -390,7 +392,7 @@ module "my_api" {
|
|
|
390
392
|
}
|
|
391
393
|
```
|
|
392
394
|
|
|
393
|
-
<OptionFilter when={{ auth: '
|
|
395
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
|
|
394
396
|
:::caution[Custom Lambda Authorizer]
|
|
395
397
|
When using `Custom` auth, your API is protected by a Lambda Authorizer that **denies all requests by default**. You must implement your authorization logic in the generated `authorizer.py` file before your API will accept any traffic.
|
|
396
398
|
:::
|
|
@@ -398,7 +400,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
398
400
|
</Fragment>
|
|
399
401
|
</Infrastructure>
|
|
400
402
|
|
|
401
|
-
<OptionFilter when={{
|
|
403
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="WAF — REST APIs get a WAF Web ACL by default">
|
|
402
404
|
### WAF
|
|
403
405
|
|
|
404
406
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
@@ -440,7 +442,7 @@ We do not support type-safe integrations for Terraform, and therefore no code ge
|
|
|
440
442
|
</Fragment>
|
|
441
443
|
</Infrastructure>
|
|
442
444
|
|
|
443
|
-
<OptionFilter when={{ auth: '
|
|
445
|
+
<OptionFilter when={{ auth: 'iam' }} description="IAM-authenticated APIs only">
|
|
444
446
|
### Granting Access (IAM Only)
|
|
445
447
|
|
|
446
448
|
If you selected to use `IAM` authentication, you can use the `grantInvokeAccess` method to grant access to your API:
|
package/docs/guides/py-agent.mdx
CHANGED
|
@@ -47,7 +47,7 @@ First use the <Link path="/guides/python-project">`py#project`</Link> generator
|
|
|
47
47
|
|
|
48
48
|
The generator will add the following files to your existing Python project. The files generated depend on the chosen `protocol`:
|
|
49
49
|
|
|
50
|
-
<OptionFilter when={{ protocol: '
|
|
50
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP server layout">
|
|
51
51
|
### HTTP Protocol (default)
|
|
52
52
|
|
|
53
53
|
<FileTree>
|
|
@@ -58,13 +58,13 @@ The generator will add the following files to your existing Python project. The
|
|
|
58
58
|
- init.py FastAPI application setup with CORS and error handling middleware
|
|
59
59
|
- agent.py Main agent definition with sample tools
|
|
60
60
|
- main.py FastAPI entry point for Bedrock AgentCore Runtime
|
|
61
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
61
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
62
62
|
- pyproject.toml Updated with Strands dependencies
|
|
63
63
|
- project.json Updated with agent serve targets
|
|
64
64
|
</FileTree>
|
|
65
65
|
</OptionFilter>
|
|
66
66
|
|
|
67
|
-
<OptionFilter when={{ protocol: '
|
|
67
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="Strands A2A server layout">
|
|
68
68
|
### A2A Protocol
|
|
69
69
|
|
|
70
70
|
The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) instead of FastAPI:
|
|
@@ -76,13 +76,13 @@ The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/use
|
|
|
76
76
|
- \_\_init\_\_.py Python package initialization
|
|
77
77
|
- agent.py Main agent definition with sample tools
|
|
78
78
|
- main.py A2A server entry point
|
|
79
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
79
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
80
80
|
- pyproject.toml Updated with Strands dependencies
|
|
81
81
|
- project.json Updated with agent serve targets
|
|
82
82
|
</FileTree>
|
|
83
83
|
</OptionFilter>
|
|
84
84
|
|
|
85
|
-
<OptionFilter when={{ protocol: '
|
|
85
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server layout">
|
|
86
86
|
### AG-UI Protocol
|
|
87
87
|
|
|
88
88
|
The entry point uses the [ag-ui-strands](https://docs.ag-ui.com/) integration, which exposes your agent via the AG-UI protocol for direct frontend integration with [CopilotKit](https://docs.copilotkit.ai/aws-strands):
|
|
@@ -94,7 +94,7 @@ The entry point uses the [ag-ui-strands](https://docs.ag-ui.com/) integration, w
|
|
|
94
94
|
- \_\_init\_\_.py Python package initialization
|
|
95
95
|
- agent.py Main agent definition with sample tools
|
|
96
96
|
- main.py AG-UI server entry point using ag-ui-strands
|
|
97
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
97
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
98
98
|
- pyproject.toml Updated with Strands and AG-UI dependencies
|
|
99
99
|
- project.json Updated with agent serve targets
|
|
100
100
|
</FileTree>
|
|
@@ -106,7 +106,7 @@ AG-UI agents can be connected to a React frontend using the <Link path="/guides/
|
|
|
106
106
|
|
|
107
107
|
### Infrastructure
|
|
108
108
|
|
|
109
|
-
<OptionFilter when={{
|
|
109
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
|
|
110
110
|
<Snippet name="shared-constructs" />
|
|
111
111
|
|
|
112
112
|
For deploying your Agent, the following files are generated:
|
|
@@ -136,8 +136,8 @@ For deploying your Agent, the following files are generated:
|
|
|
136
136
|
</Infrastructure>
|
|
137
137
|
</OptionFilter>
|
|
138
138
|
|
|
139
|
-
<OptionFilter when={{
|
|
140
|
-
If you selected `
|
|
139
|
+
<OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
|
|
140
|
+
If you selected `none` for `infra`, no CDK constructs or Terraform modules are generated — the Agent can only be run locally. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
|
|
141
141
|
</OptionFilter>
|
|
142
142
|
|
|
143
143
|
#### Architecture
|
|
@@ -235,7 +235,7 @@ Your agent's server protocol determines how it communicates. All options are ser
|
|
|
235
235
|
|
|
236
236
|
All protocols expose `/ping` for the AgentCore runtime health check contract. A2A agents listen on port `9000`; HTTP and AG-UI agents listen on port `8080`. The generated Dockerfile and infrastructure are configured for you.
|
|
237
237
|
|
|
238
|
-
<OptionFilter when={{ protocol: '
|
|
238
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP server details">
|
|
239
239
|
## FastAPI Server (HTTP protocol)
|
|
240
240
|
|
|
241
241
|
The generated HTTP server includes:
|
|
@@ -319,7 +319,7 @@ You can find more details about the SDK's capabilities in the [documentation her
|
|
|
319
319
|
Since the generator vends CDK or Terraform infrastructure which manages deploying your agent, you do not need to utilise the `bedrock-agentcore-starter-toolkit` which the docs mention for deploying your agent.
|
|
320
320
|
:::
|
|
321
321
|
|
|
322
|
-
<OptionFilter when={{ protocol: '
|
|
322
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A server details">
|
|
323
323
|
## A2A Server (A2A protocol)
|
|
324
324
|
|
|
325
325
|
The generated `main.py` mounts `A2AServer.to_fastapi_app()` onto a parent FastAPI app that also exposes `/ping`. When deployed to AgentCore, the entry point resolves the runtime's public ARN from AppConfig and advertises it in the agent card.
|
|
@@ -327,7 +327,7 @@ The generated `main.py` mounts `A2AServer.to_fastapi_app()` onto a parent FastAP
|
|
|
327
327
|
Most users will not need to modify this file — edit `agent.py` to change tools or the system prompt. The A2A server populates the agent card (`/.well-known/agent-card.json`) from the `Agent` constructor's `name` and `description`.
|
|
328
328
|
</OptionFilter>
|
|
329
329
|
|
|
330
|
-
<OptionFilter when={{ protocol: '
|
|
330
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server details">
|
|
331
331
|
## AG-UI Server (AG-UI protocol)
|
|
332
332
|
|
|
333
333
|
The generated `main.py` wraps your Strands `Agent` in an `ag_ui_strands.StrandsAgent` and creates a FastAPI app via `create_strands_app()`. The resulting app exposes a single POST endpoint that streams [AG-UI](https://docs.ag-ui.com/) events over Server-Sent Events (SSE), as well as `/ping` for the AgentCore runtime health check.
|
|
@@ -364,7 +364,7 @@ For **HTTP** agents, the generator also emits:
|
|
|
364
364
|
|
|
365
365
|
When you customize the agent's input shape (e.g. add new fields to `InvokeInput`), update `chat.ts` to pass the new fields when invoking the agent and the rest works automatically.
|
|
366
366
|
|
|
367
|
-
<OptionFilter when={{
|
|
367
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
368
368
|
## Deploying Your Agent to Bedrock AgentCore Runtime
|
|
369
369
|
|
|
370
370
|
<Snippet name="agent/bedrock-deployment" parentHeading="Deploying Your Agent to Bedrock AgentCore Runtime" />
|
|
@@ -389,7 +389,7 @@ For more details, refer to the [AgentCore documentation on observability](https:
|
|
|
389
389
|
|
|
390
390
|
## Invoking your Agent
|
|
391
391
|
|
|
392
|
-
<OptionFilter when={{ protocol: '
|
|
392
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP invocation details">
|
|
393
393
|
### Invoke the Local Server
|
|
394
394
|
|
|
395
395
|
To invoke an Agent running locally via the `<your-agent-name>-serve` target, you can send a simple POST request to `/invocations` on the port your local agent is running on. For example, with `curl`:
|
|
@@ -409,7 +409,7 @@ The `-N` argument given to `curl` disables buffering the output stream, so you c
|
|
|
409
409
|
<Snippet name="agent/runtime-arn" parentHeading="Invoke the Deployed Agent" />
|
|
410
410
|
|
|
411
411
|
<Tabs syncKey="auth">
|
|
412
|
-
<TabItem label="IAM" _filter={{ auth: '
|
|
412
|
+
<TabItem label="IAM" _filter={{ auth: 'iam' }}>
|
|
413
413
|
#### IAM Authentication
|
|
414
414
|
|
|
415
415
|
For IAM Authentication, the request must be signed using AWS Signature Version 4 (SigV4).
|
|
@@ -426,7 +426,7 @@ acurl <region> bedrock-agentcore -N -X POST \
|
|
|
426
426
|
</Drawer>
|
|
427
427
|
</TabItem>
|
|
428
428
|
|
|
429
|
-
<TabItem label="Cognito" _filter={{ auth: '
|
|
429
|
+
<TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
|
|
430
430
|
#### JWT / Cognito Authentication
|
|
431
431
|
|
|
432
432
|
For Cognito Authentication, pass the Cognito Access Token in the `Authorization` header:
|
|
@@ -462,7 +462,7 @@ For invoking your Agent from a React website, you can make use of the <Link path
|
|
|
462
462
|
Refer to the <Link path="/guides/connection/react-py-agent">`connection` generator guide</Link> for details about how the connection is set up.
|
|
463
463
|
</OptionFilter>
|
|
464
464
|
|
|
465
|
-
<OptionFilter when={{ protocol: '
|
|
465
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A delegation details">
|
|
466
466
|
### Invoking an A2A Agent as a Tool
|
|
467
467
|
|
|
468
468
|
To delegate work from this agent to a remote A2A agent (either <Link path="/guides/ts-agent">TypeScript</Link> or <Link path="/guides/py-agent">Python</Link>), use the <Link path="/guides/connection/py-agent-a2a">`connection` generator</Link>. It vends a SigV4-authenticated client for the target agent and AST-transforms this agent's `agent.py` to register the remote A2A agent as a `@tool`-decorated delegate.
|
|
@@ -472,7 +472,7 @@ To delegate work from this agent to a remote A2A agent (either <Link path="/guid
|
|
|
472
472
|
Refer to the <Link path="/guides/connection/py-agent-a2a">`connection` generator guide</Link> for details about how the connection is set up.
|
|
473
473
|
</OptionFilter>
|
|
474
474
|
|
|
475
|
-
<OptionFilter when={{ protocol: '
|
|
475
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / React connection details">
|
|
476
476
|
### Invoking an AG-UI Agent
|
|
477
477
|
|
|
478
478
|
To invoke your AG-UI agent from a React website, use the <Link path="/guides/connection/react-agui">`connection` generator</Link>, which wires up a [CopilotKit](https://docs.copilotkit.ai/aws-strands) client configured for your deployed agent with the correct authentication (IAM or Cognito).
|