@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.
Files changed (60) hide show
  1. package/bin/aws-nx-mcp.js +63 -18
  2. package/docs/guides/astro-docs.mdx +5 -3
  3. package/docs/guides/connection/py-agent-a2a.mdx +1 -1
  4. package/docs/guides/connection/py-agent-mcp.mdx +1 -1
  5. package/docs/guides/connection/react-agui.mdx +3 -3
  6. package/docs/guides/connection/react-fastapi.mdx +1 -1
  7. package/docs/guides/connection/react-py-agent.mdx +3 -3
  8. package/docs/guides/connection/react-smithy.mdx +1 -1
  9. package/docs/guides/connection/react-trpc.mdx +2 -2
  10. package/docs/guides/connection/react-ts-agent.mdx +3 -3
  11. package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
  12. package/docs/guides/connection/ts-agent-mcp.mdx +1 -1
  13. package/docs/guides/docs.mdx +21 -0
  14. package/docs/guides/fastapi.mdx +11 -9
  15. package/docs/guides/py-agent.mdx +18 -18
  16. package/docs/guides/py-api.mdx +22 -0
  17. package/docs/guides/py-mcp-server.mdx +5 -5
  18. package/docs/guides/python-lambda-function.mdx +4 -4
  19. package/docs/guides/react-website-auth.mdx +3 -3
  20. package/docs/guides/react-website.mdx +8 -5
  21. package/docs/guides/trpc.mdx +18 -16
  22. package/docs/guides/ts-agent.mdx +18 -18
  23. package/docs/guides/ts-api.mdx +28 -0
  24. package/docs/guides/ts-lambda-function.mdx +4 -4
  25. package/docs/guides/ts-mcp-server.mdx +5 -5
  26. package/docs/guides/ts-rdb.mdx +3 -3
  27. package/docs/guides/ts-smithy-api.mdx +8 -6
  28. package/docs/guides/website.mdx +21 -0
  29. package/docs/guides/workspace.mdx +2 -2
  30. package/docs/snippets/agent/architecture.mdx +4 -4
  31. package/docs/snippets/agent/bedrock-deployment.mdx +2 -2
  32. package/docs/snippets/api/api-architecture.mdx +2 -2
  33. package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
  34. package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
  35. package/docs/snippets/api/type-safe-api-integrations.mdx +2 -2
  36. package/docs/snippets/lambda-function/deploying-your-function.mdx +2 -2
  37. package/docs/snippets/mcp/architecture.mdx +4 -4
  38. package/docs/snippets/mcp/bedrock-deployment.mdx +2 -2
  39. package/generators.json +47 -6
  40. package/package.json +1 -1
  41. package/src/infra/app/schema.json +1 -1
  42. package/src/preset/schema.json +4 -4
  43. package/src/py/agent/schema.json +18 -18
  44. package/src/py/api/schema.json +100 -0
  45. package/src/py/fast-api/schema.json +15 -15
  46. package/src/py/lambda-function/schema.json +7 -7
  47. package/src/py/mcp-server/schema.json +15 -15
  48. package/src/py/project/schema.json +2 -2
  49. package/src/smithy/ts/api/schema.json +15 -15
  50. package/src/trpc/backend/schema.json +15 -15
  51. package/src/ts/agent/schema.json +18 -18
  52. package/src/ts/api/schema.json +105 -0
  53. package/src/ts/docs/schema.json +70 -0
  54. package/src/ts/lambda-function/schema.json +7 -7
  55. package/src/ts/mcp-server/schema.json +15 -15
  56. package/src/ts/rdb/schema.json +13 -13
  57. package/src/ts/react-website/app/schema.json +13 -13
  58. package/src/ts/react-website/cognito-auth/schema.json +4 -4
  59. package/src/ts/website/app/schema.json +97 -0
  60. package/src/ts/website/auth/schema.json +46 -0
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: Python API
3
+ description: Reference documentation for the Python API generator
4
+ generator: py#api
5
+ ---
6
+ import Astro from '@astrojs/react';
7
+ import { CardGrid } from '@astrojs/starlight/components';
8
+ import GeneratorParameters from '@components/generator-parameters.astro';
9
+ import FrameworkCard from '@components/framework-card.astro';
10
+
11
+ The Python API generator creates a new API project with your choice of framework. It currently supports [FastAPI](https://fastapi.tiangolo.com/) for building modern, high-performance Python APIs.
12
+
13
+ ## Frameworks
14
+
15
+ <CardGrid>
16
+ <FrameworkCard
17
+ title="FastAPI"
18
+ description="A modern Python web framework for building APIs with automatic OpenAPI documentation, request validation, and async support."
19
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/fastapi`}
20
+ logo="fastapi"
21
+ />
22
+ </CardGrid>
@@ -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 `computeType` is set to `None`)
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={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment">
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={{ computeType: 'None' }} description="No infrastructure is vended for computeType=None">
66
- If you selected `None` for `computeType`, 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.
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={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment details">
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={{ eventSource: 'Any' }} description="Typed eventSource wires @event_parser with a Pydantic model">
167
- If you chose an `eventSource` 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:
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={{ eventSource: 'Any' }} description="eventSource=Any — no parser decorator, event is untyped">
183
- If you selected `Any` for your `eventSource`, the `@event_parser` decorator is not applied and the handler receives an untyped event dict. Regenerate with a specific `eventSource` if you want Pydantic validation and typed field access.
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
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: React Website Authentication
3
3
  description: Reference documentation for React Website Authentication
4
- generator: ts#react-website#auth
4
+ generator: ts#website#auth
5
5
  ---
6
6
  import { FileTree } from '@astrojs/starlight/components';
7
7
  import Link from '@components/link.astro';
@@ -21,11 +21,11 @@ This generator configures the CDK or Terraform infrastructure to create a Cognit
21
21
 
22
22
  You can add authentication to your React website in two ways:
23
23
 
24
- <RunGenerator generator="ts#react-website#auth" />
24
+ <RunGenerator generator="ts#website#auth" />
25
25
 
26
26
  ### Options
27
27
 
28
- <GeneratorParameters generator="ts#react-website#auth" />
28
+ <GeneratorParameters generator="ts#website#auth" />
29
29
 
30
30
  ## Generator Output
31
31
 
@@ -2,6 +2,9 @@
2
2
  title: React Website
3
3
  description: Reference documentation for a React Website
4
4
  generator: ts#react-website
5
+ when:
6
+ framework:
7
+ - react
5
8
  ---
6
9
  import { FileTree, Steps } from '@astrojs/starlight/components';
7
10
  import Link from '@components/link.astro';
@@ -27,11 +30,11 @@ The default `uxProvider` is [Cloudscape](http://cloudscape.design/). You can als
27
30
 
28
31
  You can generate a new React Website in two ways:
29
32
 
30
- <RunGenerator generator="ts#react-website" />
33
+ <RunGenerator generator="ts#website" />
31
34
 
32
35
  ### Options
33
36
 
34
- <GeneratorParameters generator="ts#react-website" />
37
+ <GeneratorParameters generator="ts#website" />
35
38
 
36
39
  ## Generator Output
37
40
 
@@ -127,11 +130,11 @@ cloudfront -> s3
127
130
 
128
131
  The [React documentation](https://react.dev/learn) is a good place to start to learn the basics of building with React.
129
132
 
130
- <OptionFilter when={{ uxProvider: 'Cloudscape' }} description="Cloudscape component docs pointer">
133
+ <OptionFilter when={{ ux: 'cloudscape' }} description="Cloudscape component docs pointer">
131
134
  You can refer to the [Cloudscape documentation](https://cloudscape.design/components/) for details about the available components and how to use them.
132
135
  </OptionFilter>
133
136
 
134
- <OptionFilter when={{ uxProvider: 'Shadcn' }} description="Shadcn component docs pointer">
137
+ <OptionFilter when={{ ux: 'shadcn' }} description="Shadcn component docs pointer">
135
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.
136
139
  </OptionFilter>
137
140
 
@@ -321,7 +324,7 @@ This makes the first React website you generate the default `dev` target for the
321
324
  :::
322
325
 
323
326
  :::warning[Mock Authentication]
324
- When run in this mode and no `runtime-config.json` is present, if you have configured Cognito Authentication (via the <Link path="/guides/react-website-auth">`ts#react-website#auth` generator</Link>), login will be skipped and requests to your local servers will not include authentication headers.
327
+ When run in this mode and no `runtime-config.json` is present, if you have configured Cognito Authentication (via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>), login will be skipped and requests to your local servers will not include authentication headers.
325
328
 
326
329
  To enable login and authentication for `serve-local`, deploy your infrastructure and load runtime config.
327
330
  :::
@@ -2,6 +2,8 @@
2
2
  title: tRPC
3
3
  description: Reference documentation for tRPC
4
4
  generator: ts#trpc-api
5
+ when:
6
+ framework: [trpc]
5
7
  ---
6
8
  import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
7
9
  import Link from '@components/link.astro';
@@ -31,7 +33,7 @@ You can generate a new tRPC API in two ways:
31
33
  <Snippet name="api/api-choice-note" />
32
34
 
33
35
  :::tip[API Type]
34
- Select `ServerlessApiGatewayRestApi` (default) as your `computeType` if you would like to use [tRPC Subscriptions](https://trpc.io/docs/server/subscriptions) to stream responses.
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.
35
37
  :::
36
38
 
37
39
  :::tip[Integration Pattern]
@@ -149,10 +151,10 @@ The use of `query` to define the implementation indicates that the operation is
149
151
 
150
152
  If you add a new procedure, make sure you register it by adding it to the router in `src/router.ts`.
151
153
 
152
- <OptionFilter when={{ computeType: 'ServerlessApiGatewayRestApi' }} description="Streaming subscriptions — REST API only, uses SSE">
154
+ <OptionFilter when={{ infra: 'rest-lambda' }} description="Streaming subscriptions — REST API only, uses SSE">
153
155
  ### Subscriptions (Streaming)
154
156
 
155
- 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 `ServerlessApiGatewayRestApi` 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.
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.
156
158
 
157
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:
158
160
 
@@ -288,7 +290,7 @@ You can add additional values to the context provided to procedures by implement
288
290
 
289
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`.
290
292
 
291
- <OptionFilter when={{ auth: 'IAM' }} description="Identity middleware example for IAM-authenticated APIs">
293
+ <OptionFilter when={{ auth: 'iam' }} description="Identity middleware example for IAM-authenticated APIs">
292
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.
293
295
 
294
296
  First, we define what we'll add to the context:
@@ -324,7 +326,7 @@ export const createIdentityPlugin = () => {
324
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:
325
327
 
326
328
  <Tabs syncKey="http-rest">
327
- <TabItem label="REST API" _filter={{ computeType: 'ServerlessApiGatewayRestApi' }}>
329
+ <TabItem label="REST API" _filter={{ infra: 'rest-lambda' }}>
328
330
  ```ts
329
331
  import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
330
332
  import { initTRPC, TRPCError } from '@trpc/server';
@@ -387,7 +389,7 @@ export const createIdentityPlugin = () => {
387
389
  };
388
390
  ```
389
391
  </TabItem>
390
- <TabItem label="HTTP API" _filter={{ computeType: 'ServerlessApiGatewayHttpApi' }}>
392
+ <TabItem label="HTTP API" _filter={{ infra: 'http-lambda' }}>
391
393
  ```ts
392
394
  import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
393
395
  import { initTRPC, TRPCError } from '@trpc/server';
@@ -459,8 +461,8 @@ export const createIdentityPlugin = () => {
459
461
  </Tabs>
460
462
  </OptionFilter>
461
463
 
462
- <OptionFilter when={{ auth: 'Cognito' }} description="Identity middleware example for Cognito-authenticated APIs">
463
- 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.
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.
464
466
 
465
467
  First, we define what we'll add to the context:
466
468
 
@@ -551,7 +553,7 @@ The tRPC API generator creates CDK or Terraform infrastructure as code based on
551
553
  <Fragment slot="cdk">
552
554
  The CDK construct for deploying your API lives in the `common/constructs` folder. You can consume this in a CDK application, for example:
553
555
 
554
- <OptionFilter when={{ auth: ['IAM', 'Custom'] }} description="CDK usage for IAM or Custom authentication">
556
+ <OptionFilter when={{ auth: ['iam', 'custom'] }} description="CDK usage for IAM or Custom authentication">
555
557
  ```ts {6-8}
556
558
  import { MyApi } from ':my-scope/common-constructs';
557
559
 
@@ -570,7 +572,7 @@ When using `Custom` auth, the construct creates a Lambda Authorizer internally f
570
572
  :::
571
573
  </OptionFilter>
572
574
 
573
- <OptionFilter when={{ auth: 'Cognito' }} description="CDK usage with Cognito authentication — pass the identity construct">
575
+ <OptionFilter when={{ auth: 'cognito' }} description="CDK usage with Cognito authentication — pass the identity construct">
574
576
  ```ts {6,9}
575
577
  import { MyApi, UserIdentity } from ':my-scope/common-constructs';
576
578
 
@@ -587,7 +589,7 @@ export class ExampleStack extends Stack {
587
589
  }
588
590
  ```
589
591
 
590
- The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#react-website-auth` generator</Link>.
592
+ The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>.
591
593
  </OptionFilter>
592
594
 
593
595
  This sets up your API infrastructure, including an AWS API Gateway REST or HTTP API, AWS Lambda functions for business logic, and authentication based on your chosen `auth` method.
@@ -599,7 +601,7 @@ The Terraform modules for deploying your API are in the `common/terraform` folde
599
601
 
600
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:
601
603
 
602
- <OptionFilter when={{ auth: ['IAM', 'Custom'] }} description="Terraform usage for IAM or Custom authentication">
604
+ <OptionFilter when={{ auth: ['iam', 'custom'] }} description="Terraform usage for IAM or Custom authentication">
603
605
  ```hcl {1-3, 8}
604
606
  module "asset_bucket" {
605
607
  source = "../../common/terraform/src/core/asset-bucket"
@@ -626,7 +628,7 @@ module "my_api" {
626
628
  ```
627
629
  </OptionFilter>
628
630
 
629
- <OptionFilter when={{ auth: 'Cognito' }} description="Terraform usage with Cognito authentication — supply user pool and client">
631
+ <OptionFilter when={{ auth: 'cognito' }} description="Terraform usage with Cognito authentication — supply user pool and client">
630
632
  ```hcl {1-3, 8-9}
631
633
  module "asset_bucket" {
632
634
  source = "../../common/terraform/src/core/asset-bucket"
@@ -709,7 +711,7 @@ module "my_api" {
709
711
  }
710
712
  ```
711
713
 
712
- <OptionFilter when={{ auth: 'Custom' }} description="Custom Lambda Authorizer usage with Terraform">
714
+ <OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
713
715
  :::caution[Custom Lambda Authorizer]
714
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.
715
717
  :::
@@ -717,7 +719,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
717
719
  </Fragment>
718
720
  </Infrastructure>
719
721
 
720
- <OptionFilter when={{ computeType: 'ServerlessApiGatewayRestApi' }} description="WAF — REST APIs get a WAF Web ACL by default">
722
+ <OptionFilter when={{ infra: 'rest-lambda' }} description="WAF — REST APIs get a WAF Web ACL by default">
721
723
  ### WAF
722
724
 
723
725
  <Snippet name="api/waf-configuration" parentHeading="WAF" />
@@ -731,7 +733,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
731
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.
732
734
  :::
733
735
 
734
- <OptionFilter when={{ auth: 'IAM' }} description="Granting API invoke access — IAM-authenticated APIs only">
736
+ <OptionFilter when={{ auth: 'iam' }} description="Granting API invoke access — IAM-authenticated APIs only">
735
737
  ### Granting Access (IAM Only)
736
738
 
737
739
  You can grant access to your API as follows:
@@ -47,7 +47,7 @@ First use the <Link path="/guides/typescript-project">`ts#project`</Link> genera
47
47
 
48
48
  The generator will add the following files to your existing TypeScript project. The files generated depend on the chosen `protocol`:
49
49
 
50
- <OptionFilter when={{ protocol: 'HTTP' }} description="tRPC-over-WebSocket layout">
50
+ <OptionFilter when={{ protocol: 'http' }} description="tRPC-over-WebSocket layout">
51
51
  ### HTTP Protocol (default)
52
52
 
53
53
  <FileTree>
@@ -60,13 +60,13 @@ The generator will add the following files to your existing TypeScript project.
60
60
  - agent.ts Main agent definition with sample tools
61
61
  - client.ts Vended client for invoking your agent
62
62
  - agent-core-trpc-client.ts Client factory for connecting to agents on AgentCore Runtime
63
- - Dockerfile Entry point for hosting your agent (excluded when `computeType` is set to `None`)
63
+ - Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
64
64
  - package.json Updated with Strands dependencies
65
65
  - project.json Updated with agent serve targets
66
66
  </FileTree>
67
67
  </OptionFilter>
68
68
 
69
- <OptionFilter when={{ protocol: 'A2A' }} description="Strands A2A Express server layout">
69
+ <OptionFilter when={{ protocol: 'a2a' }} description="Strands A2A Express server layout">
70
70
  ### A2A Protocol
71
71
 
72
72
  The entry point uses the [Strands A2A Express Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) instead of tRPC:
@@ -77,13 +77,13 @@ The entry point uses the [Strands A2A Express Server](https://strandsagents.com/
77
77
  - agent/ (or custom name if specified)
78
78
  - index.ts A2A Express server entry point
79
79
  - agent.ts Main agent definition with sample tools
80
- - Dockerfile Entry point for hosting your agent (excluded when `computeType` is set to `None`)
80
+ - Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
81
81
  - package.json Updated with Strands and Express dependencies
82
82
  - project.json Updated with agent serve targets
83
83
  </FileTree>
84
84
  </OptionFilter>
85
85
 
86
- <OptionFilter when={{ protocol: 'AG-UI' }} description="AG-UI SSE-over-POST server layout">
86
+ <OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI SSE-over-POST server layout">
87
87
  ### AG-UI Protocol
88
88
 
89
89
  The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui/aws-strands) to expose the agent via the [AG-UI protocol](https://docs.ag-ui.com/) (SSE over POST), compatible with [CopilotKit](https://docs.copilotkit.ai/aws-strands):
@@ -94,7 +94,7 @@ The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui
94
94
  - agent/ (or custom name if specified)
95
95
  - index.ts AG-UI server entry point (Express + SSE)
96
96
  - agent.ts Main agent definition with sample tools
97
- - Dockerfile Entry point for hosting your agent (excluded when `computeType` is set to `None`)
97
+ - Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
98
98
  - package.json Updated with Strands and AG-UI dependencies
99
99
  - project.json Updated with agent serve targets
100
100
  </FileTree>
@@ -102,7 +102,7 @@ The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui
102
102
 
103
103
  ### Infrastructure
104
104
 
105
- <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment">
105
+ <OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
106
106
  <Snippet name="shared-constructs" />
107
107
 
108
108
  For deploying your Agent, the following files are generated:
@@ -132,8 +132,8 @@ For deploying your Agent, the following files are generated:
132
132
  </Infrastructure>
133
133
  </OptionFilter>
134
134
 
135
- <OptionFilter when={{ computeType: 'None' }} description="No infrastructure is vended for computeType=None">
136
- If you selected `None` for `computeType`, 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.
135
+ <OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
136
+ 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.
137
137
  </OptionFilter>
138
138
 
139
139
  #### Architecture
@@ -152,7 +152,7 @@ Your agent's server protocol determines how it communicates. You can choose betw
152
152
 
153
153
  The protocol is set in the CDK/Terraform infrastructure, and the application code is generated accordingly.
154
154
 
155
- <OptionFilter when={{ protocol: 'HTTP' }} description="tRPC over WebSocket details">
155
+ <OptionFilter when={{ protocol: 'http' }} description="tRPC over WebSocket details">
156
156
  ### tRPC over WebSocket (HTTP protocol)
157
157
 
158
158
  The TypeScript Agent uses [tRPC](https://trpc.io/) over WebSocket, leveraging [AgentCore's bidirectional streaming support](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-websocket.html) to enable real-time, type-safe communication between clients and your agent.
@@ -239,7 +239,7 @@ For other MCP servers, please refer to the [Strands Documentation](https://stran
239
239
 
240
240
  For a more in-depth guide to writing Strands agents, refer to the [Strands documentation](https://strandsagents.com/docs/user-guide/quickstart/overview/).
241
241
 
242
- <OptionFilter when={{ protocol: 'A2A' }} description="A2A Express server details">
242
+ <OptionFilter when={{ protocol: 'a2a' }} description="A2A Express server details">
243
243
  ## A2A Server (A2A protocol)
244
244
 
245
245
  The generated `index.ts` mounts the [Strands A2A Express Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) onto an Express app so the generated agent exposes the A2A protocol endpoints alongside a `/ping` health check. When deployed to AgentCore, the entry point resolves the runtime's public ARN from AppConfig and advertises it in the agent card.
@@ -247,7 +247,7 @@ The generated `index.ts` mounts the [Strands A2A Express Server](https://strands
247
247
  Most users will not need to modify this file — edit `agent.ts` to change tools or the system prompt. A2A agents listen on port `9000` (vs `8080` for HTTP), which the generated Dockerfile and infrastructure are already configured for.
248
248
  </OptionFilter>
249
249
 
250
- <OptionFilter when={{ protocol: 'AG-UI' }} description="AG-UI server details">
250
+ <OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI server details">
251
251
  ## AG-UI Server (AG-UI protocol)
252
252
 
253
253
  The generated `index.ts` wraps your Strands `Agent` in an [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui/aws-strands) `StrandsAgent` and creates an Express app via `createStrandsApp()`. 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.
@@ -275,7 +275,7 @@ The generator configures a `<your-agent-name>-chat` Nx target that depends on `<
275
275
 
276
276
  For **HTTP** (tRPC over WebSocket) agents, the generator also emits a tiny `scripts/<your-agent-name>/chat.ts` that wraps the generated `<Agent>Client.local({ url })` so you can customize it as you evolve the agent's input shape.
277
277
 
278
- <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment details">
278
+ <OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
279
279
  ## Deploying Your Agent to Bedrock AgentCore Runtime
280
280
 
281
281
  <Snippet name="agent/bedrock-deployment" parentHeading="Deploying Your Agent to Bedrock AgentCore Runtime" />
@@ -305,7 +305,7 @@ For more details, refer to the [AgentCore documentation on observability](https:
305
305
 
306
306
  Agent communication is transmitted via tRPC over WebSocket. As such, it's recommended to use the generated type-safe client factory in `client.ts`.
307
307
 
308
- <OptionFilter when={{ protocol: 'HTTP' }} description="tRPC-over-WebSocket client factory invocation details">
308
+ <OptionFilter when={{ protocol: 'http' }} description="tRPC-over-WebSocket client factory invocation details">
309
309
  ### Invoke the Local Server
310
310
 
311
311
  You can invoke a locally running agent using the `.local` factory method from the client factory.
@@ -340,7 +340,7 @@ The client factory uses HTTP headers in the WebSocket handshake to authenticate
340
340
  :::
341
341
 
342
342
  <Tabs syncKey="auth">
343
- <TabItem label="IAM" _filter={{ auth: 'IAM' }}>
343
+ <TabItem label="IAM" _filter={{ auth: 'iam' }}>
344
344
  ##### IAM Authentication
345
345
 
346
346
  You can invoke your deployed agent by passing its ARN to the `withIamAuth` factory method:
@@ -364,7 +364,7 @@ This will use the default AWS credential provider chain to authenticate requests
364
364
  :::
365
365
  </TabItem>
366
366
 
367
- <TabItem label="Cognito" _filter={{ auth: 'Cognito' }}>
367
+ <TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
368
368
  ##### JWT / Cognito Authentication
369
369
 
370
370
  Use the `withJwtAuth` factory method to authenticate with the JWT / Cognito access token.
@@ -415,7 +415,7 @@ For invoking your Agent from a React website, you can make use of the <Link path
415
415
  Refer to the <Link path="/guides/connection/react-ts-agent">`connection` generator guide</Link> for details about how the connection is set up.
416
416
  </OptionFilter>
417
417
 
418
- <OptionFilter when={{ protocol: 'A2A' }} description="A2A delegation details">
418
+ <OptionFilter when={{ protocol: 'a2a' }} description="A2A delegation details">
419
419
  ### Invoking an A2A Agent as a Tool
420
420
 
421
421
  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/ts-agent-a2a">`connection` generator</Link>. It vends a SigV4-authenticated client for the target agent and AST-transforms this agent's `agent.ts` to register the remote A2A agent as a Strands `tool`.
@@ -425,7 +425,7 @@ To delegate work from this agent to a remote A2A agent (either <Link path="/guid
425
425
  Refer to the <Link path="/guides/connection/ts-agent-a2a">`connection` generator guide</Link> for details about how the connection is set up.
426
426
  </OptionFilter>
427
427
 
428
- <OptionFilter when={{ protocol: 'AG-UI' }} description="AG-UI / React connection details">
428
+ <OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / React connection details">
429
429
  ### Invoking an AG-UI Agent
430
430
 
431
431
  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).
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: TypeScript API
3
+ description: Reference documentation for the TypeScript API generator
4
+ generator: ts#api
5
+ ---
6
+ import Astro from '@astrojs/react';
7
+ import { CardGrid } from '@astrojs/starlight/components';
8
+ import GeneratorParameters from '@components/generator-parameters.astro';
9
+ import FrameworkCard from '@components/framework-card.astro';
10
+
11
+ The TypeScript API generator creates a new API project with your choice of framework. It supports [tRPC](https://trpc.io/) for end-to-end type-safe APIs and [Smithy](https://smithy.io/) for model-driven API development.
12
+
13
+ ## Frameworks
14
+
15
+ <CardGrid>
16
+ <FrameworkCard
17
+ title="tRPC"
18
+ description="End-to-end type-safe APIs with TypeScript. Ideal when your frontend and backend share a TypeScript codebase."
19
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/trpc`}
20
+ logo="trpc"
21
+ />
22
+ <FrameworkCard
23
+ title="Smithy"
24
+ description="Model-driven API development using an interface definition language. Ideal for APIs consumed by multiple languages."
25
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/ts-smithy-api`}
26
+ logo="smithy"
27
+ />
28
+ </CardGrid>
@@ -179,8 +179,8 @@ export const handler = middy()
179
179
 
180
180
  ### Type Safety
181
181
 
182
- <OptionFilter not when={{ eventSource: 'Any' }} description="eventSource provides a typed Zod schema for the incoming event">
183
- If you chose an `eventSource` when generating your lambda function, your function is instrumented with the [`parser` middleware from AWS Lambda Powertools](https://docs.powertools.aws.dev/lambda/typescript/latest/utilities/parser/). For example:
182
+ <OptionFilter not when={{ event: 'Any' }} description="event provides a typed Zod schema for the incoming event">
183
+ If you chose an `event` when generating your lambda function, your function is instrumented with the [`parser` middleware from AWS Lambda Powertools](https://docs.powertools.aws.dev/lambda/typescript/latest/utilities/parser/). For example:
184
184
 
185
185
  ```typescript {4}
186
186
  export const myFunction = async (
@@ -205,8 +205,8 @@ If you have custom data nested within an event, for example a DynamoDB stream or
205
205
  :::
206
206
  </OptionFilter>
207
207
 
208
- <OptionFilter when={{ eventSource: 'Any' }} description="eventSource=Any — no parser middleware, event is typed as `any`">
209
- If you selected `Any` for your `eventSource`, the `parser` middleware is not wired in and the `event` parameter is typed as `any`. Regenerate the function with a specific `eventSource` if you want compile-time type safety and runtime validation.
208
+ <OptionFilter when={{ event: 'Any' }} description="event=Any — no parser middleware, event is typed as `any`">
209
+ If you selected `Any` for your `event`, the `parser` middleware is not wired in and the `event` parameter is typed as `any`. Regenerate the function with a specific `event` if you want compile-time type safety and runtime validation.
210
210
  </OptionFilter>
211
211
 
212
212
  ## Bundling
@@ -53,21 +53,21 @@ The generator will add the following files to your existing TypeScript project:
53
53
  - divide.ts Sample tool
54
54
  - resources/
55
55
  - sample-guidance.ts Sample resource
56
- - Dockerfile Entry point for hosting your MCP server (excluded when `computeType` is set to `None`)
56
+ - Dockerfile Entry point for hosting your MCP server (excluded when `infra` is set to `None`)
57
57
  - package.json Updated with bin entry and MCP dependencies
58
58
  - project.json Updated with MCP server serve target
59
59
  </FileTree>
60
60
 
61
61
  ### Infrastructure
62
62
 
63
- <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment">
63
+ <OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
64
64
  <Snippet name="shared-constructs" />
65
65
 
66
66
  <Snippet name="mcp/shared-constructs" />
67
67
  </OptionFilter>
68
68
 
69
- <OptionFilter when={{ computeType: 'None' }} description="No infrastructure is vended for computeType=None">
70
- If you selected `None` for `computeType`, 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.
69
+ <OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
70
+ 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.
71
71
  </OptionFilter>
72
72
 
73
73
  #### Architecture
@@ -146,7 +146,7 @@ If you would like to run your MCP server locally using [Streamable HTTP transpor
146
146
 
147
147
  This command uses `tsx --watch` to automatically restart the server when files change.
148
148
 
149
- <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment details">
149
+ <OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
150
150
  ## Deploying Your MCP Server to Bedrock AgentCore Runtime
151
151
 
152
152
  <Snippet name="mcp/bedrock-deployment" parentHeading="Deploying Your MCP Server to Bedrock AgentCore Runtime" />
@@ -528,7 +528,7 @@ By default, the generated local Docker database image matches the default Aurora
528
528
 
529
529
  The local database image is configured in the generated database project's `serve-local` target in `project.json`. Update the image argument passed to `scripts/docker-start.ts` when you change engine versions.
530
530
 
531
- <OptionFilter when={{ engine: 'PostgreSQL' }}>
531
+ <OptionFilter when={{ engine: 'postgres' }}>
532
532
  <Infrastructure>
533
533
  <Fragment slot="cdk">
534
534
 
@@ -554,7 +554,7 @@ module "my_database" {
554
554
  </Infrastructure>
555
555
  </OptionFilter>
556
556
 
557
- <OptionFilter when={{ engine: 'MySQL' }}>
557
+ <OptionFilter when={{ engine: 'mysql' }}>
558
558
  <Infrastructure>
559
559
  <Fragment slot="cdk">
560
560
 
@@ -689,7 +689,7 @@ module "my_database" {
689
689
 
690
690
  ## Limitations
691
691
 
692
- <OptionFilter when={{ engine: 'MySQL' }}>
692
+ <OptionFilter when={{ engine: 'mysql' }}>
693
693
 
694
694
  ### MySQL: API Gateway Streaming Mode
695
695
 
@@ -2,6 +2,8 @@
2
2
  title: Smithy TypeScript API
3
3
  description: Reference documentation for Smithy TypeScript API
4
4
  generator: ts#smithy-api
5
+ when:
6
+ framework: [smithy]
5
7
  ---
6
8
 
7
9
  import { FileTree } from '@astrojs/starlight/components';
@@ -460,7 +462,7 @@ This sets up:
460
462
 
461
463
  <Snippet name="api/cors-configuration-cdk-note" />
462
464
 
463
- <OptionFilter when={{ auth: 'Cognito' }} description="Cognito identity construct wiring">
465
+ <OptionFilter when={{ auth: 'cognito' }} description="Cognito identity construct wiring">
464
466
  :::note[Cognito Authentication]
465
467
  If you selected `Cognito` authentication, you will need to supply the `identity` property to the API construct:
466
468
 
@@ -479,11 +481,11 @@ export class ExampleStack extends Stack {
479
481
  }
480
482
  ```
481
483
 
482
- The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#react-website-auth` generator</Link>
484
+ The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>
483
485
  :::
484
486
  </OptionFilter>
485
487
 
486
- <OptionFilter when={{ auth: 'Custom' }} description="Custom Lambda Authorizer CDK usage">
488
+ <OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer CDK usage">
487
489
  :::caution[Custom Lambda Authorizer]
488
490
  When using `Custom` auth, the construct creates a Lambda Authorizer internally from the generated `src/authorizer.ts` file, which **denies all requests by default**. You must implement your authorization logic in that file before your API will accept any traffic.
489
491
  :::
@@ -530,7 +532,7 @@ This sets up:
530
532
 
531
533
  <Snippet name="api/cors-configuration-terraform-note" />
532
534
 
533
- <OptionFilter when={{ auth: 'Cognito' }} description="Cognito module wiring">
535
+ <OptionFilter when={{ auth: 'cognito' }} description="Cognito module wiring">
534
536
  :::note[Cognito Authentication]
535
537
  If you selected `Cognito` authentication, you will need to supply the Cognito configuration:
536
538
 
@@ -554,7 +556,7 @@ module "my_api" {
554
556
  :::
555
557
  </OptionFilter>
556
558
 
557
- <OptionFilter when={{ auth: 'Custom' }} description="Custom Lambda Authorizer usage with Terraform">
559
+ <OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
558
560
  :::caution[Custom Lambda Authorizer]
559
561
  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.
560
562
  :::
@@ -616,7 +618,7 @@ We do not support type-safe integrations for Terraform, and therefore no code ge
616
618
  </Fragment>
617
619
  </Infrastructure>
618
620
 
619
- <OptionFilter when={{ auth: 'IAM' }} description="IAM-authenticated APIs only">
621
+ <OptionFilter when={{ auth: 'iam' }} description="IAM-authenticated APIs only">
620
622
  ### Granting Access (IAM Only)
621
623
 
622
624
  If you selected `IAM` authentication, you can use the `grantInvokeAccess` method to grant access to your API: