@aws/nx-plugin-mcp 1.0.0-rc.3 → 1.0.0-rc.31

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 (123) hide show
  1. package/bin/aws-nx-mcp.js +4310 -3358
  2. package/docs/guides/agentcore-gateway.mdx +376 -0
  3. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  4. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  5. package/docs/guides/connection/py-agent-a2a.mdx +47 -15
  6. package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
  7. package/docs/guides/connection/py-agent-gateway.mdx +176 -0
  8. package/docs/guides/connection/py-agent-mcp.mdx +42 -13
  9. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  10. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
  11. package/docs/guides/connection/react-agui.mdx +4 -4
  12. package/docs/guides/connection/react-fastapi.mdx +2 -2
  13. package/docs/guides/connection/react-py-agent.mdx +3 -3
  14. package/docs/guides/connection/react-smithy.mdx +3 -3
  15. package/docs/guides/connection/react-trpc.mdx +1 -1
  16. package/docs/guides/connection/react-ts-agent.mdx +5 -5
  17. package/docs/guides/connection/smithy-dynamodb.mdx +68 -0
  18. package/docs/guides/connection/smithy-rdb.mdx +4 -4
  19. package/docs/guides/connection/trpc-dynamodb.mdx +62 -0
  20. package/docs/guides/connection/trpc-rdb.mdx +4 -4
  21. package/docs/guides/connection/ts-agent-a2a.mdx +12 -9
  22. package/docs/guides/connection/ts-agent-dynamodb.mdx +128 -0
  23. package/docs/guides/connection/ts-agent-gateway.mdx +141 -0
  24. package/docs/guides/connection/ts-agent-mcp.mdx +11 -8
  25. package/docs/guides/connection/ts-agent-rdb.mdx +3 -3
  26. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +125 -0
  27. package/docs/guides/connection/ts-mcp-server-rdb.mdx +3 -3
  28. package/docs/guides/connection.mdx +101 -0
  29. package/docs/guides/docker-bundling.mdx +13 -7
  30. package/docs/guides/fastapi.mdx +244 -4
  31. package/docs/guides/license.mdx +264 -109
  32. package/docs/guides/local-development.mdx +87 -0
  33. package/docs/guides/nx-generator.mdx +7 -2
  34. package/docs/guides/py-agent.mdx +204 -44
  35. package/docs/guides/py-dynamodb.mdx +476 -0
  36. package/docs/guides/py-mcp-server.mdx +57 -2
  37. package/docs/guides/react-website-auth.mdx +58 -1
  38. package/docs/guides/react-website.mdx +87 -19
  39. package/docs/guides/terraform-project.mdx +1 -1
  40. package/docs/guides/trpc.mdx +45 -9
  41. package/docs/guides/ts-agent.mdx +120 -6
  42. package/docs/guides/ts-dynamodb.mdx +187 -0
  43. package/docs/guides/ts-mcp-server.mdx +62 -2
  44. package/docs/guides/ts-rdb.mdx +98 -20
  45. package/docs/guides/ts-smithy-api.mdx +183 -4
  46. package/docs/guides/typescript-infrastructure.mdx +9 -1
  47. package/docs/guides/typescript-project.mdx +5 -10
  48. package/docs/guides/workspace.mdx +8 -2
  49. package/docs/snippets/agent/architecture.mdx +1 -1
  50. package/docs/snippets/agent/bedrock-deployment.mdx +4 -0
  51. package/docs/snippets/api/access-logging.mdx +33 -0
  52. package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
  53. package/docs/snippets/api/waf-configuration.mdx +1 -1
  54. package/docs/snippets/connection/dynamodb-local-development.mdx +7 -0
  55. package/docs/snippets/connection/lambda-dynamodb-access.mdx +80 -0
  56. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  57. package/docs/snippets/dynamodb/deploying-table.mdx +171 -0
  58. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  59. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  60. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  61. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  62. package/docs/snippets/mcp/architecture.mdx +1 -1
  63. package/docs/snippets/mcp/bedrock-deployment.mdx +4 -0
  64. package/docs/snippets/mcp/config.mdx +2 -1
  65. package/docs/snippets/required-prerequisites.mdx +1 -1
  66. package/generators.json +100 -1
  67. package/package.json +1 -1
  68. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  69. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  70. package/src/agentcore-gateway/schema.json +70 -0
  71. package/src/connection/schema.json +5 -0
  72. package/src/infra/app/schema.json +5 -0
  73. package/src/license/schema.json +11 -0
  74. package/src/preset/schema.json +10 -5
  75. package/src/py/agent/a2a-connection/schema.json +5 -0
  76. package/src/py/agent/gateway-connection/schema.json +31 -0
  77. package/src/py/agent/mcp-connection/schema.json +5 -0
  78. package/src/py/agent/react-connection/schema.json +5 -0
  79. package/src/py/agent/schema.json +6 -1
  80. package/src/py/api/schema.json +5 -0
  81. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  82. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  83. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  84. package/src/py/dynamodb/schema.json +75 -0
  85. package/src/py/fast-api/react/schema.json +5 -0
  86. package/src/py/fast-api/schema.json +5 -0
  87. package/src/py/lambda-function/schema.json +5 -0
  88. package/src/py/mcp-server/schema.json +5 -0
  89. package/src/py/project/schema.json +5 -0
  90. package/src/smithy/project/schema.json +5 -0
  91. package/src/smithy/react-connection/schema.json +5 -0
  92. package/src/smithy/ts/api/schema.json +5 -0
  93. package/src/terraform/project/schema.json +5 -0
  94. package/src/trpc/backend/schema.json +5 -0
  95. package/src/trpc/react/schema.json +5 -0
  96. package/src/ts/agent/a2a-connection/schema.json +5 -0
  97. package/src/ts/agent/gateway-connection/schema.json +31 -0
  98. package/src/ts/agent/mcp-connection/schema.json +5 -0
  99. package/src/ts/agent/react-connection/schema.json +5 -0
  100. package/src/ts/agent/schema.json +5 -0
  101. package/src/ts/api/schema.json +5 -0
  102. package/src/ts/astro-docs/schema.json +3 -3
  103. package/src/ts/docs/schema.json +3 -3
  104. package/src/ts/dynamodb/agent-connection/schema.json +27 -0
  105. package/src/ts/dynamodb/mcp-server-connection/schema.json +27 -0
  106. package/src/ts/dynamodb/schema.json +75 -0
  107. package/src/ts/dynamodb/smithy-connection/schema.json +23 -0
  108. package/src/ts/dynamodb/trpc-connection/schema.json +23 -0
  109. package/src/ts/lambda-function/schema.json +5 -0
  110. package/src/ts/lib/schema.json +5 -0
  111. package/src/ts/mcp-server/schema.json +5 -0
  112. package/src/ts/nx-generator/schema.json +5 -0
  113. package/src/ts/nx-plugin/schema.json +5 -0
  114. package/src/ts/rdb/agent-connection/schema.json +5 -0
  115. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  116. package/src/ts/rdb/schema.json +5 -0
  117. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  118. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  119. package/src/ts/react-website/app/schema.json +11 -6
  120. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  121. package/src/ts/react-website/runtime-config/schema.json +5 -0
  122. package/src/ts/website/app/schema.json +11 -6
  123. package/src/ts/website/auth/schema.json +5 -0
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Python MCP Server to DynamoDB
3
+ description: Connect a Python MCP Server to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#mcp-server
6
+ targetType: py#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import Infrastructure from '@components/infrastructure.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+
14
+ The `connection` generator wires a <Link path="guides/py-mcp-server">Python MCP Server</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
15
+
16
+ ## Prerequisites
17
+
18
+ Before using this generator, ensure you have:
19
+
20
+ 1. A <Link path="guides/py-mcp-server">`py#mcp-server`</Link> project
21
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
22
+
23
+ ## Usage
24
+
25
+ ### Run the Generator
26
+
27
+ <RunGenerator generator="connection" />
28
+
29
+ Select your MCP server project as the source and your DynamoDB project as the target. If the project contains multiple MCP server components, specify `sourceComponent` to disambiguate.
30
+
31
+ ### Options
32
+
33
+ <GeneratorParameters generator="connection" />
34
+
35
+ ## Generator Output
36
+
37
+ The generator updates the MCP server's `<mcp-server-name>-dev` target in `project.json` to depend on the DynamoDB project's `dev` target, and adds the DynamoDB package as a workspace dependency. No source files are modified.
38
+
39
+ ## Using DynamoDB in Tools
40
+
41
+ Import entity classes from the DynamoDB package and use them inside your MCP server tools:
42
+
43
+ ```python title="packages/my_project/my_project/my_mcp_server/server.py"
44
+ from my_scope.my_table.entities.example import ExampleModel
45
+
46
+ @mcp.tool()
47
+ def list_examples() -> str:
48
+ """List all example items."""
49
+ items = list(ExampleModel.scan())
50
+ return str([item.attribute_values for item in items])
51
+ ```
52
+
53
+ ## Infrastructure
54
+
55
+ To allow the MCP server's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
56
+
57
+ <Infrastructure>
58
+ <Fragment slot="cdk">
59
+
60
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
61
+ import { MyTable } from ':my-scope/common-constructs';
62
+
63
+ const table = new MyTable(this, 'Table');
64
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
65
+
66
+ table.grantReadWriteData(myMcpServer);
67
+ ```
68
+
69
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the MCP server's execution role.
70
+ </Fragment>
71
+ <Fragment slot="terraform">
72
+
73
+ ```hcl title="packages/infra/src/main.tf"
74
+ module "my_table" {
75
+ source = "../../common/terraform/src/app/dynamodb/my-table"
76
+ }
77
+
78
+ resource "aws_iam_role_policy" "dynamodb_access" {
79
+ role = module.my_mcp_server.lambda_role_name
80
+
81
+ policy = jsonencode({
82
+ Version = "2012-10-17"
83
+ Statement = [
84
+ {
85
+ Effect = "Allow"
86
+ Action = [
87
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
88
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
89
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
90
+ ]
91
+ Resource = [
92
+ module.my_table.table_arn,
93
+ "${module.my_table.table_arn}/index/*",
94
+ ]
95
+ },
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "kms:Encrypt",
100
+ "kms:Decrypt",
101
+ "kms:ReEncrypt*",
102
+ "kms:GenerateDataKey*",
103
+ "kms:DescribeKey"
104
+ ]
105
+ Resource = [module.my_table.kms_key_arn]
106
+ },
107
+ ]
108
+ })
109
+ }
110
+ ```
111
+ </Fragment>
112
+ </Infrastructure>
113
+
114
+ ## Local Development
115
+
116
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -71,7 +71,7 @@ The following dependencies are added to the root `package.json`:
71
71
  Each `useAgui<AgentName>` hook reads its agent's runtime value from <Link path="guides/runtime-config">Runtime Configuration</Link> and instantiates an `@ag-ui/client` `HttpAgent`:
72
72
 
73
73
  - **Deployed**: the runtime value is a Bedrock AgentCore Runtime ARN, which is converted to the AgentCore HTTPS endpoint: `https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<encoded-arn>/invocations?qualifier=DEFAULT`
74
- - **Local development**: `serve-local` overrides the value to the agent's local URL (e.g. `http://localhost:8081`)
74
+ - **Local development**: `dev` overrides the value to the agent's local URL (e.g. `http://localhost:8081`)
75
75
 
