@aws/nx-plugin-mcp 1.0.0-rc.4 → 1.0.0-rc.40

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 (161) hide show
  1. package/bin/aws-nx-mcp.js +2240 -1030
  2. package/docs/get_started/building-with-ai.mdx +116 -0
  3. package/docs/get_started/concepts.mdx +52 -0
  4. package/docs/get_started/existing-project.mdx +176 -0
  5. package/docs/get_started/quick-start.mdx +266 -0
  6. package/docs/get_started/tutorials/contribute-generator.mdx +405 -0
  7. package/docs/get_started/tutorials/dungeon-game/1.mdx +1205 -0
  8. package/docs/get_started/tutorials/dungeon-game/2.mdx +237 -0
  9. package/docs/get_started/tutorials/dungeon-game/3.mdx +76 -0
  10. package/docs/get_started/tutorials/dungeon-game/4.mdx +162 -0
  11. package/docs/get_started/tutorials/dungeon-game/overview.mdx +144 -0
  12. package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
  13. package/docs/get_started/tutorials/existing-project.mdx +4 -0
  14. package/docs/guides/agentcore-gateway.mdx +376 -0
  15. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  16. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  17. package/docs/guides/connection/py-agent-a2a.mdx +47 -15
  18. package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
  19. package/docs/guides/connection/py-agent-gateway.mdx +176 -0
  20. package/docs/guides/connection/py-agent-mcp.mdx +42 -13
  21. package/docs/guides/connection/py-agent-rdb.mdx +178 -0
  22. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  23. package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
  24. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
  25. package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -0
  26. package/docs/guides/connection/react-agui.mdx +4 -4
  27. package/docs/guides/connection/react-fastapi.mdx +38 -2
  28. package/docs/guides/connection/react-py-agent.mdx +7 -13
  29. package/docs/guides/connection/react-smithy.mdx +3 -3
  30. package/docs/guides/connection/react-trpc.mdx +1 -1
  31. package/docs/guides/connection/react-ts-agent.mdx +8 -8
  32. package/docs/guides/connection/smithy-dynamodb.mdx +4 -4
  33. package/docs/guides/connection/smithy-rdb.mdx +5 -5
  34. package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
  35. package/docs/guides/connection/trpc-rdb.mdx +5 -5
  36. package/docs/guides/connection/ts-agent-a2a.mdx +12 -9
  37. package/docs/guides/connection/ts-agent-dynamodb.mdx +3 -3
  38. package/docs/guides/connection/ts-agent-gateway.mdx +141 -0
  39. package/docs/guides/connection/ts-agent-mcp.mdx +11 -8
  40. package/docs/guides/connection/ts-agent-rdb.mdx +66 -21
  41. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +3 -3
  42. package/docs/guides/connection/ts-mcp-server-rdb.mdx +66 -16
  43. package/docs/guides/connection.mdx +104 -5
  44. package/docs/guides/docker-bundling.mdx +68 -8
  45. package/docs/guides/fastapi.mdx +244 -4
  46. package/docs/guides/license.mdx +264 -109
  47. package/docs/guides/local-development.mdx +87 -0
  48. package/docs/guides/nx-generator.mdx +7 -2
  49. package/docs/guides/py-agent.mdx +213 -49
  50. package/docs/guides/py-dynamodb.mdx +476 -0
  51. package/docs/guides/py-mcp-server.mdx +61 -2
  52. package/docs/guides/py-rdb.mdx +254 -0
  53. package/docs/guides/react-website-auth.mdx +58 -1
  54. package/docs/guides/react-website.mdx +87 -19
  55. package/docs/guides/terraform-project.mdx +1 -1
  56. package/docs/guides/trpc.mdx +45 -9
  57. package/docs/guides/ts-agent.mdx +127 -9
  58. package/docs/guides/ts-dynamodb.mdx +62 -239
  59. package/docs/guides/ts-mcp-server.mdx +66 -3
  60. package/docs/guides/ts-nx-plugin.mdx +1 -1
  61. package/docs/guides/ts-rdb.mdx +117 -470
  62. package/docs/guides/ts-smithy-api.mdx +183 -4
  63. package/docs/guides/typescript-infrastructure.mdx +9 -1
  64. package/docs/guides/typescript-project.mdx +5 -10
  65. package/docs/guides/workspace.mdx +2 -2
  66. package/docs/snippets/agent/architecture.mdx +1 -1
  67. package/docs/snippets/agent/bedrock-deployment.mdx +4 -0
  68. package/docs/snippets/agent/runtime-arn.mdx +21 -0
  69. package/docs/snippets/api/access-logging.mdx +33 -0
  70. package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
  71. package/docs/snippets/api/waf-configuration.mdx +1 -1
  72. package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
  73. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  74. package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
  75. package/docs/snippets/connection/rdb-api-infrastructure.mdx +50 -18
  76. package/docs/snippets/dynamodb/deploying-table.mdx +166 -0
  77. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  78. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  79. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  80. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  81. package/docs/snippets/mcp/architecture.mdx +1 -1
  82. package/docs/snippets/mcp/bedrock-deployment.mdx +4 -0
  83. package/docs/snippets/mcp/config.mdx +3 -2
  84. package/docs/snippets/rdb/architecture.mdx +38 -0
  85. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  86. package/docs/snippets/rdb/deletion-protection.mdx +34 -0
  87. package/docs/snippets/rdb/deploying.mdx +187 -0
  88. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  89. package/docs/snippets/rdb/engine-version.mdx +63 -0
  90. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  91. package/docs/snippets/rdb/logging.mdx +32 -0
  92. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  93. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  94. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  95. package/docs/snippets/required-prerequisites.mdx +1 -1
  96. package/docs/snippets/trivy-image-scan.mdx +27 -0
  97. package/generators.json +101 -2
  98. package/package.json +1 -1
  99. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  100. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  101. package/src/agentcore-gateway/schema.json +70 -0
  102. package/src/connection/schema.json +5 -0
  103. package/src/infra/app/schema.json +5 -0
  104. package/src/init/schema.json +35 -0
  105. package/src/license/schema.json +11 -0
  106. package/src/preset/schema.json +11 -5
  107. package/src/py/agent/a2a-connection/schema.json +5 -0
  108. package/src/py/agent/gateway-connection/schema.json +31 -0
  109. package/src/py/agent/mcp-connection/schema.json +5 -0
  110. package/src/py/agent/react-connection/schema.json +5 -0
  111. package/src/py/agent/schema.json +6 -1
  112. package/src/py/api/schema.json +5 -0
  113. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  114. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  115. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  116. package/src/py/dynamodb/schema.json +75 -0
  117. package/src/py/fast-api/react/schema.json +5 -0
  118. package/src/py/fast-api/schema.json +5 -0
  119. package/src/py/lambda-function/schema.json +5 -0
  120. package/src/py/mcp-server/schema.json +5 -0
  121. package/src/py/project/schema.json +5 -0
  122. package/src/py/rdb/agent-connection/schema.json +27 -0
  123. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  124. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  125. package/src/py/rdb/schema.json +77 -0
  126. package/src/smithy/project/schema.json +5 -0
  127. package/src/smithy/react-connection/schema.json +5 -0
  128. package/src/smithy/ts/api/schema.json +5 -0
  129. package/src/terraform/project/schema.json +5 -0
  130. package/src/trpc/backend/schema.json +5 -0
  131. package/src/trpc/react/schema.json +5 -0
  132. package/src/ts/agent/a2a-connection/schema.json +5 -0
  133. package/src/ts/agent/gateway-connection/schema.json +31 -0
  134. package/src/ts/agent/mcp-connection/schema.json +5 -0
  135. package/src/ts/agent/react-connection/schema.json +5 -0
  136. package/src/ts/agent/schema.json +5 -0
  137. package/src/ts/api/schema.json +5 -0
  138. package/src/ts/astro-docs/schema.json +3 -3
  139. package/src/ts/docs/schema.json +3 -3
  140. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  141. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  142. package/src/ts/dynamodb/schema.json +25 -2
  143. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  144. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  145. package/src/ts/lambda-function/schema.json +5 -0
  146. package/src/ts/lib/schema.json +5 -0
  147. package/src/ts/mcp-server/schema.json +5 -0
  148. package/src/ts/nx-generator/schema.json +5 -0
  149. package/src/ts/nx-plugin/schema.json +5 -0
  150. package/src/ts/rdb/agent-connection/schema.json +5 -0
  151. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  152. package/src/ts/rdb/schema.json +6 -1
  153. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  154. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  155. package/src/ts/react-website/app/schema.json +11 -6
  156. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  157. package/src/ts/react-website/runtime-config/schema.json +5 -0
  158. package/src/ts/website/app/schema.json +11 -6
  159. package/src/ts/website/auth/schema.json +5 -0
  160. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  161. /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
