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

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 (121) hide show
  1. package/bin/aws-nx-mcp.js +4312 -3360
  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/bedrock-deployment.mdx +4 -0
  50. package/docs/snippets/api/access-logging.mdx +33 -0
  51. package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
  52. package/docs/snippets/api/waf-configuration.mdx +1 -1
  53. package/docs/snippets/connection/dynamodb-local-development.mdx +7 -0
  54. package/docs/snippets/connection/lambda-dynamodb-access.mdx +80 -0
  55. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  56. package/docs/snippets/dynamodb/deploying-table.mdx +171 -0
  57. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  58. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  59. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  60. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  61. package/docs/snippets/mcp/bedrock-deployment.mdx +4 -0
  62. package/docs/snippets/mcp/config.mdx +2 -1
  63. package/docs/snippets/required-prerequisites.mdx +1 -1
  64. package/generators.json +100 -1
  65. package/package.json +1 -1
  66. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  67. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  68. package/src/agentcore-gateway/schema.json +70 -0
  69. package/src/connection/schema.json +5 -0
  70. package/src/infra/app/schema.json +5 -0
  71. package/src/license/schema.json +11 -0
  72. package/src/preset/schema.json +10 -5
  73. package/src/py/agent/a2a-connection/schema.json +5 -0
  74. package/src/py/agent/gateway-connection/schema.json +31 -0
  75. package/src/py/agent/mcp-connection/schema.json +5 -0
  76. package/src/py/agent/react-connection/schema.json +5 -0
  77. package/src/py/agent/schema.json +6 -1
  78. package/src/py/api/schema.json +5 -0
  79. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  80. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  81. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  82. package/src/py/dynamodb/schema.json +75 -0
  83. package/src/py/fast-api/react/schema.json +5 -0
  84. package/src/py/fast-api/schema.json +5 -0
  85. package/src/py/lambda-function/schema.json +5 -0
  86. package/src/py/mcp-server/schema.json +5 -0
  87. package/src/py/project/schema.json +5 -0
  88. package/src/smithy/project/schema.json +5 -0
  89. package/src/smithy/react-connection/schema.json +5 -0
  90. package/src/smithy/ts/api/schema.json +5 -0
  91. package/src/terraform/project/schema.json +5 -0
  92. package/src/trpc/backend/schema.json +5 -0
  93. package/src/trpc/react/schema.json +5 -0
  94. package/src/ts/agent/a2a-connection/schema.json +5 -0
  95. package/src/ts/agent/gateway-connection/schema.json +31 -0
  96. package/src/ts/agent/mcp-connection/schema.json +5 -0
  97. package/src/ts/agent/react-connection/schema.json +5 -0
  98. package/src/ts/agent/schema.json +5 -0
  99. package/src/ts/api/schema.json +5 -0
  100. package/src/ts/astro-docs/schema.json +3 -3
  101. package/src/ts/docs/schema.json +3 -3
  102. package/src/ts/dynamodb/agent-connection/schema.json +27 -0
  103. package/src/ts/dynamodb/mcp-server-connection/schema.json +27 -0
  104. package/src/ts/dynamodb/schema.json +75 -0
  105. package/src/ts/dynamodb/smithy-connection/schema.json +23 -0
  106. package/src/ts/dynamodb/trpc-connection/schema.json +23 -0
  107. package/src/ts/lambda-function/schema.json +5 -0
  108. package/src/ts/lib/schema.json +5 -0
  109. package/src/ts/mcp-server/schema.json +5 -0
  110. package/src/ts/nx-generator/schema.json +5 -0
  111. package/src/ts/nx-plugin/schema.json +5 -0
  112. package/src/ts/rdb/agent-connection/schema.json +5 -0
  113. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  114. package/src/ts/rdb/schema.json +5 -0
  115. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  116. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  117. package/src/ts/react-website/app/schema.json +11 -6
  118. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  119. package/src/ts/react-website/runtime-config/schema.json +5 -0
  120. package/src/ts/website/app/schema.json +11 -6
  121. package/src/ts/website/auth/schema.json +5 -0