76
76
  The shared `AguiProvider` calls every generated hook and spreads each one into `selfManagedAgents` on a single `CopilotKitProvider`, which exposes them all to CopilotKit components.
77
77
 
@@ -218,13 +218,13 @@ Deeper overrides follow the same shape — e.g. replace just the copy button on
218
218
 
219
219
  ## Local Development
220
220
 
221
- The connection generator automatically configures `serve-local` integration:
221
+ The connection generator automatically configures `dev` integration:
222
222
 
223
- 1. Running `nx serve-local <website>` will also start the agent's local server
223
+ 1. Running `nx dev <website>` will also start the agent's local server
224
224
  2. The runtime config is overridden to point to the local AG-UI URL (e.g. `http://localhost:8081`)
225
225
  3. Both the website and the agent hot-reload together
226
226
 
227
- <NxCommands commands={['serve-local <WebsiteProject>']} />
227
+ <NxCommands commands={['dev <WebsiteProject>']} />
228
228
 
229
229
  :::tip[Hot Reloading]
230
230
  The website and connected agent hot-reload together, enabling you to quickly iterate on both sides without deploying to AWS.
@@ -115,9 +115,9 @@ Whenever you make changes to your FastAPI, you need to rebuild your project in o
115
115
  :::
116
116
 
117
117
  :::tip[Auto-Regeneration]
