@aws/nx-plugin-mcp 1.0.0-rc.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 +12 -12
- 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 +1 -1
- package/docs/guides/connection/react-py-agent.mdx +1 -1
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +1 -1
- package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
- package/docs/guides/connection/ts-agent-mcp.mdx +1 -1
- package/docs/guides/fastapi.mdx +8 -8
- package/docs/guides/py-agent.mdx +18 -18
- package/docs/guides/py-mcp-server.mdx +5 -5
- package/docs/guides/python-lambda-function.mdx +4 -4
- package/docs/guides/react-website.mdx +2 -2
- package/docs/guides/trpc.mdx +15 -15
- package/docs/guides/ts-agent.mdx +18 -18
- 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 +5 -5
- package/docs/guides/workspace.mdx +2 -2
- package/docs/snippets/agent/architecture.mdx +4 -4
- package/docs/snippets/agent/bedrock-deployment.mdx +1 -1
- package/docs/snippets/api/api-architecture.mdx +2 -2
- 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 +1 -1
- 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 +15 -15
- 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 +15 -15
- 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 +13 -13
- package/src/ts/website/auth/schema.json +4 -4
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -19392,7 +19392,7 @@ const PackageManagerSchema = _enum(PACKAGE_MANAGERS);
|
|
|
19392
19392
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
19393
19393
|
* SPDX-License-Identifier: Apache-2.0
|
|
19394
19394
|
*/
|
|
19395
|
-
const IAC_PROVIDERS = ["
|
|
19395
|
+
const IAC_PROVIDERS = ["cdk", "terraform"];
|
|
19396
19396
|
//#endregion
|
|
19397
19397
|
//#region ../nx-plugin/src/utils/commands.ts
|
|
19398
19398
|
const PACKAGE_MANAGER_COMMANDS = {
|
|
@@ -19453,13 +19453,13 @@ const buildInstallCommand = (pm, pkg, dev) => {
|
|
|
19453
19453
|
* The package manager is auto-detected by @aws/create-nx-workspace from the
|
|
19454
19454
|
* invoking command, so --pm is not needed.
|
|
19455
19455
|
*/
|
|
19456
|
-
const buildCreateNxWorkspaceCommand = (pm, workspace,
|
|
19456
|
+
const buildCreateNxWorkspaceCommand = (pm, workspace, iac, tag) => {
|
|
19457
19457
|
return [
|
|
19458
19458
|
PACKAGE_MANAGER_COMMANDS[pm]?.create ?? `${pm} create`,
|
|
19459
19459
|
tag ? `@aws/nx-workspace@${tag}` : "@aws/nx-workspace",
|
|
19460
19460
|
...pm === "npm" ? ["--"] : [],
|
|
19461
19461
|
workspace,
|
|
19462
|
-
...
|
|
19462
|
+
...iac ? [`--iac=${iac}`] : []
|
|
19463
19463
|
].join(" ");
|
|
19464
19464
|
};
|
|
19465
19465
|
//#endregion
|
|
@@ -19488,7 +19488,7 @@ ${buildCreateNxWorkspaceCommand(packageManager, ".")} --no-interactive
|
|
|
19488
19488
|
\`\`\`
|
|
19489
19489
|
|
|
19490
19490
|
Note that this will prompt for an Infrastructure as Code provider (${IAC_PROVIDERS.join(", ")}).
|
|
19491
|
-
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.
|
|
19492
19492
|
|
|
19493
19493
|
Additional options:
|
|
19494
19494
|
- \`--no-gitSecrets\`: Opt out of the default git-secrets pre-commit hook (prevents committing AWS credentials)
|
|
@@ -52285,7 +52285,7 @@ const inlineSnippets = async (tree, opts, deps) => {
|
|
|
52285
52285
|
}
|
|
52286
52286
|
};
|
|
52287
52287
|
const applyFilterTransforms = (tree, options) => {
|
|
52288
|
-
const
|
|
52288
|
+
const iac = options?.iac;
|
|
52289
52289
|
const transform = (parent) => {
|
|
52290
52290
|
const children = parent.children;
|
|
52291
52291
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -52304,12 +52304,12 @@ const applyFilterTransforms = (tree, options) => {
|
|
|
52304
52304
|
continue;
|
|
52305
52305
|
}
|
|
52306
52306
|
if (child.name === "Infrastructure") {
|
|
52307
|
-
if (
|
|
52307
|
+
if (iac === "cdk" || iac === "terraform") {
|
|
52308
52308
|
const pseudo = {
|
|
52309
52309
|
type: "mdxJsxFlowElement",
|
|
52310
52310
|
name: "tmp",
|
|
52311
52311
|
attributes: [],
|
|
52312
|
-
children: selectInfrastructureSlot(child,
|
|
52312
|
+
children: selectInfrastructureSlot(child, iac)
|
|
52313
52313
|
};
|
|
52314
52314
|
transform(pseudo);
|
|
52315
52315
|
children.splice(i, 1, ...pseudo.children);
|
|
@@ -52340,8 +52340,8 @@ const applyFilterTransforms = (tree, options) => {
|
|
|
52340
52340
|
};
|
|
52341
52341
|
transform(tree);
|
|
52342
52342
|
};
|
|
52343
|
-
const selectInfrastructureSlot = (node,
|
|
52344
|
-
const slotName =
|
|
52343
|
+
const selectInfrastructureSlot = (node, iac) => {
|
|
52344
|
+
const slotName = iac.toLowerCase();
|
|
52345
52345
|
return node.children.find((c) => isJsxElement(c) && c.name === "Fragment" && readStringAttr(c, "slot") === slotName)?.children ?? [];
|
|
52346
52346
|
};
|
|
52347
52347
|
/**
|
|
@@ -52455,7 +52455,7 @@ const renderComponent = (node, opts, pm, deps) => {
|
|
|
52455
52455
|
case "CreateNxWorkspaceCommand": {
|
|
52456
52456
|
const workspace = readStringAttr(node, "workspace");
|
|
52457
52457
|
if (!workspace) return void 0;
|
|
52458
|
-
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, readStringAttr(node, "
|
|
52458
|
+
return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, readStringAttr(node, "iac")))];
|
|
52459
52459
|
}
|
|
52460
52460
|
case "InstallCommand": {
|
|
52461
52461
|
const pkg = readStringAttr(node, "pkg") ?? readExpressionAttr(node, "pkg");
|
|
@@ -52852,11 +52852,11 @@ const addListGeneratorsTool = (server, generators) => {
|
|
|
52852
52852
|
*/
|
|
52853
52853
|
const addGeneratorGuideTool = (server, generators) => {
|
|
52854
52854
|
server.registerTool("generator-guide", {
|
|
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.
|
|
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.",
|
|
52856
52856
|
inputSchema: {
|
|
52857
52857
|
packageManager: PackageManagerSchema,
|
|
52858
52858
|
generator: _enum(generators.map((g) => g.id)),
|
|
52859
|
-
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.")
|
|
52860
52860
|
}
|
|
52861
52861
|
}, async ({ packageManager, generator: generatorId, options }) => {
|
|
52862
52862
|
const generator = generators.find((g) => g.id === generatorId);
|
|
@@ -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
|
|
|
@@ -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.
|
|
@@ -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
|
|
package/docs/guides/fastapi.mdx
CHANGED
|
@@ -35,7 +35,7 @@ You can generate a new FastAPI in two ways:
|
|
|
35
35
|
<Snippet name="api/api-choice-note" />
|
|
36
36
|
|
|
37
37
|
:::tip[API Type]
|
|
38
|
-
Select `
|
|
38
|
+
Select `rest-lambda` (default) as your `infra` if you intend to build any streaming operations.
|
|
39
39
|
:::
|
|
40
40
|
|
|
41
41
|
:::tip[Integration Pattern]
|
|
@@ -185,7 +185,7 @@ Unhandled exceptions are caught by the middleware and:
|
|
|
185
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>.
|
|
186
186
|
:::
|
|
187
187
|
|
|
188
|
-
<OptionFilter when={{
|
|
188
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Streaming — REST API only">
|
|
189
189
|
### Streaming
|
|
190
190
|
|
|
191
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.
|
|
@@ -256,7 +256,7 @@ This sets up:
|
|
|
256
256
|
|
|
257
257
|
<Snippet name="api/cors-configuration-cdk-note" />
|
|
258
258
|
|
|
259
|
-
<OptionFilter when={{ auth: '
|
|
259
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Cognito identity construct wiring">
|
|
260
260
|
:::note[Cognito Authentication]
|
|
261
261
|
If you selected to use `Cognito` authentication, you will need to supply the `identity` property to the API construct:
|
|
262
262
|
|
|
@@ -279,7 +279,7 @@ The `UserIdentity` construct can be generated using the <Link path="/guides/reac
|
|
|
279
279
|
:::
|
|
280
280
|
</OptionFilter>
|
|
281
281
|
|
|
282
|
-
<OptionFilter when={{ auth: '
|
|
282
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer CDK usage">
|
|
283
283
|
:::caution[Custom Lambda Authorizer]
|
|
284
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.
|
|
285
285
|
:::
|
|
@@ -326,7 +326,7 @@ This sets up:
|
|
|
326
326
|
|
|
327
327
|
<Snippet name="api/cors-configuration-terraform-note" />
|
|
328
328
|
|
|
329
|
-
<OptionFilter when={{ auth: '
|
|
329
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Cognito module wiring">
|
|
330
330
|
:::note[Cognito Authentication]
|
|
331
331
|
If you selected to use `Cognito` authentication, you will need to supply the Cognito configuration:
|
|
332
332
|
|
|
@@ -392,7 +392,7 @@ module "my_api" {
|
|
|
392
392
|
}
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
<OptionFilter when={{ auth: '
|
|
395
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
|
|
396
396
|
:::caution[Custom Lambda Authorizer]
|
|
397
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.
|
|
398
398
|
:::
|
|
@@ -400,7 +400,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
400
400
|
</Fragment>
|
|
401
401
|
</Infrastructure>
|
|
402
402
|
|
|
403
|
-
<OptionFilter when={{
|
|
403
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="WAF — REST APIs get a WAF Web ACL by default">
|
|
404
404
|
### WAF
|
|
405
405
|
|
|
406
406
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
@@ -442,7 +442,7 @@ We do not support type-safe integrations for Terraform, and therefore no code ge
|
|
|
442
442
|
</Fragment>
|
|
443
443
|
</Infrastructure>
|
|
444
444
|
|
|
445
|
-
<OptionFilter when={{ auth: '
|
|
445
|
+
<OptionFilter when={{ auth: 'iam' }} description="IAM-authenticated APIs only">
|
|
446
446
|
### Granting Access (IAM Only)
|
|
447
447
|
|
|
448
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).
|
|
@@ -49,21 +49,21 @@ The generator will add the following files to your existing Python project:
|
|
|
49
49
|
- server.py Main server definition with sample tools and resources
|
|
50
50
|
- stdio.py Entry point for STDIO transport, useful for simple local MCP servers
|
|
51
51
|
- http.py Entry point for Streamable HTTP transport, useful for hosting your MCP server
|
|
52
|
-
- Dockerfile Entry point for hosting your MCP server (excluded when `
|
|
52
|
+
- Dockerfile Entry point for hosting your MCP server (excluded when `infra` is set to `None`)
|
|
53
53
|
- pyproject.toml Updated with MCP dependencies
|
|
54
54
|
- project.json Updated with MCP server serve targets
|
|
55
55
|
</FileTree>
|
|
56
56
|
|
|
57
57
|
### Infrastructure
|
|
58
58
|
|
|
59
|
-
<OptionFilter when={{
|
|
59
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
|
|
60
60
|
<Snippet name="shared-constructs" />
|
|
61
61
|
|
|
62
62
|
<Snippet name="mcp/shared-constructs" />
|
|
63
63
|
</OptionFilter>
|
|
64
64
|
|
|
65
|
-
<OptionFilter when={{
|
|
66
|
-
If you selected `
|
|
65
|
+
<OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
|
|
66
|
+
If you selected `none` for `infra`, no CDK constructs or Terraform modules are generated — the MCP server is configured for local STDIO / HTTP use only. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
|
|
67
67
|
</OptionFilter>
|
|
68
68
|
|
|
69
69
|
#### Architecture
|
|
@@ -141,7 +141,7 @@ If you would like to run your MCP server locally using [Streamable HTTP transpor
|
|
|
141
141
|
|
|
142
142
|
This command uses `uv run uvicorn --reload` to run your MCP server with HTTP transport (typically on port `8000`), and automatically restarts when files change.
|
|
143
143
|
|
|
144
|
-
<OptionFilter when={{
|
|
144
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
145
145
|
## Deploying Your MCP Server to Bedrock AgentCore Runtime
|
|
146
146
|
|
|
147
147
|
<Snippet name="mcp/bedrock-deployment" parentHeading="Deploying Your MCP Server to Bedrock AgentCore Runtime" />
|
|
@@ -163,8 +163,8 @@ Default metrics include:
|
|
|
163
163
|
|
|
164
164
|
### Type Safety
|
|
165
165
|
|
|
166
|
-
<OptionFilter not when={{
|
|
167
|
-
If you chose an `
|
|
166
|
+
<OptionFilter not when={{ event: 'Any' }} description="Typed event wires @event_parser with a Pydantic model">
|
|
167
|
+
If you chose an `event` when generating your lambda function, your function is instrumented with [`@event_parser` from AWS Lambda Powertools](https://docs.powertools.aws.dev/lambda/python/latest/utilities/parser/). For example:
|
|
168
168
|
|
|
169
169
|
```python {3}
|
|
170
170
|
@event_parser(model=EventBridgeModel)
|
|
@@ -179,8 +179,8 @@ If you have custom data nested within an event, for example a DynamoDB stream or
|
|
|
179
179
|
:::
|
|
180
180
|
</OptionFilter>
|
|
181
181
|
|
|
182
|
-
<OptionFilter when={{
|
|
183
|
-
If you selected `Any` for your `
|
|
182
|
+
<OptionFilter when={{ event: 'Any' }} description="event=Any — no parser decorator, event is untyped">
|
|
183
|
+
If you selected `Any` for your `event`, the `@event_parser` decorator is not applied and the handler receives an untyped event dict. Regenerate with a specific `event` if you want Pydantic validation and typed field access.
|
|
184
184
|
</OptionFilter>
|
|
185
185
|
|
|
186
186
|
## Bundling
|
|
@@ -130,11 +130,11 @@ cloudfront -> s3
|
|
|
130
130
|
|
|
131
131
|
The [React documentation](https://react.dev/learn) is a good place to start to learn the basics of building with React.
|
|
132
132
|
|
|
133
|
-
<OptionFilter when={{
|
|
133
|
+
<OptionFilter when={{ ux: 'cloudscape' }} description="Cloudscape component docs pointer">
|
|
134
134
|
You can refer to the [Cloudscape documentation](https://cloudscape.design/components/) for details about the available components and how to use them.
|
|
135
135
|
</OptionFilter>
|
|
136
136
|
|
|
137
|
-
<OptionFilter when={{
|
|
137
|
+
<OptionFilter when={{ ux: 'shadcn' }} description="Shadcn component docs pointer">
|
|
138
138
|
You can refer to the [shadcn/ui documentation](https://ui.shadcn.com/docs) for details about the available components and how to use them.
|
|
139
139
|
</OptionFilter>
|
|
140
140
|
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -33,7 +33,7 @@ You can generate a new tRPC API in two ways:
|
|
|
33
33
|
<Snippet name="api/api-choice-note" />
|
|
34
34
|
|
|
35
35
|
:::tip[API Type]
|
|
36
|
-
Select `
|
|
36
|
+
Select `rest-lambda` (default) as your `infra` if you would like to use [tRPC Subscriptions](https://trpc.io/docs/server/subscriptions) to stream responses.
|
|
37
37
|
:::
|
|
38
38
|
|
|
39
39
|
:::tip[Integration Pattern]
|
|
@@ -151,10 +151,10 @@ The use of `query` to define the implementation indicates that the operation is
|
|
|
151
151
|
|
|
152
152
|
If you add a new procedure, make sure you register it by adding it to the router in `src/router.ts`.
|
|
153
153
|
|
|
154
|
-
<OptionFilter when={{
|
|
154
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Streaming subscriptions — REST API only, uses SSE">
|
|
155
155
|
### Subscriptions (Streaming)
|
|
156
156
|
|
|
157
|
-
tRPC subscriptions allow you to stream data from the server to the client using [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). When you select `
|
|
157
|
+
tRPC subscriptions allow you to stream data from the server to the client using [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). When you select `rest-lambda` as your compute type, the generator automatically configures the infrastructure required for streaming, as well as a streaming Lambda handler and the `ZodAsyncIterable` schema helper.
|
|
158
158
|
|
|
159
159
|
To define a subscription procedure, use the `.subscription` method with an async generator function. Use the `ZodAsyncIterable` helper from `src/schema/z-async-iterable.ts` to define the output schema:
|
|
160
160
|
|
|
@@ -290,7 +290,7 @@ You can add additional values to the context provided to procedures by implement
|
|
|
290
290
|
|
|
291
291
|
As an example, let's implement some middlware to extract some details about the calling user from our API in `src/middleware/identity.ts`.
|
|
292
292
|
|
|
293
|
-
<OptionFilter when={{ auth: '
|
|
293
|
+
<OptionFilter when={{ auth: 'iam' }} description="Identity middleware example for IAM-authenticated APIs">
|
|
294
294
|
This example walks through identity middleware for `IAM` authentication. We look up the caller in Cognito using the sub extracted from the API Gateway event.
|
|
295
295
|
|
|
296
296
|
First, we define what we'll add to the context:
|
|
@@ -326,7 +326,7 @@ export const createIdentityPlugin = () => {
|
|
|
326
326
|
In our case, we want to extract details about the calling Cognito user. We'll do that by extracting the user's subject ID (or "sub") from the API Gateway event, and retrieving user details from Cognito. The implementation varies depending on whether the event was provided to our function by a REST API or an HTTP API:
|
|
327
327
|
|
|
328
328
|
<Tabs syncKey="http-rest">
|
|
329
|
-
<TabItem label="REST API" _filter={{
|
|
329
|
+
<TabItem label="REST API" _filter={{ infra: 'rest-lambda' }}>
|
|
330
330
|
```ts
|
|
331
331
|
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
332
332
|
import { initTRPC, TRPCError } from '@trpc/server';
|
|
@@ -389,7 +389,7 @@ export const createIdentityPlugin = () => {
|
|
|
389
389
|
};
|
|
390
390
|
```
|
|
391
391
|
</TabItem>
|
|
392
|
-
<TabItem label="HTTP API" _filter={{
|
|
392
|
+
<TabItem label="HTTP API" _filter={{ infra: 'http-lambda' }}>
|
|
393
393
|
```ts
|
|
394
394
|
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
395
395
|
import { initTRPC, TRPCError } from '@trpc/server';
|
|
@@ -461,8 +461,8 @@ export const createIdentityPlugin = () => {
|
|
|
461
461
|
</Tabs>
|
|
462
462
|
</OptionFilter>
|
|
463
463
|
|
|
464
|
-
<OptionFilter when={{ auth: '
|
|
465
|
-
When you deploy with `auth: '
|
|
464
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Identity middleware example for Cognito-authenticated APIs">
|
|
465
|
+
When you deploy with `auth: 'cognito'`, the API Gateway Cognito User Pools authorizer verifies the JWT that the caller supplies in the `Authorization` header and places the verified claims on the Lambda event at `event.requestContext.authorizer.claims`. Our middleware just reads those claims — no extra AWS SDK calls, no manual JWT verification.
|
|
466
466
|
|
|
467
467
|
First, we define what we'll add to the context:
|
|
468
468
|
|
|
@@ -553,7 +553,7 @@ The tRPC API generator creates CDK or Terraform infrastructure as code based on
|
|
|
553
553
|
<Fragment slot="cdk">
|
|
554
554
|
The CDK construct for deploying your API lives in the `common/constructs` folder. You can consume this in a CDK application, for example:
|
|
555
555
|
|
|
556
|
-
<OptionFilter when={{ auth: ['
|
|
556
|
+
<OptionFilter when={{ auth: ['iam', 'custom'] }} description="CDK usage for IAM or Custom authentication">
|
|
557
557
|
```ts {6-8}
|
|
558
558
|
import { MyApi } from ':my-scope/common-constructs';
|
|
559
559
|
|
|
@@ -572,7 +572,7 @@ When using `Custom` auth, the construct creates a Lambda Authorizer internally f
|
|
|
572
572
|
:::
|
|
573
573
|
</OptionFilter>
|
|
574
574
|
|
|
575
|
-
<OptionFilter when={{ auth: '
|
|
575
|
+
<OptionFilter when={{ auth: 'cognito' }} description="CDK usage with Cognito authentication — pass the identity construct">
|
|
576
576
|
```ts {6,9}
|
|
577
577
|
import { MyApi, UserIdentity } from ':my-scope/common-constructs';
|
|
578
578
|
|
|
@@ -601,7 +601,7 @@ The Terraform modules for deploying your API are in the `common/terraform` folde
|
|
|
601
601
|
|
|
602
602
|
The API module stages its Lambda deployment zip in a shared S3 asset bucket — see the <Link path="/guides/terraform-project">Terraform infrastructure guide</Link> for details. Instantiate the `core/asset-bucket` module once per deployment and pass its `bucket_name` output into every API / Lambda module via the `asset_bucket_name` input:
|
|
603
603
|
|
|
604
|
-
<OptionFilter when={{ auth: ['
|
|
604
|
+
<OptionFilter when={{ auth: ['iam', 'custom'] }} description="Terraform usage for IAM or Custom authentication">
|
|
605
605
|
```hcl {1-3, 8}
|
|
606
606
|
module "asset_bucket" {
|
|
607
607
|
source = "../../common/terraform/src/core/asset-bucket"
|
|
@@ -628,7 +628,7 @@ module "my_api" {
|
|
|
628
628
|
```
|
|
629
629
|
</OptionFilter>
|
|
630
630
|
|
|
631
|
-
<OptionFilter when={{ auth: '
|
|
631
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Terraform usage with Cognito authentication — supply user pool and client">
|
|
632
632
|
```hcl {1-3, 8-9}
|
|
633
633
|
module "asset_bucket" {
|
|
634
634
|
source = "../../common/terraform/src/core/asset-bucket"
|
|
@@ -711,7 +711,7 @@ module "my_api" {
|
|
|
711
711
|
}
|
|
712
712
|
```
|
|
713
713
|
|
|
714
|
-
<OptionFilter when={{ auth: '
|
|
714
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
|
|
715
715
|
:::caution[Custom Lambda Authorizer]
|
|
716
716
|
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 `src/authorizer.ts` file before your API will accept any traffic.
|
|
717
717
|
:::
|
|
@@ -719,7 +719,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
719
719
|
</Fragment>
|
|
720
720
|
</Infrastructure>
|
|
721
721
|
|
|
722
|
-
<OptionFilter when={{
|
|
722
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="WAF — REST APIs get a WAF Web ACL by default">
|
|
723
723
|
### WAF
|
|
724
724
|
|
|
725
725
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
@@ -733,7 +733,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
733
733
|
If you selected CDK for your `iacProvider`, when you add or remove a procedure in your tRPC API, these changes will be reflected immediately in the CDK construct without the need to rebuild.
|
|
734
734
|
:::
|
|
735
735
|
|
|
736
|
-
<OptionFilter when={{ auth: '
|
|
736
|
+
<OptionFilter when={{ auth: 'iam' }} description="Granting API invoke access — IAM-authenticated APIs only">
|
|
737
737
|
### Granting Access (IAM Only)
|
|
738
738
|
|
|
739
739
|
You can grant access to your API as follows:
|