@@ -0,0 +1,141 @@
1
+ ---
2
+ title: TypeScript Agent to Gateway
3
+ description: Connect a TypeScript Agent to an AgentCore Gateway
4
+ when:
5
+ sourceType: ts#agent
6
+ targetType: agentcore-gateway
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 Infrastructure from '@components/infrastructure.astro';
14
+
15
+ The `connection` generator can connect your <Link path="guides/ts-agent">TypeScript Agent</Link> to an <Link path="guides/agentcore-gateway">AgentCore Gateway</Link>.
16
+
17
+ The generator wires the agent so it authenticates to the Gateway with IAM SigV4 when deployed, and connects to the local gateway started by the Gateway project when running locally.
18
+
19
+ ## Prerequisites
20
+
21
+ Before using this generator, ensure you have:
22
+
23
+ 1. A TypeScript project with a <Link path="guides/ts-agent">Agent</Link> component (`infra: agentcore`)
24
+ 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
25
+
26
+ ## Usage
27
+
28
+ ### Run the Generator
29
+
30
+ <RunGenerator generator="connection" />
31
+
32
+ Select the agent project as the source and the Gateway project as the target.
33
+
34
+ ### Options
35
+
36
+ <GeneratorParameters generator="connection" />
37
+
38
+ ## Generator Output
39
+
40
+ The generator emits shared core client files into your `agent-connection` package, plus a per-Gateway wrapper, and modifies your agent:
41
+
42
+ <FileTree>
43
+
44
+ - packages/common/agent-connection
45
+ - src
46
+ - core/
47
+ - agentcore-endpoints.ts Framework-agnostic ARN/URL resolution
48
+ - agentcore-gateway-mcp-transport.ts Framework-agnostic Gateway MCP transport
49
+ - agentcore-gateway-mcp-client-strands.ts Strands MCP client for the deployed Gateway
50
+ - app/
51
+ - \<gateway-kebab>-client-strands.ts Per-Gateway Strands client wrapper
52
+ - index.ts Re-exports the Gateway client
53
+
54
+ </FileTree>
55
+
56
+ Additionally, the generator:
57
+
58
+ - Modifies your agent's `agent.ts` to import the Gateway client class, call `<Gateway>ClientStrands.create()`, and register the returned client in the `tools` array
59
+ - Wires the agent's `<agent>-dev` target to depend on the Gateway's `dev` target
60
+ - Installs the required SigV4 / MCP dependencies
61
+
62
+ ## Using the connected Gateway
63
+
64
+ The generator transforms your agent's `agent.ts` to use the Gateway client:
65
+
66
+ ```ts title="packages/example/src/my-agent/agent.ts" {2,5,8}
67
+ import { Agent } from '@strands-agents/sdk';
68
+ import { MyGatewayClientStrands } from ':my-scope/agent-connection';
69
+
70
+ export const getAgent = async () => {
71
+ const myGateway = await MyGatewayClientStrands.create();
72
+ return new Agent({
73
+ systemPrompt: '...',
74
+ tools: [myGateway],
75
+ });
76
+ };
77
+ ```
78
+
79
+ When deployed (`LOCAL_DEV` unset), the client points at the Gateway's MCP endpoint and authenticates with SigV4. When `LOCAL_DEV=true`, it points at the local gateway started by the Gateway project's `dev` target, so the same `agent.ts` works uniformly in both modes.
80
+
81
+ The session ID is propagated to downstream MCP servers automatically via the `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id` header.
82
+
83
+ ## Infrastructure
84
+
85
+ After running the generator you must grant the agent permission to invoke the Gateway.
86
+
87
+ <Infrastructure>
88
+ <Fragment slot="cdk">
89
+ ```ts title="packages/infra/src/stacks/application-stack.ts" {5}
90
+ const gateway = new MyGateway(this, 'MyGateway');
91
+ const myAgent = new MyAgent(this, 'MyAgent');
92
+
93
+ // Grant the agent permissions to invoke the Gateway
94
+ gateway.grantInvokeAccess(myAgent);
95
+ ```
96
+
97
+ The Gateway URL is automatically registered in the `agentcore.gateways.<ClassName>` namespace of <Link path="guides/runtime-config">Runtime Configuration</Link> by the generated CDK construct, so the agent can discover it at runtime.
98
+ </Fragment>
99
+ <Fragment slot="terraform">
100
+ ```hcl title="packages/infra/src/main.tf" {6-13}
101
+ module "my_gateway" {
102
+ source = "../../common/terraform/src/app/gateways/my-gateway"
103
+ }
104
+
105
+ module "my_agent" {
106
+ source = "../../common/terraform/src/app/agents/my-agent"
107
+
108
+ # Grant the agent permission to invoke the Gateway
109
+ additional_iam_policy_statements = [{
110
+ Effect = "Allow"
111
+ Action = ["bedrock-agentcore:InvokeGateway"]
112
+ Resource = [module.my_gateway.gateway_arn]
113
+ }]
114
+ }
115
+ ```
116
+
117
+ The Gateway URL is automatically registered in the `agentcore.gateways.<ClassName>` namespace of <Link path="guides/runtime-config">Runtime Configuration</Link> by the generated Terraform module, so the agent can discover it at runtime.
118
+ </Fragment>
119
+ </Infrastructure>
120
+
121
+ ## Local Development
122
+
123
+ The generator configures the agent's `dev` target to:
124
+
125
+ 1. Start the connected Gateway's local gateway and every attached MCP server
126
+ 2. Set `LOCAL_DEV=true` so the generated client points at the local gateway instead of the deployed Gateway
127
+
128
+ Run the agent locally with:
129
+
130
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
131
+
132
+ To run the agent locally **against the deployed Gateway** instead (for example, to exercise Cedar policies), use the agent's `serve` target. Without `LOCAL_DEV` set, the client resolves the deployed Gateway URL from runtime configuration and SigV4-signs requests with your local AWS credentials:
133
+
134
+ <NxCommands commands={["<agent-name>-serve <project-name>"]} />
135
+
136
+ ### Local fidelity
137
+
138
+ The local gateway stands in for the deployed Gateway, so:
139
+
140
+ - **No Cedar policy evaluation.** Every tool is visible to the agent regardless of policies. Use the `serve` target to exercise policies against the deployed Gateway.
141
+ - **Tool-name prefixing is preserved.** Each local MCP server's tools are wrapped to expose names of the form `<target-name>___<tool-name>`, matching what the deployed Gateway emits. This keeps an agent's system prompt and the Cedar action names you reference consistent across local and deployed runs.
@@ -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
- - \<mcp-server-name>-client.ts High-level client for the connected MCP server
50
+ - \<mcp-server-name>-client-strands.ts High-level Strands client for the connected MCP server
51
51
  - core