@@ -4,7 +4,9 @@ description: Generate a TypeScript Agent for building AI agents with tools and d
4
4
  generator: ts#agent
5
5
  ---
6
6
 
7
- import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
7
+ import { FileTree, Tabs, TabItem, CardGrid } from '@astrojs/starlight/components';
8
+ import Astro from '@astrojs/react';
9
+ import ConnectionCard from '@components/connection-card.astro';
8
10
  import RunGenerator from '@components/run-generator.astro';
9
11
  import NxCommands from '@components/nx-commands.astro';
10
12
  import Link from '@components/link.astro';
@@ -261,19 +263,61 @@ Most users will not need to modify `index.ts` — edit `agent.ts` to change tool
261
263
 
262
264
  ### Local Development
263
265
 
264
- The generator configures a target named `<your-agent-name>-serve`, which starts your Agent locally for development and testing.
266
+ To run your Agent (and everything connected to it) locally, use the project's `dev` target:
265
267
 
266
- <NxCommands commands={['agent-serve your-project']} />
268
+ <NxCommands commands={['dev your-project']} />
267
269
 
268
- This command uses `tsx --watch` to automatically restart the server when files change. The agent will be available at `http://localhost:8081` (or the assigned port if you have multiple agents).
270
+ If you have added multiple components to your project (agents, MCP servers, etc.), this starts them all. To run just this agent, target its `<your-agent-name>-dev` target:
271
+
272
+ <NxCommands commands={['agent-dev your-project']} />
273
+
274
+ This uses `tsx --watch` to automatically restart the server when files change. The agent will be available at `http://localhost:8081` (or the assigned port if you have multiple agents).
269
275
 