118
- If you're actively working on both your React application and FastAPI together, use the React application's `serve-local` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local FastAPI server:
118
+ If you're actively working on both your React application and FastAPI together, use the React application's `dev` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local FastAPI server:
119
119
 
120
- <NxCommands commands={['serve-local <WebsiteProject>']} />
120
+ <NxCommands commands={['dev <WebsiteProject>']} />
121
121
 
122
122
  For more fine-grained control, you can use the `watch-generate:<ApiName>-client` target for your React application to regenerate the client every time you make API changes:
123
123
 
@@ -177,13 +177,13 @@ function ChatComponent() {
177
177
 
178
178
  ## Local Development
179
179
 
180
- The connection generator automatically configures `serve-local` integration:
180
+ The connection generator automatically configures `dev` integration:
181
181
 
182
- 1. Running `nx serve-local <website>` will also start the agent's local FastAPI server
182
+ 1. Running `nx dev <website>` will also start the agent's local FastAPI server
183
183
  2. The runtime config is overridden to point to the local HTTP URL (e.g., `http://localhost:8081/`)
184
184
  3. The TypeScript client is automatically regenerated when the agent's API changes
185
185
 
186
- <NxCommands commands={['serve-local <WebsiteProject>']} />
186
+ <NxCommands commands={['dev <WebsiteProject>']} />
187
187
 
188
188
  :::tip[Hot Reloading]
189
189
  The website and connected agent will hot-reload, enabling you to quickly iterate on both together without deploying to AWS.
@@ -21,7 +21,7 @@ The `connection` generator provides a way to quickly integrate your React websit
21
21
  Before using this generator, ensure your React application has:
22
22
 
23
23
  1. A `main.tsx` file that renders your application
24
- 2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link>)
24
+ 2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#api` generator</Link> with `--framework=smithy`)
25
25
  3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
26
26
 
27
27
  <details>
@@ -116,9 +116,9 @@ Whenever you make changes to your Smithy API model, you need to rebuild your pro
116
116
  :::
117
117
 
118
118
  :::tip[Auto-Regeneration]
119
- If you're actively working on both your React application and Smithy API together, use the React application's `serve-local` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local Smithy API server:
119
+ If you're actively working on both your React application and Smithy API together, use the React application's `dev` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local Smithy API server:
120
120
 
121
- <NxCommands commands={['serve-local <WebsiteProject>']} />
121
+ <NxCommands commands={['dev <WebsiteProject>']} />
122
122
 
123
123
  For more fine-grained control, you can use the `watch-generate:<ApiName>-client` target for your React application to regenerate the client every time you make API changes:
124
124
 
@@ -175,7 +175,7 @@ Subscriptions are only supported when the tRPC API uses `rest-lambda` (REST API)
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.
177
177
 
178
- For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc">`ts#trpc-api` generator guide</Link>.
178
+ For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc">tRPC API generator guide</Link>.
179
179
 
180
180
  #### Using the useSubscription Hook
181
181
 
@@ -64,13 +64,13 @@ Additionally, it installs the required dependencies:
64
64
  The generated client connects to your Agent via tRPC over WebSocket. The agent exposes a tRPC router (including the `invoke` subscription for streaming agent responses) over a WebSocket endpoint.