52
- - agentcore-mcp-client.ts Low-level AgentCore MCP client with SigV4/JWT authentication
52
+ - agentcore-endpoints.ts Framework-agnostic ARN/URL resolution
53
+ - agentcore-fetch.ts Framework-agnostic SigV4 / JWT / session-forwarding fetch
54
+ - agentcore-mcp-transport.ts Framework-agnostic MCP transport
55
+ - agentcore-mcp-client-strands.ts Strands MCP client wrapping the transport
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 import and use the MCP server's tools
61
- - Updates the agent's `serve-local` target to depend on the MCP server's serve target
64
+ - Updates the agent's `dev` target to depend on the MCP server's serve target
62
65
  - Installs required dependencies
63
66
 
64
67
  ## Using the Connected MCP Server
@@ -67,10 +70,10 @@ The generator transforms your agent's `agent.ts` to use the MCP server's tools:
67
70
 
68
71
  ```ts title="packages/example/src/my-agent/agent.ts" {2,5,8}
69
72
  import { Agent, tool } from '@strands-agents/sdk';
70
- import { MyMcpServerClient } from ':my-scope/agent-connection';
73
+ import { MyMcpServerClientStrands } from ':my-scope/agent-connection';
71
74
 
72
75
  export const getAgent = async (sessionId: string) => {
73
- const myMcpServerClient = await MyMcpServerClient.create(sessionId);
76
+ const myMcpServerClient = await MyMcpServerClientStrands.create(sessionId);
74
77
  return new Agent({
75
78
  systemPrompt: '...',
76
79
  tools: [myMcpServerClient],
@@ -133,12 +136,12 @@ The MCP server's AgentCore runtime ARN is automatically registered in the `agent
133
136
 
