@aws/nx-plugin-mcp 1.0.0-rc.44 → 1.0.0-rc.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aws-nx-mcp.js +10 -2
- package/docs/get_started/tutorials/dungeon-game/1.mdx +4 -4
- package/docs/get_started/tutorials/dungeon-game/3.mdx +1 -1
- package/docs/guides/agentcore-gateway.mdx +94 -7
- package/docs/guides/connection/py-agent-a2a.mdx +1 -1
- package/docs/guides/connection/py-agent-gateway.mdx +3 -1
- package/docs/guides/connection/react-agui.mdx +9 -9
- package/docs/guides/connection/react-py-agent.mdx +2 -2
- package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
- package/docs/guides/connection/ts-agent-gateway.mdx +3 -1
- package/docs/guides/docker-bundling.mdx +10 -13
- package/docs/guides/fastapi.mdx +2 -2
- package/docs/guides/python-lambda-function.mdx +1 -1
- package/docs/guides/react-website-auth.mdx +1 -1
- package/docs/guides/react-website.mdx +3 -3
- package/docs/guides/security.mdx +1 -1
- package/docs/guides/trpc.mdx +2 -2
- package/docs/guides/ts-dcr-proxy.mdx +569 -0
- package/docs/guides/ts-lambda-function.mdx +1 -1
- package/docs/guides/ts-smithy-api.mdx +3 -3
- package/docs/guides/typescript-infrastructure.mdx +6 -6
- package/docs/snippets/lambda-function/deploying-your-function.mdx +1 -1
- package/docs/snippets/rdb/deploying.mdx +1 -1
- package/docs/snippets/shared-constructs.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +13 -3
- package/generators.json +6 -0
- package/package.json +1 -1
- package/src/agentcore-gateway/schema.json +3 -2
- package/src/ts/dcr-proxy/schema.json +44 -0
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -19962,6 +19962,12 @@ var generators$1 = {
|
|
|
19962
19962
|
"description": "Generate a TypeScript lambda function",
|
|
19963
19963
|
"metric": "g21"
|
|
19964
19964
|
},
|
|
19965
|
+
"ts#dcr-proxy": {
|
|
19966
|
+
"factory": "./src/ts/dcr-proxy/generator",
|
|
19967
|
+
"schema": "./src/ts/dcr-proxy/schema.json",
|
|
19968
|
+
"description": "Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers",
|
|
19969
|
+
"metric": "g56"
|
|
19970
|
+
},
|
|
19965
19971
|
"ts#mcp-server": {
|
|
19966
19972
|
"factory": "./src/ts/mcp-server/generator",
|
|
19967
19973
|
"schema": "./src/ts/mcp-server/schema.json",
|
|
@@ -21296,6 +21302,7 @@ const kebabCase = (str) => {
|
|
|
21296
21302
|
const NX_VERSION = {
|
|
21297
21303
|
"@a2a-js/sdk": "0.3.14",
|
|
21298
21304
|
"@aws/aws-distro-opentelemetry-node-autoinstrumentation": "0.12.0",
|
|
21305
|
+
"@opentelemetry/propagator-jaeger": "2.9.0",
|
|
21299
21306
|
"@aws-sdk/client-dynamodb": "3.1090.0",
|
|
21300
21307
|
"@aws-sdk/client-bedrock-runtime": "3.1090.0",
|
|
21301
21308
|
"@aws-sdk/client-s3": "3.1090.0",
|
|
@@ -21322,6 +21329,7 @@ const NX_VERSION = {
|
|
|
21322
21329
|
"@swc/core": "1.15.43",
|
|
21323
21330
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
21324
21331
|
"@modelcontextprotocol/inspector": "0.22.0",
|
|
21332
|
+
"@ag-ui/a2ui-toolkit": "0.0.4",
|
|
21325
21333
|
"@ag-ui/aws-strands": "0.2.3",
|
|
21326
21334
|
"@ag-ui/client": "0.0.57",
|
|
21327
21335
|
"@ag-ui/core": "0.0.57",
|
|
@@ -21456,7 +21464,7 @@ const buildInstallCommand = (pm, pkg, dev) => {
|
|
|
21456
21464
|
case "pnpm": return `pnpm add ${dev ? "-D" : "-"}w ${pkg}`;
|
|
21457
21465
|
case "yarn": return `yarn add ${dev ? "-D " : ""}${pkg}`;
|
|
21458
21466
|
case "npm": return `npm install --legacy-peer-deps ${dev ? "-D " : ""}${pkg}`;
|
|
21459
|
-
case "bun": return `bun
|
|
21467
|
+
case "bun": return `bun add ${dev ? "-D " : ""}${pkg}`;
|
|
21460
21468
|
default: return `${pm} install ${dev ? "-D " : ""}${pkg}`;
|
|
21461
21469
|
}
|
|
21462
21470
|
};
|
|
@@ -54447,7 +54455,7 @@ ${PACKAGE_MANAGERS.map((pm) => buildNxCommand("<options>", pm)).join(" - \n")}
|
|
|
54447
54455
|
- pnpm add -w -D <package>
|
|
54448
54456
|
- yarn add -D <package>
|
|
54449
54457
|
- npm install --legacy-peer-deps -D <package>
|
|
54450
|
-
- bun
|
|
54458
|
+
- bun add -D <package>
|
|
54451
54459
|
- (Omit -D for production dependencies)
|
|
54452
54460
|
- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \`@workspace-name/project-name\`. Check the \`project.json\` file for the specific package to find its fully qualified name
|
|
54453
54461
|
- When no generator exists for a specific framework required, use the base \`ts#project\` and \`py#project\` generators and build on top.
|
|
@@ -400,7 +400,7 @@ To add a Strands agent to the project with the `py#agent` generator:
|
|
|
400
400
|
<RunGenerator generator="py#agent" requiredParameters={{project:"story", auth:"cognito", protocol:"ag-ui"}} noInteractive />
|
|
401
401
|
|
|
402
402
|
:::note[AG-UI protocol]
|
|
403
|
-
We choose `--protocol=
|
|
403
|
+
We choose `--protocol=ag-ui` so the agent speaks the [Agent-User Interaction protocol](https://docs.copilotkit.ai/aws-strands/protocol) — this lets our React website talk to it directly via [CopilotKit](https://docs.copilotkit.ai/), with streaming, tool calls, and conversation history handled by the protocol instead of a hand-rolled HTTP client.
|
|
404
404
|
:::
|
|
405
405
|
|
|
406
406
|
You will see some new files appear in your file tree.
|
|
@@ -494,7 +494,7 @@ app = create_strands_app(agui_agent, path="/invocations")
|
|
|
494
494
|
app.add_middleware(_SessionIdMiddleware)
|
|
495
495
|
```
|
|
496
496
|
|
|
497
|
-
This is the entrypoint for the agent. Because we selected `--protocol=
|
|
497
|
+
This is the entrypoint for the agent. Because we selected `--protocol=ag-ui`, the generator wraps our Strands `Agent` with `StrandsAgent` from [`ag_ui_strands`](https://docs.copilotkit.ai/aws-strands/integration) and mounts it on a FastAPI app that speaks the [AG-UI protocol](https://docs.copilotkit.ai/aws-strands/protocol) — this is what CopilotKit will talk to from the React website. The `_SessionIdMiddleware` binds the inbound AgentCore runtime session ID onto a `ContextVar` so any downstream MCP/A2A client we wire up later (e.g. the Inventory MCP server in <Link path="get_started/tutorials/dungeon-game/2">Module 2</Link>) automatically forwards it on its outbound calls. In <Link path="get_started/tutorials/dungeon-game/3">Module 3</Link> we'll also add a `session_manager_provider` so each thread id gets its own `S3SessionManager` and conversation history persists across turns.
|
|
498
498
|
|
|
499
499
|
```ts
|
|
500
500
|
// common/constructs/src/app/agents/story-agent.ts
|
|
@@ -715,7 +715,7 @@ The `ts#website` generates these files. Let us examine some of the key files hig
|
|
|
715
715
|
- vite.config.mts
|
|
716
716
|
- ...
|
|
717
717
|
- common/
|
|
718
|
-
- shadcn/ shared shadcn/ui library (theme tokens, `Button`, `Card`, `Input`, `Sidebar`, …) imported by every `
|
|
718
|
+
- shadcn/ shared shadcn/ui library (theme tokens, `Button`, `Card`, `Input`, `Sidebar`, …) imported by every `ux=shadcn` website
|
|
719
719
|
- src/components/ui/*
|
|
720
720
|
- src/styles/globals.css Tailwind + shadcn design tokens
|
|
721
721
|
- ...
|
|
@@ -1033,7 +1033,7 @@ The `connection` generator generates/updates these files:
|
|
|
1033
1033
|
</FileTree>
|
|
1034
1034
|
|
|
1035
1035
|
The generator:
|
|
1036
|
-
- Detects the React website's `
|
|
1036
|
+
- Detects the React website's `ux` (Shadcn here) and vends matching chat components.
|
|
1037
1037
|
- Registers every connected agent on a single `CopilotKitProvider` — re-running for another agent just adds another hook.
|
|
1038
1038
|
- Reads the agent's runtime ARN from Runtime Configuration, builds the AgentCore invocation URL, and attaches the Cognito bearer token plus the AgentCore session id header.
|
|
1039
1039
|
|
|
@@ -23,7 +23,7 @@ import gameConversationPng from '@assets/game-conversation.png'
|
|
|
23
23
|
|
|
24
24
|
## Task 1: Implement the Story Agent
|
|
25
25
|
|
|
26
|
-
The Story Agent is a [Strands](https://strandsagents.com/) agent generated with `--protocol=
|
|
26
|
+
The Story Agent is a [Strands](https://strandsagents.com/) agent generated with `--protocol=ag-ui` in <Link path="get_started/tutorials/dungeon-game/1">Module 1</Link>, so the UI can stream from it over the [Agent-User Interaction protocol](https://docs.copilotkit.ai/aws-strands/protocol) via CopilotKit. It uses the Inventory MCP Server to manage the player's items, and Strands' built-in [`S3SessionManager`](https://strandsagents.com/latest/documentation/docs/user-guide/concepts/agents/sessions/) to persist conversation history into the sessions bucket we provisioned in Module 2.
|
|
27
27
|
|
|
28
28
|
### Agent implementation
|
|
29
29
|
|
|
@@ -15,7 +15,7 @@ import Link from '@components/link.astro';
|
|
|
15
15
|
import NxCommands from '@components/nx-commands.astro';
|
|
16
16
|
import OptionFilter from '@components/option-filter.astro';
|
|
17
17
|
|
|
18
|
-
Generate an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) project. An AgentCore Gateway is a managed entry point that aggregates one or more MCP server targets behind a single MCP endpoint, evaluates every tool call against a [Cedar policy engine](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html), and signs outbound traffic to MCP servers with IAM SigV4.
|
|
18
|
+
Generate an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) project. An AgentCore Gateway is a managed entry point that aggregates one or more MCP server targets behind a single MCP endpoint, authenticates inbound requests (IAM or Cognito), evaluates every tool call against a [Cedar policy engine](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html), and signs outbound traffic to MCP servers with IAM SigV4.
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@ The generator creates a new project at `packages/<name>/`, plus a CDK construct
|
|
|
34
34
|
<FileTree>
|
|
35
35
|
- packages/\<name>/
|
|
36
36
|
- policies/ Cedar policy source files (omitted when `cedarPolicy: false`)
|
|
37
|
-
- permit-all.cedar Default Cedar policy that permits authenticated callers
|
|
37
|
+
- permit-all.cedar Default Cedar policy that permits authenticated callers
|
|
38
38
|
- README.md Reference for writing Cedar policies
|
|
39
39
|
- local-dev.ts Local gateway aggregating attached MCP servers for local development
|
|
40
40
|
- project.json Adds the `serve` and `dev` targets
|
|
@@ -71,7 +71,7 @@ Infrastructure is generated when `infra` is `agentcore` (the default). With `inf
|
|
|
71
71
|
|
|
72
72
|
The generated construct creates the following AWS resources:
|
|
73
73
|
|
|
74
|
-
- An `AgentCore::Gateway` configured for the MCP protocol with
|
|
74
|
+
- An `AgentCore::Gateway` configured for the MCP protocol with inbound IAM authentication (default) or Cognito JWT authentication (see <a href="#authentication">Authentication</a>)
|
|
75
75
|
- An `AgentCore::PolicyEngine` running in `ENFORCE` mode, attached to the Gateway (omitted when `cedarPolicy: false`)
|
|
76
76
|
- One `AgentCore::Policy` per `.cedar` file in `policies/`
|
|
77
77
|
- An AWS WAFv2 Web ACL associated with the Gateway, with request logging to CloudWatch (enabled by default — see <a href="#aws-waf">AWS WAF</a>)
|
|
@@ -95,7 +95,7 @@ waf: WAF {
|
|
|
95
95
|
icon: /nx-plugin-for-aws/icons/aws/waf.svg
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
gateway: AgentCore Gateway\n(MCP, IAM auth) {
|
|
98
|
+
gateway: AgentCore Gateway\n(MCP, IAM or Cognito auth) {
|
|
99
99
|
shape: image
|
|
100
100
|
icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-gateway.svg
|
|
101
101
|
}
|
|
@@ -109,6 +109,61 @@ waf -> gateway
|
|
|
109
109
|
gateway -> targets
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
## Authentication
|
|
113
|
+
|
|
114
|
+
The `auth` option configures how the Gateway authenticates inbound requests. Choose between `iam` (default) and `cognito`.
|
|
115
|
+
|
|
116
|
+
### IAM
|
|
117
|
+
|
|
118
|
+
By default, the Gateway is configured with `GatewayAuthorizer.usingAwsIam()`. Callers sign requests with SigV4, and the caller's IAM identity is available to Cedar policies as an `AgentCore::IamEntity` principal. This is the recommended option when your callers are agents or services running in AWS — for example an <Link path="/guides/ts-agent">agent</Link> connected via the <Link path="guides/connection/ts-agent-gateway">agent to Gateway connection generator</Link>, which signs its calls with its own execution role.
|
|
119
|
+
|
|
120
|
+
### Cognito
|
|
121
|
+
|
|
122
|
+
When you select `cognito`, the Gateway is configured with a Custom JWT authorizer pointing at a Cognito user pool. Callers authenticate by presenting a JWT bearer token, and the token's `sub` claim is available to Cedar policies as an `AgentCore::OAuthUser` principal. Use this when your callers authenticate through Cognito — for example a website or a coding agent connecting via the <Link path="guides/ts-dcr-proxy">`ts#dcr-proxy` generator</Link>.
|
|
123
|
+
|
|
124
|
+
The generated infrastructure consumes an existing Cognito user pool and client — it does not create them. You can generate a `UserIdentity` using the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>, or provide your own.
|
|
125
|
+
|
|
126
|
+
<Infrastructure>
|
|
127
|
+
<Fragment slot="cdk">
|
|
128
|
+
The generated construct requires an `identity` prop supplying the user pool and client:
|
|
129
|
+
|
|
130
|
+
```ts {7,9-11} title="packages/infra/src/stacks/application-stack.ts"
|
|
131
|
+
import { MyGateway, UserIdentity } from ':my-scope/common-constructs';
|
|
132
|
+
|
|
133
|
+
export class ApplicationStack extends Stack {
|
|
134
|
+
constructor(scope: Construct, id: string, props?: StackProps) {
|
|
135
|
+
super(scope, id, props);
|
|
136
|
+
|
|
137
|
+
const identity = new UserIdentity(this, 'Identity');
|
|
138
|
+
|
|
139
|
+
new MyGateway(this, 'MyGateway', {
|
|
140
|
+
identity,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
</Fragment>
|
|
146
|
+
<Fragment slot="terraform">
|
|
147
|
+
The generated module requires `user_pool_id` and `user_pool_client_ids` variables:
|
|
148
|
+
|
|
149
|
+
```hcl {6-7} title="packages/infra/src/main.tf"
|
|
150
|
+
module "user_identity" {
|
|
151
|
+
source = "../../common/terraform/src/core/user-identity"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
module "my_gateway" {
|
|
155
|
+
source = "../../common/terraform/src/app/gateways/my-gateway"
|
|
156
|
+
user_pool_id = module.user_identity.user_pool_id
|
|
157
|
+
user_pool_client_ids = [module.user_identity.user_pool_client_id]
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
</Fragment>
|
|
161
|
+
</Infrastructure>
|
|
162
|
+
|
|
163
|
+
:::note[Custom OIDC providers]
|
|
164
|
+
To authenticate with a non-Cognito OIDC provider, modify the generated Gateway construct or Terraform module directly — swap the authorizer's discovery URL and allowed clients for your provider's. Agent to Gateway connection generators only support `IAM`-authenticated gateways, since agents sign their calls with SigV4.
|
|
165
|
+
:::
|
|
166
|
+
|
|
112
167
|
## Writing Policies
|
|
113
168
|
|
|
114
169
|
<OptionFilter when={{ cedarPolicy: true }} description="Cedar policies — cedarPolicy: true only">
|
|
@@ -190,7 +245,9 @@ Additionally, the Gateway filters the response of `tools/list` so that callers o
|
|
|
190
245
|
|
|
191
246
|
### Default `permit-all.cedar`
|
|
192
247
|
|
|
193
|
-
The generator ships a default policy
|
|
248
|
+
The generator ships a default policy scoped to the Gateway's authentication type.
|
|
249
|
+
|
|
250
|
+
For an **IAM** Gateway, it permits any IAM caller from the AWS account the Gateway is deployed into:
|
|
194
251
|
|
|
195
252
|
```cedar title="packages/<name>/policies/permit-all.cedar"
|
|
196
253
|
permit (
|
|
@@ -202,11 +259,23 @@ permit (
|
|
|
202
259
|
};
|
|
203
260
|
```
|
|
204
261
|
|
|
262
|
+
For a **Cognito** Gateway, it permits any authenticated OAuth user (the JWT authorizer has already validated the token's user pool and client before policies are evaluated):
|
|
263
|
+
|
|
264
|
+
```cedar title="packages/<name>/policies/permit-all.cedar"
|
|
265
|
+
permit (
|
|
266
|
+
principal is AgentCore::OAuthUser,
|
|
267
|
+
action,
|
|
268
|
+
resource == AgentCore::Gateway::"<%= gatewayArn %>"
|
|
269
|
+
);
|
|
270
|
+
```
|
|
271
|
+
|
|
205
272
|
To lock things down further, add narrower policies alongside it. Always retain at least one matching `permit` in the policy set, otherwise default-deny will block every call.
|
|
206
273
|
|
|
207
274
|
### Policy scope reference
|
|
208
275
|
|
|
209
|
-
|
|
276
|
+
The principal type depends on how the Gateway authenticates callers (see <a href="#authentication">Authentication</a>).
|
|
277
|
+
|
|
278
|
+
For an **IAM** Gateway, callers are IAM principals:
|
|
210
279
|
|
|
211
280
|
```
|
|
212
281
|
principal is AgentCore::IamEntity
|
|
@@ -220,6 +289,24 @@ principal == AgentCore::IamEntity::"arn:aws:sts::<%= accountId %>:assumed-role/<
|
|
|
220
289
|
|
|
221
290
|
The same value is available as `principal.id` for `when` clauses. Reserve `like` for genuine patterns, such as the account-wide match in the default `permit-all.cedar`.
|
|
222
291
|
|
|
292
|
+
For a **Cognito** Gateway, callers are OAuth users built from the JWT token's `sub` claim, and JWT claims (username, scope, etc.) are available as principal tags:
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
principal is AgentCore::OAuthUser
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Match individual claims in `when` clauses — for example to require a scope:
|
|
299
|
+
|
|
300
|
+
```cedar
|
|
301
|
+
permit (
|
|
302
|
+
principal is AgentCore::OAuthUser,
|
|
303
|
+
action,
|
|
304
|
+
resource == AgentCore::Gateway::"<%= gatewayArn %>"
|
|
305
|
+
) when {
|
|
306
|
+
principal.scope == "gateway/invoke"
|
|
307
|
+
};
|
|
308
|
+
```
|
|
309
|
+
|
|
223
310
|
Tool invocations reach the policy engine as actions with the form:
|
|
224
311
|
|
|
225
312
|
```
|
|
@@ -268,7 +355,7 @@ See the connection guide for the full local development story.
|
|
|
268
355
|
|
|
269
356
|
## Deploying your AgentCore Gateway
|
|
270
357
|
|
|
271
|
-
The AgentCore Gateway generator creates CDK or Terraform infrastructure as code based on your selected `
|
|
358
|
+
The AgentCore Gateway generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your Gateway.
|
|
272
359
|
|
|
273
360
|
<Infrastructure>
|
|
274
361
|
<Fragment slot="cdk">
|
|
@@ -23,7 +23,7 @@ The generator sets up all the necessary wiring so your agent can discover and in
|
|
|
23
23
|
Before using this generator, ensure you have:
|
|
24
24
|
|
|
25
25
|
1. A Python project with a <Link path="guides/py-agent">Python Agent</Link> component (Strands or LangChain)
|
|
26
|
-
2. A project with an Agent component generated with `--protocol=
|
|
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
27
|
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
@@ -21,7 +21,9 @@ The generator wires the agent so it authenticates to the Gateway with IAM SigV4
|
|
|
21
21
|
Before using this generator, ensure you have:
|
|
22
22
|
|
|
23
23
|
1. A Python project with a <Link path="guides/py-agent">Agent</Link> component (`infra: agentcore`)
|
|
24
|
-
2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
|
|
24
|
+
2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project with `auth: iam`
|
|
25
|
+
|
|
26
|
+
The Gateway must use IAM authentication — the agent signs its requests with SigV4 using its own execution role. The generator rejects Cognito-authenticated gateways.
|
|
25
27
|
|
|
26
28
|
## Usage
|
|
27
29
|
|
|
@@ -22,7 +22,7 @@ Nx Plugin for AWS provides a generator to connect a React website to an Agent th
|
|
|
22
22
|
Before using this generator, ensure you have:
|
|
23
23
|
|
|
24
24
|
1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
|
|
25
|
-
2. A TypeScript or Python Agent with `protocol=
|
|
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
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
|
|
@@ -47,8 +47,8 @@ The generator creates a **single shared** `AguiProvider` component, one hook per
|
|
|
47
47
|
- components
|
|
48
48
|
- AguiProvider.tsx Single `CopilotKitProvider` for every AG-UI agent. Created on the first `connection` run and updated on subsequent runs to register each new agent.
|
|
49
49
|
- copilot
|
|
50
|
-
- index.tsx Re-exports `CopilotChat`, `CopilotSidebar` and `CopilotPopup` with slot defaults that match your website's `
|
|
51
|
-
- *ThemeComponents*.tsx Per-slot theme components (e.g. `CloudscapeAssistantMessage.tsx`, `ShadcnChatInput.tsx`). Only vended when `
|
|
50
|
+
- index.tsx Re-exports `CopilotChat`, `CopilotSidebar` and `CopilotPopup` with slot defaults that match your website's `ux` (Cloudscape, Shadcn, or no theme at all).
|
|
51
|
+
- *ThemeComponents*.tsx Per-slot theme components (e.g. `CloudscapeAssistantMessage.tsx`, `ShadcnChatInput.tsx`). Only vended when `ux` is `cloudscape` or `shadcn`.
|
|
52
52
|
- hooks
|
|
53
53
|
- useAgui\<AgentName>.tsx Registers one AG-UI agent. One file per `connection` run.
|
|
54
54
|
- useSigV4.tsx SigV4 signing (IAM only)
|
|
@@ -102,7 +102,7 @@ The generated code handles authentication depending on your agent's configuratio
|
|
|
102
102
|
|
|
103
103
|
Instantiate CopilotKit components with `agentId` to select which agent to use. The id is the agent's name — the same one you chose when you ran the <Link path="guides/ts-agent">`ts#agent`</Link> or <Link path="guides/py-agent">`py#agent`</Link> generator — and you can also find it in the generated hook file (e.g. the key returned from `packages/web/src/hooks/useAgui<AgentName>.tsx`).
|
|
104
104
|
|
|
105
|
-
Import the chat components from the generated `./components/copilot` module so the theme that matches your website's `
|
|
105
|
+
Import the chat components from the generated `./components/copilot` module so the theme that matches your website's `ux` is applied automatically:
|
|
106
106
|
|
|
107
107
|
```tsx
|
|
108
108
|
import { CopilotChat } from './components/copilot';
|
|
@@ -137,13 +137,13 @@ import { CopilotChat } from './components/copilot';
|
|
|
137
137
|
|
|
138
138
|
### Built-in Themes
|
|
139
139
|
|
|
140
|
-
The generator reads `metadata.
|
|
140
|
+
The generator reads `metadata.ux` from your React website project and vends a themed wrapper module at `src/components/copilot/index.tsx` so the chat components match the rest of your UI without any extra configuration:
|
|
141
141
|
|
|
142
|
-
| `
|
|
142
|
+
| `ux` | Styling applied to `CopilotChat` / `CopilotSidebar` / `CopilotPopup` |
|
|
143
143
|
| ------------ | -------------------------------------------------------------------- |
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
144
|
+
| `cloudscape` | Messages render inside Cloudscape `ChatBubble`s with gen-AI `Avatar`s (matching the [Cloudscape generative AI chat pattern](https://cloudscape.design/patterns/genai/generative-AI-chat/)); the typing indicator becomes a `LoadingBar` and the input is a `PromptInput`. Built from `@cloudscape-design/components` and `@cloudscape-design/chat-components`. |
|
|
145
|
+
| `shadcn` | Assistant messages render in a `bg-muted` bubble with a `Sparkles` avatar; user messages render right-aligned in a `bg-primary` bubble with a `User` avatar. The input is a rounded `Textarea` + pill-shaped send/stop `Button` (Enter submits, Shift+Enter newlines). Uses shadcn primitives from the shared `common-shadcn` package. |
|
|
146
|
+
| `none` (or anything else) | No theme — the module just re-exports the default CopilotKit components. |
|
|
147
147
|
|
|
148
148
|
Import the themed components from the **local theme module** (not `@copilotkit/react-core/v2` directly) so the theme is applied automatically:
|
|
149
149
|
|
|
@@ -16,7 +16,7 @@ import Snippet from '@components/snippet.astro';
|
|
|
16
16
|
Nx Plugin for AWS provides a generator to quickly integrate your <Link path="guides/py-agent">Python Agent</Link> with a React website. It sets up all necessary configuration for connecting to your agent via a type-safe OpenAPI-generated client, including AWS IAM and Cognito authentication support.
|
|
17
17
|
|
|
18
18
|
:::tip[AG-UI agents]
|
|
19
|
-
If your Python Agent was generated with `protocol=
|
|
19
|
+
If your Python Agent was generated with `protocol=ag-ui`, the connection generator instead wires up [CopilotKit](https://docs.copilotkit.ai/aws-strands) and an [`@ag-ui/client`](https://docs.ag-ui.com/) `HttpAgent` on the React website. See the <Link path="guides/connection/react-agui">React to AG-UI Agent</Link> guide for details.
|
|
20
20
|
:::
|
|
21
21
|
|
|
22
22
|
## Prerequisites
|
|
@@ -24,7 +24,7 @@ If your Python Agent was generated with `protocol=AG-UI`, the connection generat
|
|
|
24
24
|
Before using this generator, ensure you have:
|
|
25
25
|
|
|
26
26
|
1. A React website (generated using the <Link path="guides/react-website">`ts#website` generator</Link>)
|
|
27
|
-
2. A Python Agent with `protocol=
|
|
27
|
+
2. A Python Agent with `protocol=http` (generated using the <Link path="guides/py-agent">`py#agent` generator</Link>)
|
|
28
28
|
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
@@ -23,7 +23,7 @@ The generator sets up all the necessary wiring so your agent can discover and in
|
|
|
23
23
|
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
|
-
2. A project with an Agent component generated with `--protocol=
|
|
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
27
|
3. Both components created with `infra: agentcore`
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
@@ -21,7 +21,9 @@ The generator wires the agent so it authenticates to the Gateway with IAM SigV4
|
|
|
21
21
|
Before using this generator, ensure you have:
|
|
22
22
|
|
|
23
23
|
1. A TypeScript project with a <Link path="guides/ts-agent">Agent</Link> component (`infra: agentcore`)
|
|
24
|
-
2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
|
|
24
|
+
2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project with `auth: iam`
|
|
25
|
+
|
|
26
|
+
The Gateway must use IAM authentication — the agent signs its requests with SigV4 using its own execution role. The generator rejects Cognito-authenticated gateways.
|
|
25
27
|
|
|
26
28
|
## Usage
|
|
27
29
|
|
|
@@ -5,6 +5,7 @@ description: Build and deploy Docker images for TypeScript and Python projects i
|
|
|
5
5
|
|
|
6
6
|
import { FileTree, Tabs, TabItem, Code } from '@astrojs/starlight/components';
|
|
7
7
|
import NxCommands from '@components/nx-commands.astro';
|
|
8
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
8
9
|
import Link from '@components/link.astro';
|
|
9
10
|
import Infrastructure from '@components/infrastructure.astro';
|
|
10
11
|
import TrivyVersion from '@components/trivy-version.astro';
|
|
@@ -35,7 +36,7 @@ export const trivyTarget = `{
|
|
|
35
36
|
Several generators (such as <Link path="/guides/ts-agent">`ts#agent`</Link> and <Link path="/guides/py-agent">`py#agent`</Link>) produce a Docker image that is pushed to Amazon ECR and consumed by AWS infrastructure. This guide describes the pattern they follow so that you can apply it to other use cases — for example, running a <Link path="/guides/fastapi">FastAPI</Link> project on Amazon ECS, or deploying a containerised Express server.
|
|
36
37
|
|
|
37
38
|
:::tip[Docker or Finch]
|
|
38
|
-
The container engine used to build images is chosen at workspace creation time via the `--
|
|
39
|
+
The container engine used to build images is chosen at workspace creation time via the `--containers` flag (`docker`, `finch`, or `infer` — the default — which auto-detects what's installed). [Finch](https://runfinch.com/) is an open-source, drop-in alternative to Docker. The selection is recorded in `aws-nx-plugin.config.mts` and applied to every generator that emits container build commands. CDK image asset builds honour the choice via the `CDK_DOCKER` environment variable.
|
|
39
40
|
:::
|
|
40
41
|
|
|
41
42
|
## The Pattern
|
|
@@ -279,25 +280,21 @@ This clears the output directory, then copies both the bundle contents and the `
|
|
|
279
280
|
|
|
280
281
|
## Scanning Images with Trivy
|
|
281
282
|
|
|
282
|
-
It's good practice to scan your images for known vulnerabilities. The generators that follow this pattern add a `trivy` target which scans the built image with [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy), and
|
|
283
|
+
It's good practice to scan your images for known vulnerabilities. The generators that follow this pattern add a `trivy` target which scans the built image with [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy), and exits non-zero on `HIGH` or `CRITICAL` findings.
|
|
283
284
|
|
|
284
285
|
Add a `trivy` target which `dependsOn` your `docker` target. It saves the built image to a tarball and scans it via a workspace-relative bind mount, so the same command works under both `docker` and `finch`:
|
|
285
286
|
|
|
286
287
|
<Code lang="json" code={trivyTarget} />
|
|
287
288
|
|
|
288
|
-
|
|
289
|
+
Each project's per-image scan targets are aggregated under a workspace-wide `trivy` target, which the vended `trivy` root script runs (`nx run-many --target trivy`).
|
|
289
290
|
|
|
290
|
-
|
|
291
|
-
{
|
|
292
|
-
"targets": {
|
|
293
|
-
"build": {
|
|
294
|
-
"dependsOn": ["trivy"]
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
```
|
|
291
|
+
<PackageManagerShortCommand commands={['trivy']} />
|
|
299
292
|
|
|
300
|
-
|
|
293
|
+
:::tip[Run Trivy in CI]
|
|
294
|
+
The scan is intentionally not wired into `build` since this can introduce unnecessary friction when iterating during development, as Trivy's vulnerabilty database is continually updated with new CVEs.
|
|
295
|
+
|
|
296
|
+
Instead we recommend running the above command as a dedicated step in your CI pipeline prior to deployment to production stages.
|
|
297
|
+
:::
|
|
301
298
|
|
|
302
299
|
:::tip[Caching skips unchanged images]
|
|
303
300
|
Because the image is fully determined by your project source, declaring `inputs` (here `default` and `^production`, matching the `bundle` target) lets Nx cache the scan and skip re-scanning an image that hasn't changed. Pin the Trivy image version (e.g. <code>trivy:<TrivyVersion /></code>) so scans are reproducible.
|
package/docs/guides/fastapi.mdx
CHANGED
|
@@ -438,7 +438,7 @@ To consume a stream of responses, you can make use of the <Link path="guides/con
|
|
|
438
438
|
|
|
439
439
|
## Deploying your FastAPI
|
|
440
440
|
|
|
441
|
-
The FastAPI generator creates CDK or Terraform infrastructure as code based on your selected `
|
|
441
|
+
The FastAPI generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your FastAPI.
|
|
442
442
|
|
|
443
443
|
<Infrastructure>
|
|
444
444
|
<Fragment slot="cdk">
|
|
@@ -655,7 +655,7 @@ If you are actively working on both your CDK infrastructure and FastAPI together
|
|
|
655
655
|
</Fragment>
|
|
656
656
|
<Fragment slot="terraform">
|
|
657
657
|
:::note[Terraform Limitations]
|
|
658
|
-
We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `
|
|
658
|
+
We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `iac`.
|
|
659
659
|
:::
|
|
660
660
|
</Fragment>
|
|
661
661
|
</Infrastructure>
|
|
@@ -54,7 +54,7 @@ If the `functionPath` option is provided, the generater will add the necessary f
|
|
|
54
54
|
|
|
55
55
|
<Snippet name="shared-constructs" />
|
|
56
56
|
|
|
57
|
-
The generator creates infrastructure as code for deploying your function based on your selected `
|
|
57
|
+
The generator creates infrastructure as code for deploying your function based on your selected `iac`:
|
|
58
58
|
|
|
59
59
|
<Infrastructure>
|
|
60
60
|
<Fragment slot="cdk">
|
|
@@ -43,7 +43,7 @@ You will find the following changes in your React website:
|
|
|
43
43
|
|
|
44
44
|
<Snippet name="shared-constructs" />
|
|
45
45
|
|
|
46
|
-
You will also find the following infrastructure code generated based on your selected `
|
|
46
|
+
You will also find the following infrastructure code generated based on your selected `iac`:
|
|
47
47
|
|
|
48
48
|
<Infrastructure>
|
|
49
49
|
<Fragment slot="cdk">
|
|
@@ -23,7 +23,7 @@ This generator creates a new [React](https://react.dev/) website with [shadcn/ui
|
|
|
23
23
|
The generated application uses [Vite](https://vite.dev/) as the build tool and bundler. It uses [TanStack Router](https://tanstack.com/router/v1) for type-safe routing.
|
|
24
24
|
|
|
25
25
|
:::note[UX Provider]
|
|
26
|
-
The default `
|
|
26
|
+
The default `ux` is [shadcn/ui](https://ui.shadcn.com/). You can also select [Cloudscape](http://cloudscape.design/) or `none` (bring your own component library).
|
|
27
27
|
:::
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
@@ -69,7 +69,7 @@ If you opted not to use [TanStack Router](https://tanstack.com/router/v1), you w
|
|
|
69
69
|
|
|
70
70
|
<Snippet name="shared-constructs" />
|
|
71
71
|
|
|
72
|
-
The generator creates infrastructure as code for deploying your website based on your selected `
|
|
72
|
+
The generator creates infrastructure as code for deploying your website based on your selected `iac`:
|
|
73
73
|
|
|
74
74
|
<Infrastructure>
|
|
75
75
|
<Fragment slot="cdk">
|
|
@@ -416,7 +416,7 @@ You can run your tests using the `test` target:
|
|
|
416
416
|
|
|
417
417
|
## Deploying Your Website
|
|
418
418
|
|
|
419
|
-
The React website generator creates CDK or Terraform infrastructure as code based on your selected `
|
|
419
|
+
The React website generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your website.
|
|
420
420
|
|
|
421
421
|
<Infrastructure>
|
|
422
422
|
<Fragment slot="cdk">
|
package/docs/guides/security.mdx
CHANGED
|
@@ -24,7 +24,7 @@ Where vended infrastructure suppresses a Checkov rule, the suppression is scoped
|
|
|
24
24
|
|
|
25
25
|
### Container Image Scanning
|
|
26
26
|
|
|
27
|
-
Projects which build container images (for example agents, MCP servers, and database migration images) include a `trivy` target which scans images for HIGH and CRITICAL vulnerabilities
|
|
27
|
+
Projects which build container images (for example agents, MCP servers, and database migration images) include a `trivy` target which scans images for HIGH and CRITICAL vulnerabilities, exiting non-zero on findings. See <Link path="/guides/docker-bundling">Docker Bundling</Link> for details, including how to suppress findings with a `.trivyignore` file.
|
|
28
28
|
|
|
29
29
|
### Credential Scanning
|
|
30
30
|
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -550,7 +550,7 @@ You don't need `aws-jwt-verify` or any other JWT-verification library here — t
|
|
|
550
550
|
|
|
551
551
|
## Deploying your tRPC API
|
|
552
552
|
|
|
553
|
-
The tRPC API generator creates CDK or Terraform infrastructure as code based on your selected `
|
|
553
|
+
The tRPC API generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your tRPC API.
|
|
554
554
|
|
|
555
555
|
<Infrastructure>
|
|
556
556
|
<Fragment slot="cdk">
|
|
@@ -739,7 +739,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
739
739
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
|
740
740
|
|
|
741
741
|
:::tip[CDK Type-Safe Integrations]
|
|
742
|
-
If you selected CDK for your `
|
|
742
|
+
If you selected CDK for your `iac`, 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.
|
|
743
743
|
:::
|
|
744
744
|
|
|
745
745
|
<OptionFilter when={{ auth: 'iam' }} description="Granting API invoke access — IAM-authenticated APIs only">
|