65
65
 
66
66
  - **Deployed**: The agent runtime ARN is loaded from <Link path="guides/runtime-config">Runtime Configuration</Link>. Running this connection generator also patches the agent's generated CDK/Terraform construct to publish its ARN to the website's `runtime-config.json` (under the `connection` namespace), so only agents you explicitly connect are exposed to the frontend. The ARN is converted to a WebSocket URL following the Bedrock AgentCore Runtime WebSocket protocol: `wss://bedrock-agentcore.<region>.amazonaws.com/runtimes/<encoded-arn>/ws`
67
- - **Local development**: When running with `serve-local`, the runtime config override sets the value to a local `ws://` URL (e.g., `ws://localhost:8081/ws`), and the client connects directly
67
+ - **Local development**: When running with `dev`, the runtime config override sets the value to a local `ws://` URL (e.g., `ws://localhost:8081/ws`), and the client connects directly
68
68
 
69
69
  ### Authentication
70
70
 
71
71
  The generated code handles authentication depending on your agent's configuration:
72
72
 
73
- - **IAM** (default): Uses AWS SigV4 presigned URLs to authenticate the WebSocket connection. Credentials are obtained from the Cognito Identity Pool configured with your website's auth. In `serve-local` mode, signing is automatically skipped when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
73
+ - **IAM** (default): Uses AWS SigV4 presigned URLs to authenticate the WebSocket connection. Credentials are obtained from the Cognito Identity Pool configured with your website's auth. In `dev` mode, signing is automatically skipped when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
74
74
  - **Cognito**: Embeds the JWT access token in the `Sec-WebSocket-Protocol` header as a base64url-encoded bearer token, following the [AgentCore WebSocket auth protocol](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-websocket.html)
75
75
 
76
76
 