134
137
  ## Local Development
135
138
 
136
- The generator configures the agent's `serve-local` target to:
139
+ The generator configures the agent's `dev` target to:
137
140
  1. Start the connected MCP server(s) automatically
138
- 2. Set `SERVE_LOCAL=true` so the generated client uses direct HTTP transport instead of AgentCore
141
+ 2. Set `LOCAL_DEV=true` so the generated client uses direct HTTP transport instead of AgentCore
139
142
 
140
143
  Run the agent locally with:
141
144
 
142
- <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
145
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
143
146
 
144
147
  This will start both the agent and all connected MCP servers, with the agent connecting to the MCP servers directly via HTTP on their assigned local ports.
@@ -46,7 +46,7 @@ The generator modifies two files in your agent's source directory:
46
46
 
47
47
  </FileTree>
48
48
 
49
- Additionally, the agent's `<agent-name>-serve-local` target is updated to depend on the database's `serve-local` target.
49
+ Additionally, the agent's `<agent-name>-dev` target is updated to depend on the database's `dev` target.
50
50
 
51
51
  ## How It Works
52
52
 
@@ -136,6 +136,6 @@ Ensure the agent's execution role has `rds-db:connect` permission and that its s
136
136
 
137
137
  ## Local Development
138
138
 
139
- <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
139
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
140
140
 
141
- This starts the agent and all connected databases. The `SERVE_LOCAL=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
141
+ This starts the agent and all connected databases. The `LOCAL_DEV=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: MCP Server to DynamoDB
3
+ description: Connect a TypeScript MCP Server to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: ts#mcp-server
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-mcp-server">TypeScript MCP Server</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-mcp-server">`ts#mcp-server`</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 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.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates the MCP server's `<mcp-server-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 Tools
41
+
42
+ Import entity factories from the DynamoDB package and use them inside `createServer`:
43
+
44
+ ```ts title="packages/my-service/src/my-mcp/server.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+
47
+ export const createServer = async () => {
48
+ const server = new McpServer({ name: 'my-service', version: '1.0.0' });
49
+
50
+ server.tool('list_examples', 'List all example items', {}, async () => {
51
+ const entity = await createExampleEntity();
52
+ const result = await entity.scan.go();
53
+ return {
54
+ content: [{ type: 'text', text: JSON.stringify(result.data) }],
55
+ };
56
+ });
57
+
58
+ return server;
59
+ };
60
+ ```
61
+
62
+ ## Infrastructure
63
+
64
+ To allow the MCP server to access the DynamoDB table, grant the necessary permissions in your infrastructure.
65
+
66
+ <Infrastructure>
67
+ <Fragment slot="cdk">
68
+
69
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
70
+ import { MyTable } from ':my-scope/common-constructs';
71
+
72
+ const table = new MyTable(this, 'Table');
73
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
74
+
75
+ table.grantReadWriteData(myMcpServer);
76
+ ```
77
+
78
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the MCP server's execution role.
79
+ </Fragment>
80
+ <Fragment slot="terraform">
81
+
82
+ ```hcl title="packages/infra/src/main.tf"
83
+ module "my_table" {
84
+ source = "../../common/terraform/src/app/dynamodb/my-table"
85
+ }
86
+
87
+ resource "aws_iam_role_policy" "dynamodb_access" {
88
+ role = module.my_mcp_server.lambda_role_name
89
+
90
+ policy = jsonencode({
91
+ Version = "2012-10-17"
92
+ Statement = [
93
+ {
94
+ Effect = "Allow"
95
+ Action = [
96
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
97
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
98
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
99
+ ]
100
+ Resource = [
101
+ module.my_table.table_arn,
102
+ "${module.my_table.table_arn}/index/*",
103
+ ]
104
+ },
105
+ {
106
+ Effect = "Allow"
107
+ Action = [
108
+ "kms:Encrypt",
109
+ "kms:Decrypt",
110
+ "kms:ReEncrypt*",
111
+ "kms:GenerateDataKey*",
112
+ "kms:DescribeKey",
113
+ ]
114
+ Resource = [module.my_table.kms_key_arn]
115
+ },
116
+ ]
117
+ })
118
+ }
119
+ ```
120
+ </Fragment>
121
+ </Infrastructure>
122
+
123
+ ## Local Development
124
+
125
+ <Snippet name="connection/dynamodb-local-development" />
@@ -46,7 +46,7 @@ The generator modifies two files in your MCP server's source directory:
46
46
 
47
47
  </FileTree>
48
48
 
49
- Additionally, the `<mcp-server-name>-serve-local` target is updated to depend on the database's `serve-local` target.
49
+ Additionally, the `<mcp-server-name>-dev` target is updated to depend on the database's `dev` target.
50
50
 
51
51
  ## How It Works
52
52
 
@@ -130,6 +130,6 @@ Ensure the MCP server's execution role has `rds-db:connect` permission and that
130
130
 
131
131
  ## Local Development
132
132
 
133
- <NxCommands commands={["<mcp-server-name>-serve-local <project-name>"]} />
133
+ <NxCommands commands={["<mcp-server-name>-dev <project-name>"]} />
134
134
 
135
- This starts the MCP server and all connected databases. The `SERVE_LOCAL=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
135
+ This starts the MCP server and all connected databases. The `LOCAL_DEV=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
@@ -6,9 +6,21 @@ import Astro from '@astrojs/react';
6
6
  import { CardGrid, LinkButton } from '@astrojs/starlight/components';
7
7
  import Link from '@components/link.astro';
8
8
  import ConnectionCard from '@components/connection-card.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
9
11
 
10
12
  This generator is used to connect projects together, such as websites calling APIs. Simply select the source project (for example the project that will call your API) and target project (for example your API project), and this generator will handle integrating the two.
11
13
 
14
+ ## Usage
15
+
16
+ ### Run the Generator
17
+
18
+ <RunGenerator generator="connection" />
19
+
20
+ ### Options
21
+
22
+ <GeneratorParameters generator="connection" />
23
+
12
24
  ### Supported Connections
13
25
 
14
26
  The Connection generator supports the following connections:
@@ -119,8 +131,97 @@ The Connection generator supports the following connections:
119
131
  source="mcp"
120
132
  target="aurora"
121
133
  />
134
+ <ConnectionCard
135
+ title="tRPC API to TypeScript DynamoDB"
136
+ description="Connect a tRPC API to a DynamoDB table"
137
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
138
+ source="trpc"
139
+ target="dynamodb"
140
+ />
141
+ <ConnectionCard
142
+ title="Smithy API to TypeScript DynamoDB"
143
+ description="Connect a Smithy API to a DynamoDB table"
144
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/smithy-dynamodb`}
145
+ source="smithy"
146
+ target="dynamodb"
147
+ />
148
+ <ConnectionCard
149
+ title="TypeScript Agent to TypeScript DynamoDB"
150
+ description="Connect a TypeScript Agent to a DynamoDB table"
151
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
152
+ source="strands"
153
+ sourceBadge="typescript"
154
+ target="dynamodb"
155
+ />
156
+ <ConnectionCard
157
+ title="MCP Server to TypeScript DynamoDB"
158
+ description="Connect a TypeScript MCP Server to a DynamoDB table"
159
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
160
+ source="mcp"
161
+ target="dynamodb"
162
+ />
163
+ <ConnectionCard
164
+ title="FastAPI to Python DynamoDB"
165
+ description="Connect a FastAPI to a DynamoDB table"
166
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-fast-api-dynamodb`}
167
+ source="fastapi"
168
+ target="dynamodb"
169
+ targetBadge="python"
170
+ />
171
+ <ConnectionCard
172
+ title="Python Agent to Python DynamoDB"
173
+ description="Connect a Python Agent to a DynamoDB table"
174
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-dynamodb`}
175
+ source="strands"
176
+ sourceBadge="python"
177
+ target="dynamodb"
178
+ targetBadge="python"
179
+ />
180
+ <ConnectionCard
181
+ title="Python MCP Server to Python DynamoDB"
182
+ description="Connect a Python MCP Server to a DynamoDB table"
183
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-mcp-server-dynamodb`}
184
+ source="mcp"
185
+ sourceBadge="python"
186
+ target="dynamodb"
187
+ targetBadge="python"
188
+ />
189
+ <ConnectionCard
190
+ title="AgentCore Gateway to MCP Server"
191
+ description="Aggregate an MCP server behind an AgentCore Gateway"
192
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-mcp`}
193
+ source="agentcore"
194
+ target="mcp"
195
+ />
196
+ <ConnectionCard
197
+ title="AgentCore Gateway to AgentCore Gateway"
198
+ description="Aggregate an AgentCore Gateway behind another AgentCore Gateway"
199
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-gateway`}
200
+ source="agentcore"
201
+ target="agentcore"
202
+ />
203
+ <ConnectionCard
204
+ title="TypeScript Agent to AgentCore Gateway"
205
+ description="Connect a TypeScript Agent to an AgentCore Gateway"
206
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-gateway`}
207
+ source="strands"
208
+ sourceBadge="typescript"
209
+ target="agentcore"
210
+ />
211
+ <ConnectionCard
212
+ title="Python Agent to AgentCore Gateway"
213
+ description="Connect a Python Agent to an AgentCore Gateway"
214
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-gateway`}
215
+ source="strands"
216
+ sourceBadge="python"
217
+ target="agentcore"
218
+ />
122
219
  </CardGrid>
123
220
 
124
221
  :::note[Runtime Configuration]
125
222
  The connection generator makes use of <Link path="guides/runtime-config">Runtime Configuration</Link> to pass deploy-time values (such as API URLs, Cognito settings, and agent runtime ARNs) between generated projects and components at runtime so they can discover and connect to one another.
126
223
  :::
224
+
225
+ :::tip[Local Development]
226
+ Connected projects can be run on your machine with the `serve` and `dev` targets. See the <Link path="guides/local-development">Local Development</Link> guide for details.
227
+ :::
@@ -8,7 +8,7 @@ import NxCommands from '@components/nx-commands.astro';
8
8
  import Link from '@components/link.astro';
9
9
  import Infrastructure from '@components/infrastructure.astro';
10
10
 
11
- Several generators (such as <Link path="/guides/ts-agent">`ts#agent`</Link> and <Link path="/guides/py-agent">`py#agent`</Link>) produce a Docker image that is pushed to Amazon ECR and consumed by AWS infrastructure. This guide describes the pattern they follow so that you can apply it to other use cases — for example, running a <Link path="/guides/fastapi">`py#fast-api`</Link> project on Amazon ECS, or deploying a containerised Express server.
11
+ Several generators (such as <Link path="/guides/ts-agent">`ts#agent`</Link> and <Link path="/guides/py-agent">`py#agent`</Link>) produce a Docker image that is pushed to Amazon ECR and consumed by AWS infrastructure. This guide describes the pattern they follow so that you can apply it to other use cases — for example, running a <Link path="/guides/fastapi">FastAPI</Link> project on Amazon ECS, or deploying a containerised Express server.
12
12
 
13
13
  :::tip[Docker or Finch]
14
14
  The container engine used to build images is chosen at workspace creation time via the `--containerEngine` flag (`docker`, `finch`, or `infer` — the default — which auto-detects what's installed). [Finch](https://runfinch.com/) is an open-source, drop-in alternative to Docker. The selection is recorded in `aws-nx-plugin.config.mts` and applied to every generator that emits container build commands. CDK image asset builds honour the choice via the `CDK_DOCKER` environment variable.
@@ -318,8 +318,8 @@ Terraform's AWS provider does not have a first-class "build and push a Docker im
318
318
 
319
319
  1. The project's `build` target runs `docker build`, producing a local image tagged `my-scope-my-project:latest`.
320
320
  2. An `aws_ecr_repository` to hold the image.
321
- 3. A `null_resource` with a `local-exec` provisioner that authenticates to ECR, re-tags the locally-built image, and pushes it.
322
- 4. The downstream resource (e.g. `aws_ecs_task_definition`) references `"${aws_ecr_repository.repo.repository_url}:latest"`.
321
+ 3. A `null_resource` with a `local-exec` provisioner that authenticates to ECR, re-tags the locally-built image with its content digest, and pushes it.
322
+ 4. The downstream resource (e.g. `aws_ecs_task_definition`) references the image by its immutable, digest-based tag.
323
323
 
324
324
  ```d2
325
325
  direction: down
@@ -361,7 +361,7 @@ infra.repo -> ecr
361
361
  ```hcl
362
362
  resource "aws_ecr_repository" "repo" {
363
363
  name = "my-project-repository"
364
- image_tag_mutability = "MUTABLE"
364
+ image_tag_mutability = "IMMUTABLE"
365
365
  force_delete = true
366
366
  }
367
367
 
@@ -370,24 +370,30 @@ data "external" "docker_digest" {
370
370
  program = ["sh", "-c", "echo '{\"digest\":\"'$(docker inspect my-scope-my-project:latest --format '{{.Id}}')'\"}'"]
371
371
  }
372
372
 
373
+ locals {
374
+ # Content-based, immutable image tag derived from the local image digest
375
+ image_tag = replace(data.external.docker_digest.result.digest, "sha256:", "")
376
+ }
377
+
373
378
  resource "null_resource" "docker_publish" {
374
379
  triggers = {
375
380
  docker_digest = data.external.docker_digest.result.digest
376
381
  repository_url = aws_ecr_repository.repo.repository_url
382
+ image_tag = local.image_tag
377
383
  }
378
384
 
379
385
  provisioner "local-exec" {
380
386
  command = <<-EOT
381
387
  aws ecr get-login-password --region ${data.aws_region.current.id} \
382
388
  | docker login --username AWS --password-stdin ${self.triggers.repository_url}
383
- docker tag my-scope-my-project:latest ${self.triggers.repository_url}:latest
384
- docker push ${self.triggers.repository_url}:latest
389
+ docker tag my-scope-my-project:latest ${self.triggers.repository_url}:${self.triggers.image_tag}
390
+ docker push ${self.triggers.repository_url}:${self.triggers.image_tag}
385
391
  EOT
386
392
  }
387
393
  }
388
394
  ```
389
395
 
390
- The `data.external.docker_digest` block ensures the `null_resource` re-runs whenever the local image hash changes, triggering a new push on every meaningful code change.
396
+ The `data.external.docker_digest` block ensures the `null_resource` re-runs whenever the local image hash changes, triggering a new push on every meaningful code change. The image is pushed under an immutable, content-based tag derived from its digest, so the ECR repository can use `IMMUTABLE` tag mutability and reject any attempt to overwrite an existing tag.
391
397
 
392
398
  :::note[Running bundle before apply]
393
399
  `nx apply <project>` requires the image tag `my-scope-my-project:latest` to already exist locally. Run `nx build my-project` (or `nx docker my-project`) before `nx apply <project>`.