270
276
  ### Chat with Your Agent
271
277
 
272
- The generator configures a `<your-agent-name>-chat` Nx target that depends on `<your-agent-name>-serve-local`. Running it starts the agent locally and drops you into an interactive terminal chat:
278
+ The generator configures a `<your-agent-name>-chat` Nx target that drops you into an interactive terminal chat with your agent.
279
+
280
+ The chat target runs standalone. By default it connects to your locally running agent, so start the agent's `<your-agent-name>-dev` target first (in a separate terminal):
281
+
282
+ <NxCommands commands={['agent-dev your-project']} />
283
+
284
+ Then, in another terminal, start the chat:
273
285
 
274
286
  <NxCommands commands={['run your-project:agent-chat']} />
275
287
 
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.
288
+ The generator emits a `scripts/<your-agent-name>/chat.ts` for every protocol. You can customize it as you evolve the agent's input shape. It connects to the local agent by default, or to your deployed agent when `RUNTIME_CONFIG_APP_ID` is set (see [Chat with your deployed agent](#chat-with-your-deployed-agent) below).
289
+
290
+ <OptionFilter when={{ infra: 'agentcore' }} description="Deployed agent chat details">
291
+ #### Chat with your deployed agent
292
+
293
+ To chat with your agent deployed to Bedrock AgentCore, set the `RUNTIME_CONFIG_APP_ID` environment variable to the AppConfig application id of the deployment (output as `RuntimeConfigApplicationId` by the deployed stack). The chat script resolves your agent's runtime ARN from runtime configuration and connects to the deployed endpoint:
294
+
295
+ <Tabs syncKey="auth">
296
+ <TabItem label="IAM" _filter={{ auth: 'iam' }}>
297
+ For IAM-authenticated agents, requests are signed with [SigV4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html) using your default AWS credentials. Ensure the environment has AWS credentials with permission to invoke the runtime:
298
+
299
+ <NxCommands commands={['run your-project:agent-chat']} env={{ RUNTIME_CONFIG_APP_ID: '<app-id>' }} />
300
+ </TabItem>
301
+
302
+ <TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
303
+ For Cognito-authenticated agents, provide a Cognito access token via the `AGENT_ACCESS_TOKEN` environment variable, which is sent as a bearer token:
304
+
305
+ <NxCommands commands={['run your-project:agent-chat']} env={{ RUNTIME_CONFIG_APP_ID: '<app-id>', AGENT_ACCESS_TOKEN: '<access-token>' }} />
306
+
307
+ You can obtain an access token using the AWS CLI's `cognito-idp admin-initiate-auth` command, for example:
308
+
309
+ ```bash
310
+ aws cognito-idp admin-initiate-auth \
311
+ --user-pool-id <user-pool-id> \
312
+ --client-id <user-pool-client-id> \
313
+ --auth-flow ADMIN_NO_SRP_AUTH \
314
+ --auth-parameters USERNAME=<username>,PASSWORD=<password> \
315
+ --query 'AuthenticationResult.AccessToken' \
316
+ --output text
317
+ ```
318
+ </TabItem>
319
+ </Tabs>
320
+ </OptionFilter>
277
321
 
278
322
  <OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
279
323
  ## Deploying Your Agent to Bedrock AgentCore Runtime
@@ -292,6 +336,10 @@ The generator configures a `<your-agent-name>-docker` target which copies the `D
292
336
 
293
337
  A `docker` target is also generated which prepares the docker context for all agents if you have multiple defined.
294
338
 
339
+ ### Image Scanning
340
+
341
+ <Snippet name="trivy-image-scan" parentHeading="Image Scanning" />
342
+
295
343
  ### Observability
296
344
 
297
345
  Your agent is automatically configured with observability using the [AWS Distro for Open Telemetry](https://aws.amazon.com/otel/) (ADOT), by configuring auto-instrumentation in your `Dockerfile`.
@@ -318,7 +366,7 @@ import { AgentClient } from '../packages/<project>/src/agent/client.js';
318
366
 
319
367
  const client = AgentClient.local({ url: 'http://localhost:8081/ws' });
320
368
 
321
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, { onData: console.log });
369
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, { onData: console.log });
322
370
  ```
323
371
 
324
372
  :::tip[Quick Testing]
@@ -352,7 +400,7 @@ const client = AgentClient.withIamAuth({
352
400
  agentRuntimeArn: 'arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/my-agent',
353
401
  });
354
402
 
355
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, {
403
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
356
404
  onData: (message) => console.log(message),
357
405
  onError: (error) => console.error(error),
358
406
  onComplete: () => console.log('Done'),
@@ -375,7 +423,7 @@ const client = AgentClient.withJwtAuth({
375
423
  accessTokenProvider: async () => `<access-token>`,
376
424
  });
377
425
 
378
- client.invoke.subscribe({ message: 'what is 1 plus 1?' }, {
426
+ client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
379
427
  onData: console.log,
380
428
  });
381
429
  ```
@@ -434,3 +482,73 @@ To invoke your AG-UI agent from a React website, use the <Link path="/guides/con
434
482
 
435
483
  Refer to the <Link path="/guides/connection/react-agui">`connection` generator guide</Link> for details about how the connection is set up.
436
484
  </OptionFilter>
485
+
486
+ ## Connections
487
+
488
+ Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
489
+
490
+ <CardGrid>
491
+ <ConnectionCard
492
+ title="React to TypeScript Agent"
493
+ description="Call a TypeScript Agent from a React website"
494
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-ts-agent`}
495
+ source="react"
496
+ target="strands"
497
+ targetBadge="typescript"
498
+ />
499
+ <ConnectionCard
500
+ title="React to AG-UI Agent"
501
+ description="Call an Agent exposing the AG-UI protocol from a React website via CopilotKit"
502
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-agui`}
503
+ source="react"
504
+ target="copilotkit"
505
+ />
506
+ <ConnectionCard
507
+ title="TypeScript Agent to MCP"
508
+ description="Connect a TypeScript Agent to an MCP server"
509
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-mcp`}
510
+ source="strands"
511
+ sourceBadge="typescript"
512
+ target="mcp"
513
+ />
514
+ <ConnectionCard
515
+ title="TypeScript Agent to A2A Agent"
516
+ description="Connect a TypeScript Agent to a remote A2A agent"
517
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-a2a`}
518
+ source="strands"
519
+ sourceBadge="typescript"
520
+ target="a2a"
521
+ />
522
+ <ConnectionCard
523
+ title="Python Agent to A2A Agent"
524
+ description="Connect a Python Agent to a remote A2A agent"
525
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-a2a`}
526
+ source="strands"
527
+ sourceBadge="python"
528
+ target="a2a"
529
+ />
530
+ <ConnectionCard
531
+ title="TypeScript Agent to Relational Database"
532
+ description="Connect a TypeScript Agent to an Aurora relational database"
533
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-rdb`}
534
+ source="strands"
535
+ sourceBadge="typescript"
536
+ target="aurora"
537
+ />
538
+ <ConnectionCard
539
+ title="TypeScript Agent to TypeScript DynamoDB"
540
+ description="Connect a TypeScript Agent to a DynamoDB table"
541
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
542
+ source="strands"
543
+ sourceBadge="typescript"
544
+ target="dynamodb"
545
+ />
546
+ <ConnectionCard
547
+ title="TypeScript Agent to AgentCore Gateway"
548
+ description="Connect a TypeScript Agent to an AgentCore Gateway"
549
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-gateway`}
550
+ source="strands"
551
+ sourceBadge="typescript"
552
+ target="agentcore"
553
+ />
554
+ </CardGrid>
@@ -1,23 +1,22 @@
1
1
  ---
2
- title: DynamoDB
3
- description: Create a DynamoDB project
2
+ title: TypeScript DynamoDB
3
+ description: Create a TypeScript DynamoDB project
4
4
  generator: ts#dynamodb
5
5
  ---
6
6
 
7
- import { FileTree } from '@astrojs/starlight/components';
7
+ import { FileTree, CardGrid } from '@astrojs/starlight/components';
8
+ import Astro from '@astrojs/react';
9
+ import ConnectionCard from '@components/connection-card.astro';
8
10
  import Link from '@components/link.astro';
9
11
  import RunGenerator from '@components/run-generator.astro';
10
12
  import GeneratorParameters from '@components/generator-parameters.astro';
11
- import Infrastructure from '@components/infrastructure.astro';
12
- import NxCommands from '@components/nx-commands.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
- import OptionFilter from '@components/option-filter.astro';
15
14
 
