@aws/nx-plugin-mcp 1.0.0-rc.9 → 1.0.0-rc.90

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 (200) hide show
  1. package/bin/aws-nx-mcp.js +14263 -13571
  2. package/docs/get_started/building-with-ai.mdx +116 -0
  3. package/docs/get_started/concepts.mdx +67 -0
  4. package/docs/get_started/existing-project.mdx +180 -0
  5. package/docs/get_started/graph-builder.mdx +39 -0
  6. package/docs/get_started/quick-start.mdx +277 -0
  7. package/docs/get_started/tutorials/contribute-generator.mdx +408 -0
  8. package/docs/get_started/tutorials/dungeon-game/1.mdx +1578 -0
  9. package/docs/get_started/tutorials/dungeon-game/2.mdx +245 -0
  10. package/docs/get_started/tutorials/dungeon-game/3.mdx +66 -0
  11. package/docs/get_started/tutorials/dungeon-game/4.mdx +164 -0
  12. package/docs/get_started/tutorials/dungeon-game/overview.mdx +145 -0
  13. package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
  14. package/docs/get_started/upgrading.mdx +157 -0
  15. package/docs/guides/agentcore-gateway.mdx +490 -0
  16. package/docs/guides/agentcore-harness.mdx +312 -0
  17. package/docs/guides/astro-docs.mdx +8 -0
  18. package/docs/guides/connection/agentcore-gateway-agent.mdx +222 -0
  19. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  20. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  21. package/docs/guides/connection/py-agent-a2a.mdx +48 -16
  22. package/docs/guides/connection/py-agent-dynamodb.mdx +115 -0
  23. package/docs/guides/connection/py-agent-gateway.mdx +182 -0
  24. package/docs/guides/connection/py-agent-mcp.mdx +43 -14
  25. package/docs/guides/connection/py-agent-rdb.mdx +169 -0
  26. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  27. package/docs/guides/connection/py-fast-api-rdb.mdx +175 -0
  28. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +115 -0
  29. package/docs/guides/connection/py-mcp-server-rdb.mdx +178 -0
  30. package/docs/guides/connection/react-agentcore-gateway.mdx +112 -0
  31. package/docs/guides/connection/react-agui.mdx +33 -14
  32. package/docs/guides/connection/react-fastapi.mdx +39 -3
  33. package/docs/guides/connection/react-py-agent.mdx +10 -16
  34. package/docs/guides/connection/react-smithy.mdx +4 -4
  35. package/docs/guides/connection/react-trpc.mdx +1 -1
  36. package/docs/guides/connection/react-ts-agent.mdx +9 -9
  37. package/docs/guides/connection/smithy-dynamodb.mdx +5 -5
  38. package/docs/guides/connection/smithy-rdb.mdx +9 -9
  39. package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
  40. package/docs/guides/connection/trpc-rdb.mdx +5 -5
  41. package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
  42. package/docs/guides/connection/ts-agent-dynamodb.mdx +35 -36
  43. package/docs/guides/connection/ts-agent-gateway.mdx +147 -0
  44. package/docs/guides/connection/ts-agent-mcp.mdx +12 -9
  45. package/docs/guides/connection/ts-agent-rdb.mdx +61 -25
  46. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +35 -36
  47. package/docs/guides/connection/ts-mcp-server-rdb.mdx +59 -18
  48. package/docs/guides/connection.mdx +122 -5
  49. package/docs/guides/docker-bundling.mdx +82 -14
  50. package/docs/guides/fastapi.mdx +253 -12
  51. package/docs/guides/local-development.mdx +87 -0
  52. package/docs/guides/nx-generator.mdx +4 -3
  53. package/docs/guides/nx-migration.mdx +165 -0
  54. package/docs/guides/py-agent.mdx +332 -55
  55. package/docs/guides/py-dynamodb.mdx +476 -0
  56. package/docs/guides/py-mcp-server.mdx +57 -2
  57. package/docs/guides/py-rdb.mdx +269 -0
  58. package/docs/guides/python-lambda-function.mdx +1 -1
  59. package/docs/guides/python-project.mdx +31 -0
  60. package/docs/guides/react-website-auth.mdx +104 -5
  61. package/docs/guides/react-website.mdx +409 -95
  62. package/docs/guides/runtime-config.mdx +17 -4
  63. package/docs/guides/security.mdx +75 -0
  64. package/docs/guides/smithy-project.mdx +167 -0
  65. package/docs/guides/terraform-project.mdx +119 -8
  66. package/docs/guides/trpc.mdx +55 -14
  67. package/docs/guides/ts-agent.mdx +207 -23
  68. package/docs/guides/ts-dcr-proxy.mdx +569 -0
  69. package/docs/guides/ts-dynamodb.mdx +66 -242
  70. package/docs/guides/ts-lambda-function.mdx +1 -1
  71. package/docs/guides/ts-mcp-server.mdx +111 -29
  72. package/docs/guides/ts-nx-plugin.mdx +4 -4
  73. package/docs/guides/ts-rdb.mdx +116 -466
  74. package/docs/guides/ts-smithy-api.mdx +260 -16
  75. package/docs/guides/typescript-infrastructure.mdx +79 -25
  76. package/docs/guides/typescript-project.mdx +157 -24
  77. package/docs/guides/workspace.mdx +31 -2
  78. package/docs/snippets/agent/architecture.mdx +1 -1
  79. package/docs/snippets/agent/bedrock-deployment.mdx +9 -5
  80. package/docs/snippets/agent/runtime-arn.mdx +23 -2
  81. package/docs/snippets/agent/securing-your-agent.mdx +39 -0
  82. package/docs/snippets/api/access-logging.mdx +38 -0
  83. package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
  84. package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
  85. package/docs/snippets/api/type-safe-api-integrations.mdx +218 -373
  86. package/docs/snippets/api/waf-configuration.mdx +3 -3
  87. package/docs/snippets/connection/a2a-infrastructure.mdx +1 -1
  88. package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
  89. package/docs/snippets/connection/lambda-dynamodb-access.mdx +2 -2
  90. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  91. package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
  92. package/docs/snippets/connection/rdb-api-infrastructure.mdx +42 -19
  93. package/docs/snippets/dynamodb/deploying-table.mdx +176 -0
  94. package/docs/snippets/dynamodb/encryption-options.mdx +168 -0
  95. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  96. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  97. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  98. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  99. package/docs/snippets/experimental-generator.mdx +8 -0
  100. package/docs/snippets/lambda-function/deploying-your-function.mdx +3 -3
  101. package/docs/snippets/mcp/architecture.mdx +1 -1
  102. package/docs/snippets/mcp/bedrock-deployment.mdx +9 -5
  103. package/docs/snippets/mcp/config.mdx +3 -2
  104. package/docs/snippets/mcp/shared-constructs.mdx +4 -5
  105. package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +7 -5
  106. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
  107. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
  108. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
  109. package/docs/snippets/prerequisites.mdx +1 -4
  110. package/docs/snippets/rdb/admin-credentials.mdx +42 -0
  111. package/docs/snippets/rdb/architecture.mdx +39 -0
  112. package/docs/snippets/rdb/cluster-instances.mdx +31 -0
  113. package/docs/snippets/rdb/deletion-protection.mdx +64 -0
  114. package/docs/snippets/rdb/deploying.mdx +178 -0
  115. package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
  116. package/docs/snippets/rdb/engine-version.mdx +63 -0
  117. package/docs/snippets/rdb/infrastructure.mdx +35 -0
  118. package/docs/snippets/rdb/logging-mysql.mdx +5 -0
  119. package/docs/snippets/rdb/logging-postgres.mdx +5 -0
  120. package/docs/snippets/rdb/performance-insights.mdx +36 -0
  121. package/docs/snippets/rdb/rds-proxy.mdx +50 -0
  122. package/docs/snippets/rdb/removal-policy.mdx +57 -0
  123. package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
  124. package/docs/snippets/recommended-prerequisites.mdx +10 -0
  125. package/docs/snippets/required-prerequisites.mdx +1 -4
  126. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  127. package/docs/snippets/shared-constructs.mdx +1 -1
  128. package/docs/snippets/trivy-image-scan.mdx +37 -0
  129. package/generators.json +170 -10
  130. package/package.json +1 -1
  131. package/src/agentcore-gateway/agent-connection/schema.json +31 -0
  132. package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
  133. package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
  134. package/src/agentcore-gateway/react-connection/schema.json +31 -0
  135. package/src/agentcore-gateway/schema.json +72 -0
  136. package/src/agentcore-harness/schema.json +53 -0
  137. package/src/connection/schema.json +5 -0
  138. package/src/infra/app/schema.json +5 -0
  139. package/src/init/schema.json +35 -0
  140. package/src/internal/test-matrix/schema.json +21 -0
  141. package/src/license/schema.json +5 -0
  142. package/src/open-api/json-metadata/schema.json +20 -0
  143. package/src/preset/schema.json +16 -5
  144. package/src/py/agent/a2a-connection/schema.json +5 -0
  145. package/src/py/agent/gateway-connection/schema.json +31 -0
  146. package/src/py/agent/mcp-connection/schema.json +5 -0
  147. package/src/py/agent/react-connection/schema.json +5 -0
  148. package/src/py/agent/schema.json +15 -1
  149. package/src/py/api/schema.json +5 -0
  150. package/src/py/dynamodb/agent-connection/schema.json +27 -0
  151. package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
  152. package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
  153. package/src/py/dynamodb/schema.json +76 -0
  154. package/src/py/fast-api/react/schema.json +5 -0
  155. package/src/py/fast-api/schema.json +6 -0
  156. package/src/py/lambda-function/schema.json +6 -1
  157. package/src/py/mcp-server/schema.json +6 -0
  158. package/src/py/project/schema.json +6 -0
  159. package/src/py/rdb/agent-connection/schema.json +27 -0
  160. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  161. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  162. package/src/py/rdb/schema.json +78 -0
  163. package/src/smithy/project/schema.json +28 -1
  164. package/src/smithy/react-connection/schema.json +5 -0
  165. package/src/smithy/ts/api/schema.json +6 -0
  166. package/src/terraform/project/schema.json +5 -0
  167. package/src/trpc/backend/schema.json +6 -0
  168. package/src/trpc/react/schema.json +5 -0
  169. package/src/ts/agent/a2a-connection/schema.json +5 -0
  170. package/src/ts/agent/gateway-connection/schema.json +31 -0
  171. package/src/ts/agent/mcp-connection/schema.json +5 -0
  172. package/src/ts/agent/react-connection/schema.json +5 -0
  173. package/src/ts/agent/schema.json +14 -0
  174. package/src/ts/api/schema.json +5 -0
  175. package/src/ts/astro-docs/schema.json +3 -3
  176. package/src/ts/dcr-proxy/schema.json +44 -0
  177. package/src/ts/docs/schema.json +3 -3
  178. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  179. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  180. package/src/ts/dynamodb/schema.json +26 -2
  181. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  182. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  183. package/src/ts/lambda-function/schema.json +5 -0
  184. package/src/ts/lib/schema.json +5 -0
  185. package/src/ts/mcp-server/schema.json +6 -0
  186. package/src/ts/nx-generator/schema.json +5 -0
  187. package/src/ts/nx-migration/schema.json +63 -0
  188. package/src/ts/nx-plugin/schema.json +5 -0
  189. package/src/ts/rdb/agent-connection/schema.json +5 -0
  190. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  191. package/src/ts/rdb/schema.json +7 -1
  192. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  193. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  194. package/src/ts/react-website/app/schema.json +12 -6
  195. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  196. package/src/ts/react-website/runtime-config/schema.json +5 -0
  197. package/src/ts/website/app/schema.json +11 -6
  198. package/src/ts/website/auth/schema.json +5 -0
  199. /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
  200. /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: TypeScript Agent to DynamoDB
3
- description: Connect a TypeScript Agent to a DynamoDB table
3
+ description: Connect a TypeScript Agent to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: ts#agent
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import NxCommands from '@components/nx-commands.astro';
12
12
  import Infrastructure from '@components/infrastructure.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
14
 
15
- The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
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
16
 
17
17
  ## Prerequisites
18
18
 
@@ -35,14 +35,14 @@ Select your Agent project as the source and your DynamoDB project as the target.
35
35
 
36
36
  ## Generator Output
37
37
 
38
- The generator updates the agent's `<agent-name>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target. No source files are modified.
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
39
 
40
40
  ## Using DynamoDB in Agents
41
41
 
42
42
  Import entity factories from the DynamoDB package and use them inside your agent definition:
43
43
 
44
44
  ```ts title="packages/my-service/src/my-agent/agent.ts"
45
- import { createExampleEntity } from ':my-scope/my-table';
45
+ import { createExampleEntity } from '@my-scope/my-table';
46
46
 
47
47
  export const getAgent = async () => {
48
48
  // ...
@@ -70,7 +70,7 @@ To allow the agent's Lambda function to access the DynamoDB table, grant the nec
70
70
  <Fragment slot="cdk">
71
71
 
72
72
  ```ts title="packages/infra/src/stacks/application-stack.ts"
73
- import { MyTable } from ':my-scope/common-constructs';
73
+ import { MyTable } from '@my-scope/common-constructs';
74
74
 
75
75
  const table = new MyTable(this, 'Table');
76
76
  const myAgent = new MyAgent(this, 'MyAgent');
@@ -82,42 +82,41 @@ table.grantReadWriteData(myAgent);
82
82
  </Fragment>
83
83
  <Fragment slot="terraform">
84
84
 
85
+ Grant the agent's runtime role access to the table and its KMS encryption key via `additional_iam_policy_statements`:
86
+
85
87
  ```hcl title="packages/infra/src/main.tf"
86
88
  module "my_table" {
87
89
  source = "../../common/terraform/src/app/dynamodb/my-table"
88
90
  }
89
91
 
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
- })
92
+ module "my_agent" {
93
+ source = "../../common/terraform/src/app/agents/my-agent"
94
+
95
+ additional_iam_policy_statements = [
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
+ ]
121
120
  }
122
121
  ```
123
122
  </Fragment>
@@ -0,0 +1,147 @@
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 with `protocol: mcp` and `auth: iam`
25
+
26
+ The Gateway must serve the `mcp` protocol — the agent reaches it as an MCP client, so its targets are exposed as tools. The Gateway must also use IAM authentication: the agent signs its requests with SigV4 using its own execution role. The generator rejects Cognito-authenticated gateways.
27
+
28
+ :::note[One direction per Gateway]
29
+ A single Gateway cannot both be called by an agent and front one. Fronting agent runtimes needs `protocol: http` (see <Link path="guides/connection/agentcore-gateway-agent">Gateway to Agent</Link>), whereas being called by an agent needs `protocol: mcp`. Use a separate Gateway for each direction.
30
+ :::
31
+
32
+ ## Usage
33
+
34
+ ### Run the Generator
35
+
36
+ <RunGenerator generator="connection" />
37
+
38
+ Select the agent project as the source and the Gateway project as the target.
39
+
40
+ ### Options
41
+
42
+ <GeneratorParameters generator="connection" />
43
+
44
+ ## Generator Output
45
+
46
+ The generator emits shared core client files into your `agent-connection` package, plus a per-Gateway wrapper, and modifies your agent:
47
+
48
+ <FileTree>
49
+
50
+ - packages/common/agent-connection
51
+ - src
52
+ - core/
53
+ - agentcore-endpoints.ts Framework-agnostic ARN/URL resolution
54
+ - agentcore-gateway-mcp-transport.ts Framework-agnostic Gateway MCP transport
55
+ - agentcore-gateway-mcp-client-strands.ts Strands MCP client for the deployed Gateway
56
+ - app/
57
+ - \<gateway-kebab>-client-strands.ts Per-Gateway Strands client wrapper
58
+ - index.ts Re-exports the Gateway client
59
+
60
+ </FileTree>
61
+
62
+ Additionally, the generator:
63
+
64
+ - 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
65
+ - Wires the agent's `<agent>-dev` target to depend on the Gateway's `dev` target
66
+ - Installs the required SigV4 / MCP dependencies
67
+
68
+ ## Using the connected Gateway
69
+
70
+ The generator transforms your agent's `agent.ts` to use the Gateway client:
71
+
72
+ ```ts title="packages/example/src/my-agent/agent.ts" {2,5,8}
73
+ import { Agent } from '@strands-agents/sdk';
74
+ import { MyGatewayClientStrands } from '@my-scope/agent-connection';
75
+
76
+ export const getAgent = async () => {
77
+ const myGateway = await MyGatewayClientStrands.create();
78
+ return new Agent({
79
+ systemPrompt: '...',
80
+ tools: [myGateway],
81
+ });
82
+ };
83
+ ```
84
+
85
+ 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.
86
+
87
+ The session ID is propagated to downstream MCP servers automatically via the `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id` header.
88
+
89
+ ## Infrastructure
90
+
91
+ After running the generator you must grant the agent permission to invoke the Gateway.
92
+
93
+ <Infrastructure>
94
+ <Fragment slot="cdk">
95
+ ```ts title="packages/infra/src/stacks/application-stack.ts" {5}
96
+ const gateway = new MyGateway(this, 'MyGateway');
97
+ const myAgent = new MyAgent(this, 'MyAgent');
98
+
99
+ // Grant the agent permissions to invoke the Gateway
100
+ gateway.grantInvokeAccess(myAgent);
101
+ ```
102
+
103
+ 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.
104
+ </Fragment>
105
+ <Fragment slot="terraform">
106
+ ```hcl title="packages/infra/src/main.tf" {8-13}
107
+ module "my_gateway" {
108
+ source = "../../common/terraform/src/app/gateways/my-gateway"
109
+ }
110
+
111
+ module "my_agent" {
112
+ source = "../../common/terraform/src/app/agents/my-agent"
113
+
114
+ # Grant the agent permission to invoke the Gateway
115
+ additional_iam_policy_statements = [{
116
+ Effect = "Allow"
117
+ Action = ["bedrock-agentcore:InvokeGateway"]
118
+ Resource = [module.my_gateway.gateway_arn]
119
+ }]
120
+ }
121
+ ```
122
+
123
+ 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.
124
+ </Fragment>
125
+ </Infrastructure>
126
+
127
+ ## Local Development
128
+
129
+ The generator configures the agent's `dev` target to:
130
+
131
+ 1. Start the connected Gateway's local gateway and every attached MCP server
132
+ 2. Set `LOCAL_DEV=true` so the generated client points at the local gateway instead of the deployed Gateway
133
+
134
+ Run the agent locally with:
135
+
136
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
137
+
138
+ 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:
139
+
140
+ <NxCommands commands={["<agent-name>-serve <project-name>"]} />
141
+
142
+ ### Local fidelity
143
+
144
+ The local gateway stands in for the deployed Gateway, so:
145
+
146
+ - **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.
147
+ - **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],
@@ -99,7 +102,7 @@ The MCP server's AgentCore runtime ARN is automatically registered in the `agent
99
102
  <Fragment slot="terraform">
100
103
  After running the connection generator, you need to grant the agent permission to invoke the MCP server in your Terraform configuration:
101
104
 
102
- ```hcl title="packages/infra/src/main.tf" {12-24}
105
+ ```hcl title="packages/infra/src/main.tf" {9-25}
103
106
  module "inventory_mcp_server" {
104
107
  source = "../../common/terraform/src/app/mcp-servers/inventory-mcp"
105
108
  }
@@ -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,18 +46,14 @@ 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
- ## How It Works
51
+ ## Using the Database in Agent Tools
52
52
 
53
- The Prisma client is instantiated inside `getAgent()`. Since the `ts#agent` generator configures a single Agent per session, the client is also reused for the lifetime of the session.
54
-
55
- ### Agent Definition
56
-
57
- `getAgent` is updated to import and call the Prisma getter at the top of its body:
53
+ The Prisma client is instantiated inside `getAgent()`. Since the `ts#agent` generator configures a single Agent per session, the client is also reused for the lifetime of the session:
58
54
 
59
55
  ```ts title="packages/my-service/src/my-agent/agent.ts" {1,4}
60
- import { getPrisma as getMyDb } from ':my-scope/my-db';
56
+ import { getPrisma as getMyDb } from '@my-scope/my-db';
61
57
 
62
58
  export const getAgent = async () => {
63
59
  const myDb = await getMyDb();
@@ -66,14 +62,13 @@ export const getAgent = async () => {
66
62
  };
67
63
  ```
68
64
 
69
-
70
65
  ## Multiple Databases
71
66
 
72
67
  Running the generator again with a different target adds the second database alongside the first:
73
68
 
74
69
  ```ts title="packages/my-service/src/my-agent/agent.ts" {1,2,5,6}
75
- import { getPrisma as getMyDb } from ':my-scope/my-db';
76
- import { getPrisma as getOtherDb } from ':my-scope/other-db';
70
+ import { getPrisma as getMyDb } from '@my-scope/my-db';
71
+ import { getPrisma as getOtherDb } from '@my-scope/other-db';
77
72
 
78
73
  export const getAgent = async () => {
79
74
  const myDb = await getMyDb();
@@ -91,10 +86,21 @@ The generated agent construct implements `IGrantable` and `IConnectable`, so you
91
86
  <Fragment slot="cdk">
92
87
 
93
88
  ```ts title="packages/infra/src/stacks/application-stack.ts"
94
- import { MyDatabase } from ':my-scope/common-constructs';
89
+ import { SecurityGroup } from 'aws-cdk-lib/aws-ec2';
90
+ import { RuntimeNetworkConfiguration } from 'aws-cdk-lib/aws-bedrockagentcore';
91
+ import { MyDatabase } from '@my-scope/common-constructs';
95
92
 
96
93
  const db = new MyDatabase(this, 'Db', { vpc, ... });
97
- const myAgent = new MyAgent(this, 'MyAgent', { vpc, ... });
94
+
95
+ const myAgent = new MyAgent(this, 'MyAgent', {
96
+ networkConfiguration: RuntimeNetworkConfiguration.usingVpc(this, {
97
+ vpc,
98
+ vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS },
99
+ securityGroups: [
100
+ new SecurityGroup(this, 'MyAgentSecurityGroup', { vpc, allowAllOutbound: true }),
101
+ ],
102
+ }),
103
+ });
98
104
 
99
105
  db.allowDefaultPortFrom(myAgent);
100
106
  db.grantConnect(myAgent);
@@ -102,30 +108,60 @@ db.grantConnect(myAgent);
102
108
 
103
109
  `allowDefaultPortFrom` opens the security group rule so the agent runtime can reach the database port. `grantConnect` grants IAM `rds-db:connect` permission to the agent's execution role.
104
110
 
111
+
105
112
  </Fragment>
106
113
  <Fragment slot="terraform">
107
114
 
108
- Pass the database module outputs into your agent module so it can reach the database and read its runtime configuration:
115
+ Run the agent inside the same VPC as the database, grant it `rds-db:connect` via `additional_iam_policy_statements`, and open the network path with a pair of security group rules. The `aws_vpc.main` and `aws_subnet` resources are defined in the database deployment guide:
109
116
 
110
117
  ```hcl title="packages/infra/src/main.tf"
111
118
  module "my_database" {
112
119
  source = "../../common/terraform/src/app/dbs/my-database"
113
- vpc_id = module.vpc.vpc_id
114
- database_subnet_ids = module.vpc.private_isolated_subnet_ids
120
+ vpc_id = aws_vpc.main.id
121
+ database_subnet_ids = aws_subnet.database[*].id
122
+ lambda_subnet_ids = aws_subnet.private[*].id
115
123
  }
116
124
 
117
125
  module "my_agent" {
118
- source = "../../common/terraform/src/app/agents/my-agent"
126
+ source = "../../common/terraform/src/app/agents/my-agent"
127
+ enable_vpc = true
128
+ vpc_id = aws_vpc.main.id
129
+ subnet_ids = aws_subnet.private[*].id
130
+
131
+ appconfig_application_id = module.runtime_config_appconfig.application_id
132
+ appconfig_application_arn = module.runtime_config_appconfig.application_arn
133
+
134
+ additional_iam_policy_statements = [
135
+ {
136
+ Effect = "Allow"
137
+ Action = ["rds-db:connect"]
138
+ Resource = [
139
+ "arn:aws:rds-db:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:dbuser:${module.my_database.connect_resource_id}/${module.my_database.database_runtime_user}"
140
+ ]
141
+ }
142
+ ]
143
+ }
144
+
145
+ resource "aws_vpc_security_group_ingress_rule" "agent_to_database" {
146
+ description = "Allow the agent runtime to connect to the database"
147
+ security_group_id = module.my_database.security_group_id
148
+ referenced_security_group_id = module.my_agent.security_group_id
149
+ from_port = module.my_database.cluster_port
150
+ to_port = module.my_database.cluster_port
151
+ ip_protocol = "tcp"
152
+ }
119
153
 
120
- appconfig_application_id = module.my_database.appconfig_application_id
121
- database_cluster_resource_id = module.my_database.cluster_resource_id
122
- database_runtime_user = module.my_database.database_runtime_user
123
- database_security_group_id = module.my_database.security_group_id
124
- database_port = module.my_database.cluster_port
154
+ resource "aws_vpc_security_group_egress_rule" "agent_to_database" {
155
+ description = "Allow outbound traffic from the agent runtime to the database"
156
+ security_group_id = module.my_agent.security_group_id
157
+ referenced_security_group_id = module.my_database.security_group_id
158
+ from_port = module.my_database.cluster_port
159
+ to_port = module.my_database.cluster_port
160
+ ip_protocol = "tcp"
125
161
  }
126
162
  ```