@@ -174,11 +174,11 @@ For more details on the vanilla tRPC client, see the [tRPC Vanilla Client docume
174
174
 
175
175
  ## Local Development
176
176
 
177
- The connection generator automatically configures `serve-local` integration for your react website:
177
+ The connection generator automatically configures `dev` integration for your react website:
178
178
 
179
- 1. Running `nx serve-local <website>` will also start the agent's local server
179
+ 1. Running `nx dev <website>` will also start the agent's local server
180
180
  2. The runtime config is overridden to point to the local WebSocket URL (e.g., `ws://localhost:8081/ws`)
181
- 3. Like with connected APIs, authentication is skipped in `serve-local` mode when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
181
+ 3. Like with connected APIs, authentication is skipped in `dev` mode when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
182
182
 
183
183
  :::tip[Hot Reloading]
184
184
  The website and connected agent will hot-reload, enabling you to quickly iterate on both together without deploying to AWS.
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Smithy API to DynamoDB
3
+ description: Connect a Smithy API to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: smithy
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import { FileTree } from '@astrojs/starlight/components';
9
+ import Link from '@components/link.astro';
10
+ import RunGenerator from '@components/run-generator.astro';
11
+ import GeneratorParameters from '@components/generator-parameters.astro';
12
+ import NxCommands from '@components/nx-commands.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your Smithy API backend project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your Smithy API's `project.json` to add a dependency from its `dev` target to the DynamoDB project's `dev` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Operations
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your operation implementations:
43
+
44
+ ```ts title="packages/api/src/operations/list-examples.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import {
47
+ ListExamplesOperationInput,
48
+ ListExamplesOperationOutput,
49
+ } from '../generated/ssdk/index.js';
50
+ import { ServiceContext } from '../context.js';
51
+
52
+ export const listExamples = async (
53
+ _input: ListExamplesOperationInput,
54
+ _ctx: ServiceContext,
55
+ ): Promise<ListExamplesOperationOutput> => {
56
+ const entity = await createExampleEntity();
57
+ const result = await entity.scan.go();
58
+ return { items: result.data };
59
+ };
60
+ ```
61
+
62
+ ## Infrastructure
63
+
64
+ <Snippet name="connection/lambda-dynamodb-access" />
65
+
66
+ ## Local Development
67
+
68
+ <Snippet name="connection/dynamodb-local-development" />
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API<
18
18
 
19
19
  Before using this generator, ensure you have:
20
20
 
21
- 1. A <Link path="guides/ts-smithy-api">`ts#smithy-api`</Link> project (TypeScript backend)
21
+ 1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
22
22
  2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
23
23
 
24
24
  ## Usage
@@ -46,7 +46,7 @@ The generator modifies three existing files in your Smithy API backend:
46
46
 
47
47
  </FileTree>
48
48
 
49
- Additionally, it updates the API's `serve-local` target to start the database automatically.
49
+ Additionally, it updates the API's `dev` target to start the database automatically.
50
50
 
51
51
  ## How It Works
52
52
 
@@ -156,6 +156,6 @@ const server = createServer(async function (req, res) {
156
156
  });
157
157
  ```
158
158
 
159
- <NxCommands commands={["serve-local <api-project-name>"]} />
159
+ <NxCommands commands={["dev <api-project-name>"]} />
160
160
 
161
- This starts both the API and the local database. The `SERVE_LOCAL=true` environment variable is set automatically, so the Prisma client connects to the local Docker database instead of Aurora.
161
+ This starts both the API and the local database. The `LOCAL_DEV=true` environment variable is set automatically, so the Prisma client connects to the local Docker database instead of Aurora.
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: tRPC API to DynamoDB
3
+ description: Connect a tRPC API to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: ts#trpc-api
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import { FileTree } from '@astrojs/starlight/components';
9
+ import Link from '@components/link.astro';
10
+ import RunGenerator from '@components/run-generator.astro';
11
+ import GeneratorParameters from '@components/generator-parameters.astro';
12
+ import NxCommands from '@components/nx-commands.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your tRPC API project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your tRPC API's `project.json` to add a dependency from its `dev` target to the DynamoDB project's `dev` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Procedures
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your tRPC procedures:
43
+
44
+ ```ts title="packages/api/src/procedures/example.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import { publicProcedure } from '../init.js';
47
+
48
+ export const listExamples = publicProcedure
49
+ .query(async () => {
50
+ const entity = await createExampleEntity();
51
+ const result = await entity.scan.go();
52
+ return result.data;
53
+ });
54
+ ```
55
+
56
+ ## Infrastructure
57
+
58
+ <Snippet name="connection/lambda-dynamodb-access" />
59
+
60
+ ## Local Development
61
+
62
+ <Snippet name="connection/dynamodb-local-development" />
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a
18
18
 
19
19
  Before using this generator, ensure you have:
20
20
 
21
- 1. A <Link path="guides/trpc">`ts#trpc-api`</Link> project
21
+ 1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
22
22
  2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
23
23
 
24
24
  ## Usage
@@ -45,7 +45,7 @@ The generator creates a middleware file in your tRPC API project:
45
45
 
46
46
  </FileTree>
47
47
 
48
- Additionally, it updates your tRPC API's `serve-local` target to start the database automatically when running locally.
48
+ Additionally, it updates your tRPC API's `dev` target to start the database automatically when running locally.
49
49
 
50
50
  ## Using the Middleware
51
51
 
@@ -120,8 +120,8 @@ export const dbProcedure = t.procedure
120
120
 
121
121
  ## Local Development
122
122
 
123
- The generator configures your tRPC API's `serve-local` target to depend on the database's `serve-local` target, so running:
123
+ The generator configures your tRPC API's `dev` target to depend on the database's `dev` target, so running:
124
124
 
125
- <NxCommands commands={["serve-local <api-project-name>"]} />
125
+ <NxCommands commands={["dev <api-project-name>"]} />
126
126
 
127
127
  will automatically start the local database alongside your API.
@@ -47,9 +47,12 @@ The generator creates a shared `agent-connection` package and modifies your agen
47
47
  - packages/common/agent-connection
48
48
  - src
49
49
  - app
50
- - \<target-agent-name>-client.ts High-level client for the connected A2A agent
50
+ - \<target-agent-name>-client-strands.ts High-level Strands client for the connected A2A agent
51
51
  - core
52
- - agentcore-a2a-client.ts Low-level AgentCore A2A client with SigV4 authentication
52
+ - agentcore-endpoints.ts Framework-agnostic ARN/URL resolution
53
+ - agentcore-fetch.ts Framework-agnostic SigV4 / JWT / session-forwarding fetch
54
+ - agentcore-a2a-client-config.ts Framework-agnostic A2A client config (signed `clientFactory`)
55
+ - agentcore-a2a-client-strands.ts Strands A2A client wrapping the config
53
56
  - index.ts Exports all clients
54
57
  - project.json
55
58
  - tsconfig.json
@@ -58,7 +61,7 @@ The generator creates a shared `agent-connection` package and modifies your agen
58
61
 
59
62
  Additionally, it:
60
63
  - Transforms your agent's `agent.ts` to register the remote A2A agent as a Strands `tool`
61
- - Updates the agent's `serve-local` target to depend on the target agent's `serve-local` target
64
+ - Updates the agent's `dev` target to depend on the target agent's `dev` target
62
65
  - Installs required dependencies
63
66
 
64
67
  ## Using the Connected A2A Agent
@@ -67,11 +70,11 @@ The generator transforms your agent's `agent.ts` to wrap the remote A2A agent as
67
70
 
68
71
  ```ts title="packages/example/src/my-agent/agent.ts" {2,5-11,14}
69
72
  import { Agent, tool } from '@strands-agents/sdk';
70
- import { RemoteAgentClient } from ':my-scope/agent-connection';
73
+ import { RemoteAgentClientStrands } from ':my-scope/agent-connection';
71
74
  import { z } from 'zod';
72
75
 
73
76
  export const getAgent = async (sessionId: string) => {
74
- const remoteAgent = await RemoteAgentClient.create(sessionId);
77
+ const remoteAgent = await RemoteAgentClientStrands.create(sessionId);
75
78
  const remoteAgentTool = tool({
76
79
  name: 'askRemoteAgent',
77
80
  description: 'Delegate a question to the remote RemoteAgent A2A agent and return its reply.',
@@ -87,7 +90,7 @@ export const getAgent = async (sessionId: string) => {
87
90
 
88
91
  The `sessionId` parameter is plumbed through from the caller, ensuring consistency for [Bedrock AgentCore Observability](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/observability.html).
89
92
 
90
- Under the hood, `RemoteAgentClient.create(sessionId)` returns a Strands `A2AAgent` configured with a SigV4-signing `clientFactory` when deployed to AWS, and a plain `http://localhost:<port>/` endpoint when `SERVE_LOCAL=true`.
93
+ Under the hood, `RemoteAgentClientStrands.create(sessionId)` returns a Strands `A2AAgent` configured with a SigV4-signing `clientFactory` when deployed to AWS, and a plain `http://localhost:<port>/` endpoint when `LOCAL_DEV=true`. The signing and endpoint resolution live in the framework-agnostic `agentcore-a2a-client-config.ts`; only the thin `agentcore-a2a-client-strands.ts` depends on Strands.
91
94
 
92
95
  ## Infrastructure
93
96
 
@@ -95,12 +98,12 @@ Under the hood, `RemoteAgentClient.create(sessionId)` returns a Strands `A2AAgen
95
98
 
96
99
  ## Local Development
97
100
 
98
- The generator configures the host agent's `serve-local` target to:
101
+ The generator configures the host agent's `dev` target to:
99
102
  1. Start the connected A2A agent(s) automatically
100
- 2. Set `SERVE_LOCAL=true` so the generated client connects directly to `http://localhost:<port>/` instead of AgentCore
103
+ 2. Set `LOCAL_DEV=true` so the generated client connects directly to `http://localhost:<port>/` instead of AgentCore
101
104
 
102
105
  Run the agent locally with:
103
106
 
104
- <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
107
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
105
108
 
106
109
  This will start both the host agent and all connected A2A agents, with the host agent calling the remote agents over plain HTTP on their assigned local ports.
@@ -0,0 +1,128 @@
1
+ ---
2
+ title: TypeScript Agent to DynamoDB
3
+ description: Connect a TypeScript Agent to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: ts#agent
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import NxCommands from '@components/nx-commands.astro';
12
+ import Infrastructure from '@components/infrastructure.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-agent">`ts#agent`</Link> project
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your Agent project as the source and your DynamoDB project as the target. If the project contains multiple agent components, specify `sourceComponent` to disambiguate.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates the agent's `<agent-name>-dev` target in `project.json` to depend on the DynamoDB project's `dev` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Agents
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your agent definition:
43
+
44
+ ```ts title="packages/my-service/src/my-agent/agent.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+
47
+ export const getAgent = async () => {
48
+ // ...
49
+ return new Agent({
50
+ tools: [
51
+ tool({
52
+ name: 'list_examples',
53
+ description: 'List all example items',
54
+ func: async () => {
55
+ const entity = await createExampleEntity();
56
+ const result = await entity.scan.go();
57
+ return result.data;
58
+ },
59
+ }),
60
+ ],
61
+ });
62
+ };
63
+ ```
64
+
65
+ ## Infrastructure
66
+
67
+ To allow the agent's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
68
+
69
+ <Infrastructure>
70
+ <Fragment slot="cdk">
71
+
72
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
73
+ import { MyTable } from ':my-scope/common-constructs';
74
+
75
+ const table = new MyTable(this, 'Table');
76
+ const myAgent = new MyAgent(this, 'MyAgent');
77
+
78
+ table.grantReadWriteData(myAgent);
79
+ ```
80
+
81
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the agent's execution role.
82
+ </Fragment>
83
+ <Fragment slot="terraform">
84
+
85
+ ```hcl title="packages/infra/src/main.tf"
86
+ module "my_table" {
87
+ source = "../../common/terraform/src/app/dynamodb/my-table"
88
+ }
89
+
90
+ resource "aws_iam_role_policy" "dynamodb_access" {
91
+ role = module.my_agent.lambda_role_name
92
+
93
+ policy = jsonencode({
94
+ Version = "2012-10-17"
95
+ Statement = [
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
100
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
101
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
102
+ ]
103
+ Resource = [
104
+ module.my_table.table_arn,
105
+ "${module.my_table.table_arn}/index/*",
106
+ ]
107
+ },
108
+ {
109
+ Effect = "Allow"
110
+ Action = [
111
+ "kms:Encrypt",
112
+ "kms:Decrypt",
113
+ "kms:ReEncrypt*",
114
+ "kms:GenerateDataKey*",
115
+ "kms:DescribeKey"
116
+ ]
117
+ Resource = [module.my_table.kms_key_arn]
118
+ },
119
+ ]
120
+ })
121
+ }
122
+ ```
123
+ </Fragment>
124
+ </Infrastructure>
125
+
126
+ ## Local Development
127
+
128
+ <Snippet name="connection/dynamodb-local-development" />