16
- This generator creates a new TypeScript project backed by [Amazon DynamoDB](https://aws.amazon.com/dynamodb/), using [ElectroDB](https://electrodb.dev/) for type-safe entity modelling. It generates the application code and infrastructure needed to provision and manage a DynamoDB table using AWS CDK or Terraform, with single-table design support and built-in local development via DynamoDB Local.
15
+ This generator creates a new TypeScript DynamoDB project backed by [Amazon DynamoDB](https://aws.amazon.com/dynamodb/), using [ElectroDB](https://electrodb.dev/) for type-safe entity modelling. It generates the application code and infrastructure needed to provision and manage a DynamoDB table using AWS CDK or Terraform, with single-table design support and built-in local development via DynamoDB Local.
17
16
 
18
17
  ## Usage
19
18
 
20
- ### Generate a DynamoDB Project
19
+ ### Generate a TypeScript DynamoDB Project
21
20
 
22
21
  <RunGenerator generator="ts#dynamodb" />
23
22
 
@@ -30,65 +29,38 @@ This generator creates a new TypeScript project backed by [Amazon DynamoDB](http
30
29
  The generator creates the following project structure in the `<directory>/<name>` directory:
31
30
 
32
31
  <FileTree>
33
- - scripts
34
- - create-local-table.ts Creates the DynamoDB table in the local DynamoDB Local instance
35
- - pull-image.ts Pulls the DynamoDB Local image
36
- - start-container.ts Starts the DynamoDB Local container
37
32
  - src
38
33
  - index.ts Project entry point and exports
39
- - constants.ts Local development constants and runtime config key
40
34
  - client.ts DynamoDB client singleton and table name resolution
41
35
  - entities
42
36
  - example.ts Example ElectroDB entity definition
43
37
  - index.ts Entity exports
38
+ - config.json Table configuration including GSI definitions and local development settings
44
39
  - project.json Project configuration and build targets
45
40
  </FileTree>
46
41
 
42
+ The local development scripts are shared across all DynamoDB projects (both TypeScript and Python) and generated once into:
43
+
44
+ <FileTree>
45
+ - packages/common/scripts/src/dynamodb
46
+ - create-local-table.ts Creates the DynamoDB table in the local DynamoDB Local instance
47
+ - pull-image.ts Pulls the DynamoDB Local image
48
+ - start-container.ts Starts the DynamoDB Local container
49
+ </FileTree>
50
+
47
51
  ### Infrastructure
48
52
 
49
- <Snippet name="shared-constructs" />
50
-
51
- <Infrastructure>
52
- <Fragment slot="cdk">
53
- <FileTree>
54
- - packages/common/constructs/src
55
- - app
56
- - dynamodb
57
- - \<name>.ts Infrastructure specific to your table
58
- - core
59
- - dynamodb.ts Generic DynamoDB table construct
60
- </FileTree>
61
- </Fragment>
62
- <Fragment slot="terraform">
63
- <FileTree>
64
- - packages/common/terraform/src
65
- - app
66
- - dynamodb
67
- - \<name>
68
- - \<name>.tf Module specific to your table
69
- - core
70
- - dynamodb
71
- - dynamodb.tf Generic DynamoDB module
72
- </FileTree>
73
- </Fragment>
74
- </Infrastructure>
53
+ <Snippet name="dynamodb/infrastructure" />
75
54
 
76
55
  ## Local Development
77
56
 
78
57
  ### Starting Local DynamoDB
79
58
 
80
- The generator configures a `serve-local` target that starts a [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) instance and creates the table:
81
-
82
- <NxCommands commands={['run <project-name>:serve-local']} />
83
-
84
- This automatically:
85
- 1. Pulls the DynamoDB Local image (`pull-image` target)
86
- 2. Starts a container
87
- 3. Creates a local table with pre-defined indexes
59
+ <Snippet name="dynamodb/local-dev-start" />
88
60
 
89
61
  ### Data Modelling
90
62
 
91
- The generated project uses [ElectroDB](https://electrodb.dev/) for type-safe entity modelling on a single DynamoDB table. Add or update entity files under `src/entities/`, using the generated example entity as a starting point.
63
+ The generated project uses [ElectroDB](https://electrodb.dev/) for type-safe entity modelling on a single DynamoDB table, following [DynamoDB's single-table design](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/data-modeling-foundations.html). Add or update entity files under `src/entities/`, using the generated example entity as a starting point.
92
64
 
93
65
  Example entity definition:
94
66
 
@@ -146,30 +118,18 @@ For more details, see the [ElectroDB entity documentation](https://electrodb.dev
146
118
 
147
119
  The generated `src/client.ts` exports two key utilities:
148
120
 
149
- - `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `SERVE_LOCAL=true`, connects to the local DynamoDB Local instance; otherwise creates an AWS client using the default credential chain.
150
- - `resolveTableName()` — returns the DynamoDB table name. When `SERVE_LOCAL=true`, returns the local table name constant; otherwise fetches the name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable and caches it for subsequent calls.
121
+ - `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `LOCAL_DEV=true`, connects to the local DynamoDB Local instance; otherwise creates an AWS client using the default credential chain.
122
+ - `resolveTableName()` — returns the DynamoDB table name. When `LOCAL_DEV=true`, returns the local table name constant; otherwise fetches the name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable and caches it for subsequent calls.
151
123
 
152
124
  ### Stopping Local DynamoDB
153
125
 
154
- Stopping `serve-local` (e.g. with `Ctrl+C`) automatically removes the DynamoDB Local container, but preserves the named volume so your data persists across restarts.
155
-
156
- :::caution[Windows]
157
- Due to limitations with signal handling on Windows, the container is not automatically removed when `serve-local` is stopped. You will need to remove it manually:
158
-
159
- ```bash
160
- <engine> rm -f <scope>-dynamodb
161
- ```
162
-
163
- Replace `<engine>` with your container engine (`docker` or `finch`) and `<scope>` with your Nx workspace scope (e.g. `proj`).
164
- :::
126
+ <Snippet name="dynamodb/local-dev-windows" />
165
127
 
166
128
  ## Adding/Removing Global Secondary Indexes
167
129
 
168
- Start by updating `GLOBAL_SECONDARY_INDEXES` in `src/gsi.ts` — this is the source of truth for your GSI definitions, and on the next `serve-local` run the script will automatically add or remove indexes on the local table to reflect the new list. When using CDK, these changes are also automatically reflected in your AWS table on the next deployment.
130
+ GSIs are defined in `config.json` at the project root under the `tableConfig.globalSecondaryIndexes` key. Add an entry for each GSI, following the [single-table design](https://electrodb.dev/en/core-concepts/single-table-relationships/) naming convention for GSI keys:
169
131
 
170
- <OptionFilter when={{ iac: 'terraform' }}>
171
- Unlike CDK, changes to `src/gsi.ts` are not automatically reflected in your Terraform module. You must also manually update your Terraform module to add or remove the corresponding GSI definitions before deploying.
172
- </OptionFilter>
132
+ <Snippet name="dynamodb/gsi-config" parentHeading="Adding/Removing Global Secondary Indexes" />
173
133
 
174
134
  ## Connecting to the Table
175
135
 
@@ -186,179 +146,42 @@ const result = await entity.query.primary({ id: '123' }).go();
186
146
  When running in AWS, `resolveTableName()` fetches the table name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable. Projects built with this plugin (tRPC APIs, Smithy APIs, agents, MCP servers) already have this variable configured automatically. For other TypeScript projects, ensure `RUNTIME_CONFIG_APP_ID` is set in the runtime environment with the AppConfig application ID provisioned by your infrastructure. For more information, see the <Link path="guides/runtime-config">Runtime Configuration guide</Link>.
187
147
  :::
188
148
 
189
- ### Connection Generators
190
-
191
- For specific project types, use the `connection` generator to automatically wire up local development dependencies so DynamoDB Local starts automatically alongside your project:
192
-
193
- - <Link path="guides/connection/trpc-dynamodb">tRPC API → DynamoDB</Link>
194
- - <Link path="guides/connection/smithy-dynamodb">Smithy API → DynamoDB</Link>
195
- - <Link path="guides/connection/ts-agent-dynamodb">TypeScript Agent → DynamoDB</Link>
196
- - <Link path="guides/connection/ts-mcp-server-dynamodb">MCP Server → DynamoDB</Link>
197
-
198
149
  ## Deploying your Table
199
150
 
200
- The DynamoDB generator creates CDK or Terraform infrastructure based on your selected `iac`.
201
-
202
- <Infrastructure>
203
- <Fragment slot="cdk">
204
- The CDK construct is created in `common/constructs`. Example usage:
205
-
206
- ```ts title="packages/infra/src/stacks/application-stack.ts"
207
- import { MyTable } from ':my-scope/common-constructs';
208
-
209
- export class ApplicationStack extends Stack {
210
- constructor(scope: Construct, id: string, props?: StackProps) {
211
- super(scope, id, props);
212
-
213
- const table = new MyTable(this, 'Table');
214
- }
215
- }
216
- ```
217
-
218
- This provisions a DynamoDB table with:
219
- - `pk` (partition key) and `sk` (sort key), both `String` type
220
- - 2 Global Secondary Indexes by default, as defined in `src/gsi.ts`
221
- - On-demand (`PAY_PER_REQUEST`) billing
222
- - Customer-managed KMS encryption with automatic key rotation
223
- - Point-in-time recovery enabled
224
- - Deletion protection enabled
225
- - Table name registered in Runtime Config under the `dynamodb` namespace in AWS AppConfig
226
- </Fragment>
227
- <Fragment slot="terraform">
228
- The Terraform module is created in `common/terraform`. Example usage:
229
-
230
- ```hcl title="packages/infra/src/main.tf"
231
- module "my_table" {
232
- source = "../../common/terraform/src/app/dynamodb/my-table"
233
- }
234
- ```
235
-
236
- This provisions a DynamoDB table with:
237
- - `pk` (partition key) and `sk` (sort key), both `String` type
238
- - 2 Global Secondary Indexes by default, as defined in `src/gsi.ts`
239
- - On-demand (`PAY_PER_REQUEST`) billing
240
- - Customer-managed KMS encryption with automatic key rotation
241
- - Point-in-time recovery enabled
242
- - Deletion protection enabled
243
- - Table name registered in Runtime Config
244
- </Fragment>
245
- </Infrastructure>
246
-
247
- ### Granting Access
248
-
249
- <Snippet name="connection/lambda-dynamodb-access" />
250
-
251
- ### Deletion Protection
252
-
253
- Deletion protection is enabled by default to prevent accidental table deletion.
254
-
255
- #### Disable Deletion Protection
256
-
257
- Disable it for environments where table deletion is expected, such as short-lived development or preview stacks.
258
-
259
- <Infrastructure>
260
- <Fragment slot="cdk">
261
-
262
- ```ts title="packages/infra/src/stacks/application-stack.ts"
263
- import { MyTable } from ':my-scope/common-constructs';
264
-
265
- const table = new MyTable(this, 'Table', {
266
- deletionProtection: false,
267
- });
268
- ```
269
- </Fragment>
270
- <Fragment slot="terraform">
271
-
272
- ```hcl title="packages/infra/src/main.tf"
273
- module "my_table" {
274
- source = "../../common/terraform/src/app/dynamodb/my-table"
275
- deletion_protection_enabled = false
276
- }
277
- ```
278
- </Fragment>
279
- </Infrastructure>
280
-
281
- ### Billing Mode
282
-
283
- The table defaults to on-demand (`PAY_PER_REQUEST`) billing. Switch to provisioned capacity for predictable, high-throughput workloads.
284
-
285
- <Infrastructure>
286
- <Fragment slot="cdk">
287
-
288
- ```ts title="packages/infra/src/stacks/application-stack.ts"
289
- import { BillingMode } from 'aws-cdk-lib/aws-dynamodb';
290
- import { MyTable } from ':my-scope/common-constructs';
291
-
292
- const table = new MyTable(this, 'Table', {
293
- billingMode: BillingMode.PROVISIONED,
294
- readCapacity: 5,
295
- writeCapacity: 5,
296
- });
297
- ```
298
- </Fragment>
299
- <Fragment slot="terraform">
300
-
301
- ```hcl title="packages/infra/src/main.tf"
302
- module "my_table" {
303
- source = "../../common/terraform/src/app/dynamodb/my-table"
304
- billing_mode = "PROVISIONED"
305
- }
306
- ```
307
- </Fragment>
308
- </Infrastructure>
309
-
310
- ### Point-in-time Recovery
311
-
312
- [Point-in-time recovery](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Point-in-time-recovery.html) is enabled by default, allowing you to restore the table to any point in the last 35 days.
313
-
314
- #### Disable Point-in-time Recovery
315
-
316
- <Infrastructure>
317
- <Fragment slot="cdk">
318
-
319
- ```ts title="packages/infra/src/stacks/application-stack.ts"
320
- import { MyTable } from ':my-scope/common-constructs';
321
-
322
- const table = new MyTable(this, 'Table', {
323
- pointInTimeRecoverySpecification: { pointInTimeRecoveryEnabled: false },
324
- });
325
- ```
326
- </Fragment>
327
- <Fragment slot="terraform">
328
-
329
- ```hcl title="packages/infra/src/main.tf"
330
- module "my_table" {
331
- source = "../../common/terraform/src/app/dynamodb/my-table"
332
- point_in_time_recovery_enabled = false
333
- }
334
- ```
335
- </Fragment>
336
- </Infrastructure>
337
-
338
- ### Encryption Key Rotation
339
-
340
- The KMS key used to encrypt the table has automatic key rotation enabled by default. Disable it if your security policy manages rotation externally.
341
-
342
- #### Disable Encryption Key Rotation
343
-
344
- <Infrastructure>
345
- <Fragment slot="cdk">
346
-
347
- ```ts title="packages/infra/src/stacks/application-stack.ts"
348
- import { MyTable } from ':my-scope/common-constructs';
349
-
350
- const table = new MyTable(this, 'Table', {
351
- enableKeyRotation: false,
352
- });
353
- ```
354
- </Fragment>
355
- <Fragment slot="terraform">
356
-
357
- ```hcl title="packages/infra/src/main.tf"
358
- module "my_table" {
359
- source = "../../common/terraform/src/app/dynamodb/my-table"
360
- enable_key_rotation = false
361
- }
362
- ```
363
- </Fragment>
364
- </Infrastructure>
151
+ <Snippet name="dynamodb/deploying-table" parentHeading="Deploying your Table" />
152
+
153
+ ## Connections
154
+
155
+ Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
156
+
157
+ <CardGrid>
158
+ <ConnectionCard
159
+ title="tRPC API to TypeScript DynamoDB"
160
+ description="Connect a tRPC API to a DynamoDB table"
161
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
162
+ source="trpc"
163
+ target="dynamodb"
164
+ />
165
+ <ConnectionCard
166
+ title="Smithy API to TypeScript DynamoDB"
167
+ description="Connect a Smithy API to a DynamoDB table"
168
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/smithy-dynamodb`}
169
+ source="smithy"
170
+ target="dynamodb"
171
+ />
172
+ <ConnectionCard
173
+ title="TypeScript Agent to TypeScript DynamoDB"
174
+ description="Connect a TypeScript Agent to a DynamoDB table"
175
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
176
+ source="strands"
177
+ sourceBadge="typescript"
178
+ target="dynamodb"
179
+ />
180
+ <ConnectionCard
181
+ title="MCP Server to TypeScript DynamoDB"
182
+ description="Connect a TypeScript MCP Server to a DynamoDB table"
183
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
184
+ source="mcp"
185
+ target="dynamodb"
186
+ />
187
+ </CardGrid>
@@ -4,7 +4,9 @@ description: Generate a TypeScript Model Context Protocol (MCP) server for provi
4
4
  generator: ts#mcp-server
5
5
  ---
6
6
 
7
- import { FileTree } from '@astrojs/starlight/components';
7
+ import { FileTree, CardGrid } from '@astrojs/starlight/components';
8
+ import Astro from '@astrojs/react';
9
+ import ConnectionCard from '@components/connection-card.astro';
8
10
  import RunGenerator from '@components/run-generator.astro';
9
11
  import NxCommands from '@components/nx-commands.astro';
10
12
  import Link from '@components/link.astro';
@@ -54,7 +56,6 @@ The generator will add the following files to your existing TypeScript project:
54
56
  - resources/
55
57
  - sample-guidance.ts Sample resource
56
58
  - Dockerfile Entry point for hosting your MCP server (excluded when `infra` is set to `None`)
57
- - package.json Updated with bin entry and MCP dependencies
58
59
  - project.json Updated with MCP server serve target
59
60
  </FileTree>
60
61
 
@@ -120,14 +121,28 @@ server.registerResource('dynamic-resource', 'dynamic://resource', {}, async (uri
120
121
 
121
122
  ## Running Your MCP Server
122
123
 
124
+ ### Local Development
125
+
126
+ To run your MCP server (and everything connected to it, such as a local database) locally, use the project's `dev` target:
127
+
128
+ <NxCommands commands={['dev your-project']} />
129
+
130
+ If you have added multiple components to your project (MCP servers, agents, etc.), this starts them all. To run just this MCP server, target its `<your-server-name>-dev` target:
131
+
132
+ <NxCommands commands={['your-server-name-dev your-project']} />
133
+
123
134
  ### Inspector
124
135
 
125
- The generator configures a target named `<your-server-name>-inspect`, which starts the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) with the configuration to connect to your MCP server using STDIO transport.
136
+ The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-dev` target, including any connected dependencies such as a local database) and launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) pre-configured to connect to it over Streamable HTTP transport.
126
137
 
127
138
  <NxCommands commands={['your-server-name-inspect your-project']} />
128
139
 
129
140
  This will start the inspector at `http://localhost:6274`. Get started by clicking on the "Connect" button.
130
141
 
142
+ :::tip
143
+ To inspect the server using STDIO transport instead, use the `<your-server-name>-inspect-stdio` target, which launches the inspector against a STDIO instance of your server.
144
+ :::
145
+
131
146
  ### STDIO
132
147
 
133
148
  The easiest way to test and use an MCP server is by using the inspector or configuring it with an AI assistant (as above).
@@ -163,7 +178,55 @@ The generator configures a `<your-server-name>-docker` target which copies the `
163
178
 
164
179
  A `docker` target is also generated which prepares the docker context for all MCP servers if you have multiple defined.
165
180
 
181
+ ### Image Scanning
182
+
183
+ <Snippet name="trivy-image-scan" parentHeading="Image Scanning" />
184
+
166
185
  ### Observability
167
186
 
168
187
  <Snippet name="mcp/observability" parentHeading="Observability" />
169
188
  </OptionFilter>
189
+
190
+ ## Connections
191
+
192
+ Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
193
+
194
+ <CardGrid>
195
+ <ConnectionCard
196
+ title="TypeScript Agent to MCP"
197
+ description="Connect a TypeScript Agent to an MCP server"
198
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-mcp`}
199
+ source="strands"
200
+ sourceBadge="typescript"
201
+ target="mcp"
202
+ />
203
+ <ConnectionCard
204
+ title="Python Agent to MCP"
205
+ description="Connect a Python Agent to an MCP server"
206
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-mcp`}
207
+ source="strands"
208
+ sourceBadge="python"
209
+ target="mcp"
210
+ />
211
+ <ConnectionCard
212
+ title="MCP Server to Relational Database"
213
+ description="Connect a TypeScript MCP Server to an Aurora relational database"
214
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-rdb`}
215
+ source="mcp"
216
+ target="aurora"
217
+ />
218
+ <ConnectionCard
219
+ title="MCP Server to TypeScript DynamoDB"
220
+ description="Connect a TypeScript MCP Server to a DynamoDB table"
221
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
222
+ source="mcp"
223
+ target="dynamodb"
224
+ />
225
+ <ConnectionCard
226
+ title="AgentCore Gateway to MCP Server"
227
+ description="Aggregate an MCP server behind an AgentCore Gateway"
228
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-mcp`}
229
+ source="agentcore"
230
+ target="mcp"
231
+ />
232
+ </CardGrid>
@@ -46,7 +46,7 @@ The generator will create the following project structure:
46
46
  - generator-guide.ts Tool for detailed generator information
47
47
  - utils.ts Utility functions for the MCP server
48
48
  - generators.json Nx generator configuration (initially empty)
49
- - package.json Plugin package configuration with MCP server binary
49
+ - package.json Plugin package configuration
50
50
  - tsconfig.json TypeScript configuration (CommonJS for Nx compatibility)
51
51
  - project.json Nx project configuration with build and package targets
52
52
  </FileTree>