127
163
 
128
- Ensure the agent's execution role has `rds-db:connect` permission and that its security group can reach the database security group on the database port.
164
+ `appconfig_application_id`/`appconfig_application_arn` come from the shared <Link path="guides/runtime-config">runtime configuration</Link> AppConfig application declared once in your root module, not from the database module. That application exposes the `database` namespace by default, so the database module's runtime configuration entry is deployed without further configuration.
129
165
 
130
166
  </Fragment>
131
167
  </Infrastructure>
@@ -136,6 +172,6 @@ Ensure the agent's execution role has `rds-db:connect` permission and that its s
136
172
 
137
173
  ## Local Development
138
174
 
139
- <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
175
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
140
176
 
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.
177
+ 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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: MCP Server to DynamoDB
3
- description: Connect a TypeScript MCP Server to a DynamoDB table
3
+ description: Connect a TypeScript MCP Server to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: ts#mcp-server
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import NxCommands from '@components/nx-commands.astro';
12
12
  import Infrastructure from '@components/infrastructure.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
14
 
15
- The `connection` generator wires a <Link path="guides/ts-mcp-server">TypeScript MCP Server</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
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
16
 
17
17
  ## Prerequisites
18
18
 
@@ -35,14 +35,14 @@ Select your MCP server project as the source and your DynamoDB project as the ta
35
35
 
36
36
  ## Generator Output
37
37
 
38
- The generator updates the MCP server's `<mcp-server-name>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target. No source files are modified.
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
39
 
40
40
  ## Using DynamoDB in Tools
41
41
 
42
42
  Import entity factories from the DynamoDB package and use them inside `createServer`:
43
43
 
44
44
  ```ts title="packages/my-service/src/my-mcp/server.ts"
45
- import { createExampleEntity } from ':my-scope/my-table';
45
+ import { createExampleEntity } from '@my-scope/my-table';
46
46
 
47
47
  export const createServer = async () => {
48
48
  const server = new McpServer({ name: 'my-service', version: '1.0.0' });
@@ -67,7 +67,7 @@ To allow the MCP server to access the DynamoDB table, grant the necessary permis
67
67
  <Fragment slot="cdk">
68
68
 
69
69
  ```ts title="packages/infra/src/stacks/application-stack.ts"
70
- import { MyTable } from ':my-scope/common-constructs';
70
+ import { MyTable } from '@my-scope/common-constructs';
71
71
 
72
72
  const table = new MyTable(this, 'Table');
73
73
  const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
@@ -79,42 +79,41 @@ table.grantReadWriteData(myMcpServer);
79
79
  </Fragment>
80
80
  <Fragment slot="terraform">
81
81
 
82
+ Grant the MCP server's runtime role access to the table and its KMS encryption key via `additional_iam_policy_statements`:
83
+
82
84
  ```hcl title="packages/infra/src/main.tf"
83
85
  module "my_table" {
84
86
  source = "../../common/terraform/src/app/dynamodb/my-table"
85
87
  }
86
88
 
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
- })
89
+ module "my_mcp_server" {
90
+ source = "../../common/terraform/src/app/mcp-servers/my-mcp-server"
91
+
92
+ additional_iam_policy_statements = [
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
+ ]
118
117
  }
119
118
  ```
120
119
  </Fragment>