@aws/nx-plugin-mcp 1.0.0-rc.10 → 1.0.0-rc.12

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.
package/bin/aws-nx-mcp.js CHANGED
@@ -19740,6 +19740,19 @@ const EMPTY_COMPLETION_RESULT = { completion: {
19740
19740
  //#endregion
19741
19741
  //#region ../nx-plugin/generators.json
19742
19742
  var generators$1 = {
19743
+ "agentcore-gateway": {
19744
+ "factory": "./src/agentcore-gateway/generator",
19745
+ "schema": "./src/agentcore-gateway/schema.json",
19746
+ "description": "Generate an AgentCore Gateway project",
19747
+ "metric": "g48"
19748
+ },
19749
+ "agentcore-gateway#mcp-connection": {
19750
+ "factory": "./src/agentcore-gateway/mcp-connection/generator",
19751
+ "schema": "./src/agentcore-gateway/mcp-connection/schema.json",
19752
+ "description": "Connect an AgentCore Gateway to an MCP server",
19753
+ "metric": "g49",
19754
+ "hidden": true
19755
+ },
19743
19756
  "connection": {
19744
19757
  "factory": "./src/connection/generator",
19745
19758
  "schema": "./src/connection/schema.json",
@@ -19760,7 +19773,10 @@ var generators$1 = {
19760
19773
  "connection/trpc-rdb",
19761
19774
  "connection/smithy-rdb",
19762
19775
  "connection/ts-mcp-server-rdb",
19763
- "connection/ts-agent-rdb"
19776
+ "connection/ts-agent-rdb",
19777
+ "connection/ts-agent-gateway",
19778
+ "connection/py-agent-gateway",
19779
+ "connection/agentcore-gateway-mcp"
19764
19780
  ]
19765
19781
  },
19766
19782
  "license": {
@@ -20016,6 +20032,13 @@ var generators$1 = {
20016
20032
  "metric": "g35",
20017
20033
  "hidden": true
20018
20034
  },
20035
+ "ts#agent#gateway-connection": {
20036
+ "factory": "./src/ts/agent/gateway-connection/generator",
20037
+ "schema": "./src/ts/agent/gateway-connection/schema.json",
20038
+ "description": "Connect a TypeScript Agent to an AgentCore Gateway",
20039
+ "metric": "g50",
20040
+ "hidden": true
20041
+ },
20019
20042
  "py#agent#a2a-connection": {
20020
20043
  "factory": "./src/py/agent/a2a-connection/generator",
20021
20044
  "schema": "./src/py/agent/a2a-connection/schema.json",
@@ -20023,6 +20046,13 @@ var generators$1 = {
20023
20046
  "metric": "g36",
20024
20047
  "hidden": true
20025
20048
  },
20049
+ "py#agent#gateway-connection": {
20050
+ "factory": "./src/py/agent/gateway-connection/generator",
20051
+ "schema": "./src/py/agent/gateway-connection/schema.json",
20052
+ "description": "Connect a Python Agent to an AgentCore Gateway",
20053
+ "metric": "g51",
20054
+ "hidden": true
20055
+ },
20026
20056
  "ts#sync": {
20027
20057
  "factory": "./src/ts/sync/generator",
20028
20058
  "schema": "./src/ts/sync/schema.json",
@@ -53590,18 +53620,28 @@ const readCommandsAttr = (node) => {
53590
53620
  * SPDX-License-Identifier: Apache-2.0
53591
53621
  */
53592
53622
  /**
53593
- * Pull out every enum-valued property as a `FilterableOption`. Shared between
53594
- * the MCP server (deriving options from a generator's schema) and the docs
53595
- * filter bar (mapping user-referenced keys onto their enum values).
53623
+ * The values an option can be filtered on: its enum values, or true/false
53624
+ * for booleans. Returns undefined for non-filterable options.
53625
+ */
53626
+ const filterableValuesForProperty = (prop) => {
53627
+ if (Array.isArray(prop.enum) && prop.enum.length > 0) return prop.enum.map((v) => String(v));
53628
+ if (prop.type === "boolean") return ["true", "false"];
53629
+ };
53630
+ /**
53631
+ * Pull out every filterable property (enum or boolean valued) as a
53632
+ * `FilterableOption`. Shared between the MCP server (deriving options from a
53633
+ * generator's schema) and the docs filter bar (mapping user-referenced keys
53634
+ * onto their values).
53596
53635
  */
53597
53636
  const filterableOptionsFromSchema = (schema) => {
53598
53637
  const props = schema?.properties ?? {};
53599
53638
  const out = [];
53600
53639
  for (const [key, prop] of Object.entries(props)) {
53601
- if (!Array.isArray(prop.enum) || prop.enum.length === 0) continue;
53640
+ const values = filterableValuesForProperty(prop);
53641
+ if (!values) continue;
53602
53642
  out.push({
53603
53643
  key,
53604
- enum: prop.enum.map((v) => String(v)),
53644
+ enum: values,
53605
53645
  default: prop.default !== void 0 ? String(prop.default) : void 0,
53606
53646
  description: prop.description
53607
53647
  });
@@ -0,0 +1,239 @@
1
+ ---
2
+ title: AgentCore Gateway
3
+ description: Create an AgentCore Gateway project
4
+ generator: agentcore-gateway
5
+ ---
6
+
7
+ import { FileTree } from '@astrojs/starlight/components';
8
+ import RunGenerator from '@components/run-generator.astro';
9
+ import GeneratorParameters from '@components/generator-parameters.astro';
10
+ import Infrastructure from '@components/infrastructure.astro';
11
+ import Snippet from '@components/snippet.astro';
12
+ import Link from '@components/link.astro';
13
+ import NxCommands from '@components/nx-commands.astro';
14
+ import OptionFilter from '@components/option-filter.astro';
15
+
16
+ Generate an [Amazon Bedrock AgentCore Gateway](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway.html) project. An AgentCore Gateway is a managed entry point that aggregates one or more MCP server targets behind a single MCP endpoint, evaluates every tool call against a [Cedar policy engine](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html), and signs outbound traffic to MCP servers with IAM SigV4.
17
+
18
+ ## Usage
19
+
20
+ ### Generate an AgentCore Gateway
21
+
22
+ <RunGenerator generator="agentcore-gateway" />
23
+
24
+ ### Options
25
+
26
+ <GeneratorParameters generator="agentcore-gateway" />
27
+
28
+ ## Generator Output
29
+
30
+ The generator creates a new project at `packages/<name>/`, plus a CDK construct or Terraform module for the infrastructure:
31
+
32
+ <FileTree>
33
+ - packages/\<name>/
34
+ - policies/ Cedar policy source files (omitted when `cedarPolicy: false`)
35
+ - permit-all.cedar Default Cedar policy that permits authenticated callers from within the same AWS account
36
+ - README.md Reference for writing Cedar policies
37
+ - serve-local.ts Local gateway aggregating attached MCP servers for local development
38
+ - project.json Adds the \<name>-serve and \<name>-serve-local aggregator targets
39
+ </FileTree>
40
+
41
+ ### Infrastructure
42
+
43
+ Infrastructure is generated when `infra` is `agentcore` (the default). With `infra: none` no infrastructure is generated — re-run the generator with `infra: agentcore` later to add it.
44
+
45
+ <Snippet name="shared-constructs" />
46
+
47
+ <Infrastructure>
48
+ <Fragment slot="cdk">
49
+ <FileTree>
50
+ - packages/common/constructs/src
51
+ - core
52
+ - agentcore-gateway/ Shared gateway construct (readiness probe, Cedar policy loading)
53
+ - app
54
+ - gateways
55
+ - \<name>/
56
+ - \<name>.ts CDK construct for deploying the Gateway
57
+ </FileTree>
58
+ </Fragment>
59
+ <Fragment slot="terraform">
60
+ <FileTree>
61
+ - packages/common/terraform/src
62
+ - app
63
+ - gateways
64
+ - \<name>/
65
+ - \<name>.tf Terraform module for deploying the Gateway
66
+ </FileTree>
67
+ </Fragment>
68
+ </Infrastructure>
69
+
70
+ The generated construct creates the following AWS resources:
71
+
72
+ - An `AgentCore::Gateway` configured for the MCP protocol with `GatewayAuthorizer.usingAwsIam()` (inbound IAM authentication)
73
+ - An `AgentCore::PolicyEngine` running in `ENFORCE` mode, attached to the Gateway (omitted when `cedarPolicy: false`)
74
+ - One `AgentCore::Policy` per `.cedar` file in `policies/`
75
+
76
+ The Gateway URL is automatically registered in the `agentcore.gateways.<ClassName>` namespace of <Link path="guides/runtime-config">Runtime Configuration</Link> so agents can discover it at runtime.
77
+
78
+ ## Writing Policies
79
+
80
+ <OptionFilter when={{ cedarPolicy: true }} description="Cedar policies — cedarPolicy: true only">
81
+
82
+ Cedar is the policy language used by AgentCore Gateway to authorize tool calls. Every `tools/list` and `tools/call` request flowing through the Gateway is evaluated against the attached policy set, and the caller must have at least one matching `permit` statement (and no matching `forbid`) for the request to succeed.
83
+
84
+ Refer to the [AWS documentation on AgentCore Gateway policies](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy.html) for the full reference, including [common policy patterns](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy-common-patterns.html).
85
+
86
+ ### Adding a policy
87
+
88
+ To add a policy, create a new `.cedar` file alongside `permit-all.cedar`. Each `.cedar` file in `policies/` must contain exactly **one** `permit` or `forbid` statement and is deployed as a single `AWS::BedrockAgentCore::Policy` resource. The policy resource's name is derived from the filename: `permit-all.cedar` becomes `PermitAll` (kebab/snake-case is converted to PascalCase). Files containing multiple statements produce `unexpected token 'forbid'` errors at deploy time — split them into separate files.
89
+
90
+ For example, to permit only a specific agent role to invoke a particular tool, create:
91
+
92
+ ```cedar title="packages/<name>/policies/ts-agent-divide.cedar"
93
+ permit (
94
+ principal == AgentCore::IamEntity::"arn:aws:sts::<%= accountId %>:assumed-role/<%= tsAgentRoleName %>",
95
+ action == AgentCore::Action::"ts-mcp___divide",
96
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
97
+ );
98
+ ```
99
+
100
+ Pass the role name in as a template variable (see <a href="#template-variables">Template variables</a> below) rather than hard-coding it. Re-synth or re-plan to deploy the new policy.
101
+
102
+ ### Template variables
103
+
104
+ Policies are [EJS](https://ejs.co/) templates rendered at synth/plan time so they stay portable across accounts and Gateway redeploys:
105
+
106
+ | Variable | Substituted with |
107
+ | -------------------- | --------------------------------------------- |
108
+ | `<%= gatewayArn %>` | The deployed Gateway's ARN |
109
+ | `<%= accountId %>` | The AWS account this Gateway is deployed into |
110
+
111
+ Always reference these variables rather than hard-coding values.
112
+
113
+ #### Adding your own variables
114
+
115
+ Add new variables where the policies are rendered, for example to pass an agent's execution role name to the `ts-agent-divide.cedar` example above:
116
+
117
+ <Infrastructure>
118
+ <Fragment slot="cdk">
119
+ In `packages/common/constructs/src/app/gateways/<name>/<name>.ts`, pass `cedarPolicyVariables` through to the shared construct:
120
+
121
+ ```ts {4-6}
122
+ super(scope, id, {
123
+ cedarPolicyPath: path.join(
124
+ ...
125
+ ),
126
+ cedarPolicyVariables: {
127
+ tsAgentRoleName: cdk.Token.asString(tsAgent.agentCoreRuntime.role.roleName),
128
+ },
129
+ });
130
+ ```
131
+ </Fragment>
132
+ <Fragment slot="terraform">
133
+ In `packages/common/terraform/src/app/gateways/<name>/<name>.tf`, add to the `query` of the `rendered_policies` data source:
134
+
135
+ ```hcl {4}
136
+ query = {
137
+ template = "${local.policies_dir}/${each.value}"
138
+ gatewayArn = aws_bedrockagentcore_gateway.this.gateway_arn
139
+ tsAgentRoleName = var.ts_agent_role_name
140
+ # ...
141
+ }
142
+ ```
143
+ </Fragment>
144
+ </Infrastructure>
145
+
146
+ ### ENFORCE mode and default-deny
147
+
148
+ The `PolicyEngine` runs in `ENFORCE` mode, which means **default-deny** semantics apply: if no `permit` statement matches the (principal, action, resource) tuple, the request is denied. Tool calls that are denied return:
149
+
150
+ ```
151
+ Tool Execution Denied: Tool call not allowed due to policy enforcement
152
+ [No policy applies to the request (denied by default).]
153
+ ```
154
+
155
+ Additionally, the Gateway filters the response of `tools/list` so that callers only see tools they have at least one matching `permit` for: if an agent lacks permission for a given tool, the tool is hidden entirely rather than appearing and failing at call time.
156
+
157
+ ### Default `permit-all.cedar`
158
+
159
+ The generator ships a default policy that permits any IAM caller from the AWS account the Gateway is deployed into:
160
+
161
+ ```cedar title="packages/<name>/policies/permit-all.cedar"
162
+ permit (
163
+ principal is AgentCore::IamEntity,
164
+ action,
165
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
166
+ ) when {
167
+ principal.id like "arn:aws:*::<%= accountId %>:*"
168
+ };
169
+ ```
170
+
171
+ To lock things down further, add narrower policies alongside it. Always retain at least one matching `permit` in the policy set, otherwise default-deny will block every call.
172
+
173
+ ### Policy scope reference
174
+
175
+ For Gateways generated by this plugin, all callers are IAM principals (the Gateway is configured with `GatewayAuthorizer.usingAwsIam()`):
176
+
177
+ ```
178
+ principal is AgentCore::IamEntity
179
+ ```
180
+
181
+ Callers are evaluated as STS assumed-role ARNs with the session name stripped, so a role can be matched exactly — no wildcards needed:
182
+
183
+ ```cedar
184
+ principal == AgentCore::IamEntity::"arn:aws:sts::<%= accountId %>:assumed-role/<%= myAgentRoleName %>"
185
+ ```
186
+
187
+ The same value is available as `principal.id` for `when` clauses. Reserve `like` for genuine patterns, such as the account-wide match in the default `permit-all.cedar`.
188
+
189
+ Tool invocations reach the policy engine as actions with the form:
190
+
191
+ ```
192
+ AgentCore::Action::"<target-name>___<tool-name>"
193
+ ```
194
+
195
+ where `<target-name>` is the Gateway target name (the MCP server's `mcpServerName` by default when using `gateway.addMcpServer(...)`, derived from the MCP project's class name in kebab-case — e.g. `TsMcp` → `ts-mcp`), `<tool-name>` is the MCP tool's name, and the separator is `___` (three underscores). Cedar does not support wildcards on actions — match exact actions, or omit `action ==` to match all actions.
196
+
197
+ The resource is always the Gateway itself:
198
+
199
+ ```cedar
200
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
201
+ ```
202
+
203
+ ### Validation considerations
204
+
205
+ The generated infrastructure creates policies with `IGNORE_ALL_FINDINGS`: AgentCore's Cedar analyzer (`FAIL_ON_ANY_FINDINGS`, the service default) rejects many legitimate policies — for example, a `forbid` disabling a single tool for every caller is rejected as "Overly Restrictive", even when scoped with a `when` clause. Enforcement is unaffected; it is configured by the policy engine's `ENFORCE` mode.
206
+
207
+ One ordering constraint still applies: a policy referencing `AgentCore::Action::"<target>___<tool>"` only validates once the target has registered that tool with the Gateway, which is why the generated infrastructure creates policies after Gateway targets.
208
+
209
+ If a policy fails to deploy, CloudFormation surfaces the rejection as an opaque `Resource stabilization failed` error — run `aws bedrock-agentcore-control list-policies --policy-engine-id <id>` to retrieve the validator's `statusReasons`, which contain the actual reason.
210
+
211
+ ### Example: forbid one tool while keeping a broader permit
212
+
213
+ Pair a narrow `forbid` with a broader `permit` (Cedar evaluates `forbid` over `permit`):
214
+
215
+ ```cedar title="packages/<name>/policies/forbid-divide-for-py-agent.cedar"
216
+ forbid (
217
+ principal == AgentCore::IamEntity::"arn:aws:sts::<%= accountId %>:assumed-role/<%= pyAgentRoleName %>",
218
+ action == AgentCore::Action::"ts-mcp___divide",
219
+ resource == AgentCore::Gateway::"<%= gatewayArn %>"
220
+ );
221
+ ```
222
+
223
+ This denies the Python agent role from calling `ts-mcp___divide` while leaving the broader `permit-all.cedar` in place for all other callers.
224
+
225
+ </OptionFilter>
226
+
227
+ ## Local Development
228
+
229
+ The generator adds a `<name>-serve-local` target to the Gateway project, which runs `serve-local.ts`: a local gateway exposing a single MCP endpoint that aggregates every attached MCP server (connected via the <Link path="guides/connection/agentcore-gateway-mcp">`agentcore-gateway#mcp-connection` generator</Link>), with tools prefixed `<target>___<tool>` to match the deployed Gateway. Running it starts the local gateway and all attached MCP servers together.
230
+
231
+ <NxCommands commands={["<name>-serve-local"]} />
232
+
233
+ See the connection guide for the full local development story.
234
+
235
+ ## Next steps
236
+
237
+ - Connect an MCP server: <Link path="guides/connection/agentcore-gateway-mcp">`agentcore-gateway#mcp-connection`</Link>
238
+ - Connect a TypeScript Agent: <Link path="guides/connection/ts-agent-gateway">`ts#agent#gateway-connection`</Link>
239
+ - Connect a Python Agent: <Link path="guides/connection/py-agent-gateway">`py#agent#gateway-connection`</Link>
@@ -0,0 +1,134 @@
1
+ ---
2
+ title: AgentCore Gateway to MCP Server
3
+ description: Connect an AgentCore Gateway to an MCP server
4
+ when:
5
+ sourceType: agentcore-gateway
6
+ targetType:
7
+ - ts#mcp-server
8
+ - py#mcp-server
9
+ ---
10
+ import { FileTree } from '@astrojs/starlight/components';
11
+ import Link from '@components/link.astro';
12
+ import RunGenerator from '@components/run-generator.astro';
13
+ import GeneratorParameters from '@components/generator-parameters.astro';
14
+ import NxCommands from '@components/nx-commands.astro';
15
+ import Infrastructure from '@components/infrastructure.astro';
16
+
17
+ The `connection` generator can register an MCP server (either <Link path="guides/ts-mcp-server">TypeScript</Link> or <Link path="guides/py-mcp-server">Python</Link>) as a target of an <Link path="guides/agentcore-gateway">AgentCore Gateway</Link>.
18
+
19
+ Once connected, the Gateway aggregates the MCP server's tools into its single MCP endpoint, evaluates calls against its Cedar policy engine, and signs outbound traffic to the MCP server with IAM SigV4.
20
+
21
+ ## Prerequisites
22
+
23
+ Before using this generator, ensure you have:
24
+
25
+ 1. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
26
+ 2. An MCP server component (<Link path="guides/ts-mcp-server">`ts#mcp-server`</Link> or <Link path="guides/py-mcp-server">`py#mcp-server`</Link>) created with `infra: agentcore` and `auth: iam`
27
+
28
+ The Gateway must have `protocol: mcp` and the MCP server must have `auth: iam` — the generator validates both. Non-IAM MCP servers cannot be attached because the Gateway signs outbound traffic with SigV4.
29
+
30
+ ## Usage
31
+
32
+ ### Run the Generator
33
+
34
+ <RunGenerator generator="connection" />
35
+
36
+ Select the Gateway project as the source and the MCP server project as the target. If the MCP server project contains multiple components, specify `targetComponent` to disambiguate.
37
+
38
+ ### Options
39
+
40
+ <GeneratorParameters generator="connection" />
41
+
42
+ ## Generator Output
43
+
44
+ The generator wires existing projects together rather than emitting new source files. The following files are modified:
45
+
46
+ <FileTree>
47
+
48
+ - packages/\<gateway>
49
+ - project.json `<gateway>-serve-local` gains a dependency on the MCP server's `<mcp>-serve-local`
50
+ - serve-local.ts `ATTACHED_MCP_SERVERS` updated so the local gateway aggregates the MCP server
51
+
52
+ </FileTree>
53
+
54
+ The Gateway project's `<gateway>-serve-local` target gains a dependency on the MCP server's `<mcp>-serve-local` target, so running the Gateway locally also starts the MCP server. The MCP server is also registered in the Gateway project's `serve-local.ts` so the local gateway aggregates its tools.
55
+
56
+ ## Adding the MCP server target to your stack
57
+
58
+ The generator **cannot** automatically wire the MCP server target into your infrastructure because it doesn't know which stack or module instantiates the Gateway. Add a single call to `gateway.addMcpServer(server)` yourself.
59
+
60
+ <Infrastructure>
61
+ <Fragment slot="cdk">
62
+ In the stack where you instantiate the Gateway, register the MCP server as a target:
63
+
64
+ ```ts title="packages/infra/src/stacks/application-stack.ts" {5-6}
65
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
66
+ const myGateway = new MyGateway(this, 'MyGateway');
67
+
68
+ // Register the MCP server as a target of the Gateway. The target name
69
+ // defaults to the MCP server's `mcpServerName` (its class name in
70
+ // kebab-case, e.g. `MyMcpServer` -> `my-mcp-server`).
71
+ myGateway.addMcpServer(myMcpServer);
72
+ ```
73
+
74
+ The Gateway target name (the MCP server's `mcpServerName` by default) is used as the prefix for Cedar action names — the action format is ``AgentCore::Action::"<targetName>___<toolName>"``. See the <Link path="guides/agentcore-gateway">Writing Policies section</Link>. Keep the target name short and stable; changing it later invalidates any Cedar policies that reference the old name.
75
+
76
+ To override the default target name, pass `gatewayTargetName`:
77
+
78
+ ```ts
79
+ myGateway.addMcpServer(myMcpServer, { gatewayTargetName: 'my-mcp' });
80
+ ```
81
+
82
+ The construct configures the target with `iamCredentialProvider.service = 'bedrock-agentcore'` so the Gateway signs outbound calls using its own execution role.
83
+ </Fragment>
84
+ <Fragment slot="terraform">
85
+ In the Terraform file where you instantiate the Gateway, wire the MCP server target in:
86
+
87
+ ```hcl title="packages/infra/src/main.tf" {7,11-27}
88
+ module "my_mcp_server" {
89
+ source = "../../common/terraform/src/app/mcp-servers/my-mcp-server"
90
+ }
91
+
92
+ module "my_gateway" {
93
+ source = "../../common/terraform/src/app/gateways/my-gateway"
94
+ policy_dependencies = [aws_bedrockagentcore_gateway_target.my_mcp_server.target_id]
95
+ }
96
+
97
+ # Register the MCP server as a target of the Gateway
98
+ resource "aws_bedrockagentcore_gateway_target" "my_mcp_server" {
99
+ gateway_identifier = module.my_gateway.gateway_id
100
+ name = "my-mcp-server"
101
+
102
+ target_configuration {
103
+ mcp {
104
+ mcp_server {
105
+ endpoint = "https://bedrock-agentcore.${local.aws_region}.amazonaws.com/runtimes/${urlencode(module.my_mcp_server.agent_core_runtime_arn)}/invocations?qualifier=DEFAULT"
106
+ }
107
+ }
108
+ }
109
+
110
+ credential_provider_configuration {
111
+ gateway_iam_role {
112
+ service = "bedrock-agentcore"
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ The target `name` (`my-mcp-server` above) is used as the prefix for Cedar action names — see the <Link path="guides/agentcore-gateway">Writing Policies section</Link>. `policy_dependencies` ensures Cedar policies referencing this target's actions are created after the target has registered them.
119
+ </Fragment>
120
+ </Infrastructure>
121
+
122
+ ## Local Development
123
+
124
+ Running the Gateway locally with:
125
+
126
+ <NxCommands commands={["<gateway-name>-serve-local"]} />
127
+
128
+ starts a local gateway plus every attached MCP server on its assigned local port. The local gateway exposes a single MCP endpoint that aggregates the attached servers' tools. Agents connected to the Gateway via the <Link path="guides/connection/ts-agent-gateway">TypeScript</Link> or <Link path="guides/connection/py-agent-gateway">Python</Link> gateway-connection generators point at it when running with `SERVE_LOCAL=true`.
129
+
130
+ :::caution[Local fidelity]
131
+ Local development uses a **local stand-in gateway** — a lightweight MCP aggregator started by the Gateway project, not the AgentCore Gateway service. As a consequence, **Cedar policies are not evaluated locally**. Every agent sees every tool on every attached MCP server. To exercise Cedar policies, run the agent's `serve` target instead (see the <Link path="guides/connection/ts-agent-gateway">TypeScript</Link> / <Link path="guides/connection/py-agent-gateway">Python</Link> agent-connection guides) so the locally-running agent calls the deployed Gateway.
132
+
133
+ Tool names are still prefixed locally as `<target-name>___<tool-name>` to match the deployed Gateway's namespacing, so an agent's system prompt and the Cedar action names you reference remain consistent across local and deployed runs.
134
+ :::
@@ -0,0 +1,158 @@
1
+ ---
2
+ title: Python Agent to Gateway
3
+ description: Connect a Python Agent to an AgentCore Gateway
4
+ when:
5
+ sourceType: py#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/py-agent">Python 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 (via `httpx` request signing) 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 Python project with a <Link path="guides/py-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-gateway modules into your `agent_connection` Python project, plus a per-Gateway wrapper, and modifies your agent:
41
+
42
+ <FileTree>
43
+
44
+ - packages/common/agent\_connection
45
+ - \<scope>\_agent\_connection
46
+ - core/
47
+ - agentcore\_gateway\_mcp\_client.py SigV4 MCP client using `httpx`
48
+ - app/
49
+ - \<gateway\_snake>\_client.py Per-Gateway client wrapper
50
+ - \_\_init\_\_.py Re-exports the Gateway client
51
+
52
+ </FileTree>
53
+
54
+ Additionally, the generator:
55
+
56
+ - Modifies your agent's `agent.py` to import the Gateway client, enter it via a `with` block, and register its tools in `tools`
57
+ - Adds `agent_connection` as a workspace dependency of the agent
58
+ - Wires the agent's `<agent>-serve-local` target to depend on the Gateway's `<gateway>-serve-local` aggregator
59
+
60
+ ## Using the connected Gateway
61
+
62
+ The generator transforms your agent's `agent.py` to use the Gateway client:
63
+
64
+ ```python title="packages/example/example/my_agent/agent.py" {4,8,9-13}
65
+ from contextlib import contextmanager
66
+ from strands import Agent
67
+
68
+ from my_scope_agent_connection import MyGatewayClient
69
+
70
+ @contextmanager
71
+ def get_agent():
72
+ my_gateway = MyGatewayClient.create()
73
+ with (
74
+ my_gateway,
75
+ ):
76
+ yield Agent(
77
+ system_prompt="...",
78
+ tools=[*my_gateway.list_tools_sync()],
79
+ )
80
+ ```
81
+
82
+ `MyGatewayClient.create()` returns a single context-manageable client whose `list_tools_sync()` yields every tool available through the Gateway:
83
+
84
+ - **Deployed mode** (`SERVE_LOCAL` unset): a single `MCPClient` pointed at the Gateway's MCP endpoint, SigV4-signed.
85
+ - **Local mode** (`SERVE_LOCAL=true`): a plain-HTTP `MCPClient` pointed at the local gateway started by the Gateway project's `serve-local` target.
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" {12-24}
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
+
115
+ # Grant the agent permission to invoke the Gateway
116
+ resource "aws_iam_policy" "agent_invoke_gateway" {
117
+ name = "AgentInvokeGatewayPolicy"
118
+ policy = jsonencode({
119
+ Version = "2012-10-17"
120
+ Statement = [{
121
+ Effect = "Allow"
122
+ Action = "bedrock-agentcore:InvokeGateway"
123
+ Resource = module.my_gateway.gateway_arn
124
+ }]
125
+ })
126
+ }
127
+
128
+ resource "aws_iam_role_policy_attachment" "agent_invoke_gateway" {
129
+ role = module.my_agent.agent_core_runtime_role_arn
130
+ policy_arn = aws_iam_policy.agent_invoke_gateway.arn
131
+ }
132
+ ```
133
+
134
+ 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.
135
+ </Fragment>
136
+ </Infrastructure>
137
+
138
+ ## Local Development
139
+
140
+ The generator configures the agent's `serve-local` target to:
141
+
142
+ 1. Start the connected Gateway's local gateway and every attached MCP server
143
+ 2. Set `SERVE_LOCAL=true` so the generated client points at the local gateway instead of the deployed Gateway
144
+
145
+ Run the agent locally with:
146
+
147
+ <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
148
+
149
+ To run the agent locally **against the deployed Gateway** instead (for example, to exercise Cedar policies), use the agent's `serve` target. Without `SERVE_LOCAL` set, the client resolves the deployed Gateway URL from runtime configuration and SigV4-signs requests with your local AWS credentials:
150
+
151
+ <NxCommands commands={["<agent-name>-serve <project-name>"]} />
152
+
153
+ ### Local fidelity
154
+
155
+ The local gateway stands in for the deployed Gateway, so:
156
+
157
+ - **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.
158
+ - **Tool-name prefixing is preserved.** Each local MCP server's tools are exposed as `<target-name>___<tool-name>`, matching what the deployed Gateway emits. This keeps the agent's system prompt and the Cedar action names you reference consistent across local and deployed runs.
@@ -0,0 +1,150 @@
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-gateway-mcp-client.ts SigV4 MCP client for the deployed Gateway
48
+ - app/
49
+ - \<gateway-kebab>-client.ts Per-Gateway client wrapper
50
+ - index.ts Re-exports the Gateway client
51
+
52
+ </FileTree>
53
+
54
+ Additionally, the generator:
55
+
56
+ - Modifies your agent's `agent.ts` to import the Gateway client class, call `<Gateway>Client.create()`, and register the returned client in the `tools` array
57
+ - Wires the agent's `<agent>-serve-local` target to depend on the Gateway's `<gateway>-serve-local` aggregator
58
+ - Installs the required SigV4 / MCP dependencies
59
+
60
+ ## Using the connected Gateway
61
+
62
+ The generator transforms your agent's `agent.ts` to use the Gateway client:
63
+
64
+ ```ts title="packages/example/src/my-agent/agent.ts" {2,5,8}
65
+ import { Agent } from '@strands-agents/sdk';
66
+ import { MyGatewayClient } from ':my-scope/agent-connection';
67
+
68
+ export const getAgent = async () => {
69
+ const myGateway = await MyGatewayClient.create();
70
+ return new Agent({
71
+ systemPrompt: '...',
72
+ tools: [myGateway],
73
+ });
74
+ };
75
+ ```
76
+
77
+ When deployed (`SERVE_LOCAL` unset), the client points at the Gateway's MCP endpoint and authenticates with SigV4. When `SERVE_LOCAL=true`, it points at the local gateway started by the Gateway project's `serve-local` target, so the same `agent.ts` works uniformly in both modes.
78
+
79
+ The session ID is propagated to downstream MCP servers automatically via the `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id` header.
80
+
81
+ ## Infrastructure
82
+
83
+ After running the generator you must grant the agent permission to invoke the Gateway.
84
+
85
+ <Infrastructure>
86
+ <Fragment slot="cdk">
87
+ ```ts title="packages/infra/src/stacks/application-stack.ts" {5}
88
+ const gateway = new MyGateway(this, 'MyGateway');
89
+ const myAgent = new MyAgent(this, 'MyAgent');
90
+
91
+ // Grant the agent permissions to invoke the Gateway
92
+ gateway.grantInvokeAccess(myAgent);
93
+ ```
94
+
95
+ 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.
96
+ </Fragment>
97
+ <Fragment slot="terraform">
98
+ ```hcl title="packages/infra/src/main.tf" {12-24}
99
+ module "my_gateway" {
100
+ source = "../../common/terraform/src/app/gateways/my-gateway"
101
+ }
102
+
103
+ module "my_agent" {
104
+ source = "../../common/terraform/src/app/agents/my-agent"
105
+ }
106
+
107
+ # Grant the agent permission to invoke the Gateway
108
+ resource "aws_iam_policy" "agent_invoke_gateway" {
109
+ name = "AgentInvokeGatewayPolicy"
110
+ policy = jsonencode({
111
+ Version = "2012-10-17"
112
+ Statement = [{
113
+ Effect = "Allow"
114
+ Action = "bedrock-agentcore:InvokeGateway"
115
+ Resource = module.my_gateway.gateway_arn
116
+ }]
117
+ })
118
+ }
119
+
120
+ resource "aws_iam_role_policy_attachment" "agent_invoke_gateway" {
121
+ role = module.my_agent.agent_core_runtime_role_arn
122
+ policy_arn = aws_iam_policy.agent_invoke_gateway.arn
123
+ }
124
+ ```
125
+
126
+ 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.
127
+ </Fragment>
128
+ </Infrastructure>
129
+
130
+ ## Local Development
131
+
132
+ The generator configures the agent's `serve-local` target to:
133
+
134
+ 1. Start the connected Gateway's local gateway and every attached MCP server
135
+ 2. Set `SERVE_LOCAL=true` so the generated client points at the local gateway instead of the deployed Gateway
136
+
137
+ Run the agent locally with:
138
+
139
+ <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
140
+
141
+ To run the agent locally **against the deployed Gateway** instead (for example, to exercise Cedar policies), use the agent's `serve` target. Without `SERVE_LOCAL` set, the client resolves the deployed Gateway URL from runtime configuration and SigV4-signs requests with your local AWS credentials:
142
+
143
+ <NxCommands commands={["<agent-name>-serve <project-name>"]} />
144
+
145
+ ### Local fidelity
146
+
147
+ The local gateway stands in for the deployed Gateway, so:
148
+
149
+ - **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.
150
+ - **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.
@@ -148,8 +148,35 @@ The Connection generator supports the following connections:
148
148
  source="mcp"
149
149
  target="dynamodb"
150
150
  />
151
+ <ConnectionCard
152
+ title="AgentCore Gateway to MCP Server"
153
+ description="Aggregate an MCP server behind an AgentCore Gateway"
154
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-mcp`}
155
+ source="agentcore"
156
+ target="mcp"
157
+ />
158
+ <ConnectionCard
159
+ title="TypeScript Agent to AgentCore Gateway"
160
+ description="Connect a TypeScript Agent to an AgentCore Gateway"
161
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-gateway`}
162
+ source="strands"
163
+ sourceBadge="typescript"
164
+ target="agentcore"
165
+ />
166
+ <ConnectionCard
167
+ title="Python Agent to AgentCore Gateway"
168
+ description="Connect a Python Agent to an AgentCore Gateway"
169
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-gateway`}
170
+ source="strands"
171
+ sourceBadge="python"
172
+ target="agentcore"
173
+ />
151
174
  </CardGrid>
152
175
 
153
176
  :::note[Runtime Configuration]
154
177
  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.
155
178
  :::
179
+
180
+ :::tip[Local Development]
181
+ Connected projects can be run on your machine with the `serve` and `serve-local` targets. See the <Link path="guides/local-development">Local Development</Link> guide for details.
182
+ :::
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Local Development
3
+ description: How local development works with the serve and serve-local targets
4
+ ---
5
+ import Link from '@components/link.astro';
6
+ import NxCommands from '@components/nx-commands.astro';
7
+ import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
8
+
9
+ Connected projects expose two targets for running them on your machine: `serve` and `serve-local`. The difference is one of **scope** — how much of your application runs locally versus pointing at deployed AWS infrastructure.
10
+
11
+ Consider a workspace with the following connections: a website that calls a tRPC `api`, and also calls an `agent` which in turn calls an `mcp` server.
12
+
13
+ ## `serve`
14
+
15
+ The `serve` target runs **only the targeted project** locally. Every other project it connects to is expected to be **deployed**, and is reached at its real AWS URL.
16
+
17
+ <NxCommands commands={['serve website']} />
18
+
19
+ Because the targeted project talks to deployed resources, it needs to know where they are. For a website this is provided by its `runtime-config.json` (see <Link path="guides/react-website#local-runtime-config">Local Runtime Config</Link>), which you load from a deployed application. For server-side projects (APIs and agents) that read <Link path="guides/runtime-config">Runtime Configuration</Link>, set the `RUNTIME_CONFIG_APP_ID` environment variable to point at your deployed AppConfig application.
20
+
21
+ ```d2
22
+ direction: right
23
+
24
+ local: Local {
25
+ style.stroke-dash: 3
26
+ website: website
27
+ }
28
+ deployed: Deployed {
29
+ style.stroke-dash: 3
30
+ api: api
31
+ agent: agent
32
+ mcp: mcp
33
+ }
34
+
35
+ local.website -> deployed.api
36
+ local.website -> deployed.agent
37
+ deployed.agent -> deployed.mcp
38
+ ```
39
+
40
+ Use `serve` when you want to iterate on a single project against the "real", deployed versions of everything it depends on.
41
+
42
+ ## `serve-local`
43
+
44
+ The `serve-local` target runs the **targeted project** and **every project connected to it transitively**, all on your machine. The connection generator wires this up automatically — running `serve-local` on the website also starts local servers for the `api`, the `agent`, and the `mcp` server it reaches through the agent.
45
+
46
+ <NxCommands commands={['serve-local website']} />
47
+
48
+ When run this way, the website's `runtime-config.json` is automatically overridden (via [Vite's `MODE`](https://vite.dev/guide/env-and-mode), set to `serve-local`) so that it points at your locally running servers instead of deployed URLs.
49
+
50
+ ```d2
51
+ direction: right
52
+
53
+ local: Local {
54
+ style.stroke-dash: 3
55
+ website: website
56
+ api: api
57
+ agent: agent
58
+ mcp: mcp
59
+
60
+ website -> api
61
+ website -> agent
62
+ agent -> mcp
63
+ }
64
+ ```
65
+
66
+ Every project runs locally, so there are no deployed dependencies.
67
+
68
+ Use `serve-local` when you are working across several connected projects at once and want to iterate quickly without deploying your infrastructure.
69
+
70
+ :::tip[`dev` shortcut]
71
+ A root `dev` script is added as a shortcut for the first website you generate in your workspace, so you can spin up the website and all connected components with:
72
+
73
+ <PackageManagerShortCommand commands={["dev"]} />
74
+ :::
75
+
76
+ For more detail on each project type's local development server, see the relevant guide — for example the <Link path="guides/react-website#local-development-server">React Website</Link> guide.
@@ -583,6 +583,7 @@ When this generator is run in our repository, it'll generate the following files
583
583
  - docs/src/content/docs/guides/
584
584
  - \<name>.mdx Documentation page for your generator
585
585
  - packages/nx-plugin/generators.json Updated to include your generator
586
+ - packages/nx-plugin/sdk/\<prefix>.ts Updated to expose your generator from the SDK (for `ts#` and `py#` generators)
586
587
  </FileTree>
587
588
 
588
589
  You can then start to implement your generator.
@@ -11,7 +11,6 @@ import GeneratorParameters from '@components/generator-parameters.astro';
11
11
  import Infrastructure from '@components/infrastructure.astro';
12
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
15
  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.
17
16
 
@@ -41,6 +40,7 @@ The generator creates the following project structure in the `<directory>/<name>
41
40
  - entities
42
41
  - example.ts Example ElectroDB entity definition
43
42
  - index.ts Entity exports
43
+ - dynamodb.config.json GSI definitions for the table
44
44
  - project.json Project configuration and build targets
45
45
  </FileTree>
46
46
 
@@ -84,7 +84,7 @@ The generator configures a `serve-local` target that starts a [DynamoDB Local](h
84
84
  This automatically:
85
85
  1. Pulls the DynamoDB Local image (`pull-image` target)
86
86
  2. Starts a container
87
- 3. Creates a local table with pre-defined indexes
87
+ 3. Creates a local table with the indexes defined in `dynamodb.config.json`
88
88
 
89
89
  ### Data Modelling
90
90
 
@@ -165,11 +165,34 @@ Replace `<engine>` with your container engine (`docker` or `finch`) and `<scope>
165
165
 
166
166
  ## Adding/Removing Global Secondary Indexes
167
167
 
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.
168
+ GSIs are defined in `dynamodb.config.json` at the project root. Add an entry to `globalSecondaryIndexes` for each GSI, following the [single-table design](https://electrodb.dev/en/core-concepts/single-table-relationships/) naming convention for GSI keys:
169
169
 
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>
170
+ ```json title="packages/my-table/dynamodb.config.json"
171
+ {
172
+ "globalSecondaryIndexes": [
173
+ {
174
+ "indexName": "gsi1pk-gsi1sk-index",
175
+ "partitionKey": "gsi1pk",
176
+ "sortKey": "gsi1sk"
177
+ }
178
+ ]
179
+ }
180
+ ```
181
+
182
+ The `sortKey` field is optional for hash-key-only GSIs.
183
+
184
+ This config file is read directly from the project root by all consumers:
185
+ - **Local development** — `serve-local` reads `dynamodb.config.json` and creates or updates the local table to match the GSI list
186
+ - **CDK** — the construct reads `dynamodb.config.json` at synth time, so GSI changes are reflected on the next `cdk deploy`
187
+ - **Terraform** — the module reads `dynamodb.config.json` at plan/apply time
188
+
189
+ ### One GSI per Deployment
190
+
191
+ :::caution
192
+ DynamoDB [does not allow more than one GSI to be created or deleted in a single table update](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html).
193
+
194
+ Each deployment can add or remove **at most one GSI**. If you need to add or remove multiple GSIs, do so one at a time — update `dynamodb.config.json`, deploy the stack, then repeat for the next change.
195
+ :::
173
196
 
174
197
  ## Connecting to the Table
175
198
 
@@ -217,7 +240,7 @@ export class ApplicationStack extends Stack {
217
240
 
218
241
  This provisions a DynamoDB table with:
219
242
  - `pk` (partition key) and `sk` (sort key), both `String` type
220
- - 2 Global Secondary Indexes by default, as defined in `src/gsi.ts`
243
+ - Global Secondary Indexes as defined in `dynamodb.config.json`
221
244
  - On-demand (`PAY_PER_REQUEST`) billing
222
245
  - Customer-managed KMS encryption with automatic key rotation
223
246
  - Point-in-time recovery enabled
@@ -235,7 +258,7 @@ module "my_table" {
235
258
 
236
259
  This provisions a DynamoDB table with:
237
260
  - `pk` (partition key) and `sk` (sort key), both `String` type
238
- - 2 Global Secondary Indexes by default, as defined in `src/gsi.ts`
261
+ - Global Secondary Indexes as defined in `dynamodb.config.json`
239
262
  - On-demand (`PAY_PER_REQUEST`) billing
240
263
  - Customer-managed KMS encryption with automatic key rotation
241
264
  - Point-in-time recovery enabled
package/generators.json CHANGED
@@ -3,6 +3,19 @@
3
3
  "name": "@aws/nx-plugin",
4
4
  "version": "0.0.1",
5
5
  "generators": {
6
+ "agentcore-gateway": {
7
+ "factory": "./src/agentcore-gateway/generator",
8
+ "schema": "./src/agentcore-gateway/schema.json",
9
+ "description": "Generate an AgentCore Gateway project",
10
+ "metric": "g48"
11
+ },
12
+ "agentcore-gateway#mcp-connection": {
13
+ "factory": "./src/agentcore-gateway/mcp-connection/generator",
14
+ "schema": "./src/agentcore-gateway/mcp-connection/schema.json",
15
+ "description": "Connect an AgentCore Gateway to an MCP server",
16
+ "metric": "g49",
17
+ "hidden": true
18
+ },
6
19
  "connection": {
7
20
  "factory": "./src/connection/generator",
8
21
  "schema": "./src/connection/schema.json",
@@ -23,7 +36,10 @@
23
36
  "connection/trpc-rdb",
24
37
  "connection/smithy-rdb",
25
38
  "connection/ts-mcp-server-rdb",
26
- "connection/ts-agent-rdb"
39
+ "connection/ts-agent-rdb",
40
+ "connection/ts-agent-gateway",
41
+ "connection/py-agent-gateway",
42
+ "connection/agentcore-gateway-mcp"
27
43
  ]
28
44
  },
29
45
  "license": {
@@ -279,6 +295,13 @@
279
295
  "metric": "g35",
280
296
  "hidden": true
281
297
  },
298
+ "ts#agent#gateway-connection": {
299
+ "factory": "./src/ts/agent/gateway-connection/generator",
300
+ "schema": "./src/ts/agent/gateway-connection/schema.json",
301
+ "description": "Connect a TypeScript Agent to an AgentCore Gateway",
302
+ "metric": "g50",
303
+ "hidden": true
304
+ },
282
305
  "py#agent#a2a-connection": {
283
306
  "factory": "./src/py/agent/a2a-connection/generator",
284
307
  "schema": "./src/py/agent/a2a-connection/schema.json",
@@ -286,6 +309,13 @@
286
309
  "metric": "g36",
287
310
  "hidden": true
288
311
  },
312
+ "py#agent#gateway-connection": {
313
+ "factory": "./src/py/agent/gateway-connection/generator",
314
+ "schema": "./src/py/agent/gateway-connection/schema.json",
315
+ "description": "Connect a Python Agent to an AgentCore Gateway",
316
+ "metric": "g51",
317
+ "hidden": true
318
+ },
289
319
  "ts#sync": {
290
320
  "factory": "./src/ts/sync/generator",
291
321
  "schema": "./src/ts/sync/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.10",
3
+ "version": "1.0.0-rc.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "agentcore-gateway#mcp-connection",
4
+ "title": "agentcore-gateway#mcp-connection",
5
+ "description": "Connect an AgentCore Gateway to an MCP server",
6
+ "type": "object",
7
+ "properties": {
8
+ "sourceProject": {
9
+ "type": "string",
10
+ "description": "The gateway project"
11
+ },
12
+ "targetProject": {
13
+ "type": "string",
14
+ "description": "The MCP server project"
15
+ },
16
+ "sourceComponent": {
17
+ "type": "string",
18
+ "description": "The gateway component in the source project"
19
+ },
20
+ "targetComponent": {
21
+ "type": "string",
22
+ "description": "The MCP server component in the target project"
23
+ }
24
+ },
25
+ "required": ["sourceProject", "targetProject"]
26
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "agentcore-gateway",
4
+ "title": "agentcore-gateway",
5
+ "description": "Generate an AgentCore Gateway project",
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "type": "string",
10
+ "description": "The name of your AgentCore Gateway project",
11
+ "$default": {
12
+ "$source": "argv",
13
+ "index": 0
14
+ },
15
+ "x-prompt": "What would you like to call your AgentCore Gateway?",
16
+ "x-priority": "important"
17
+ },
18
+ "directory": {
19
+ "type": "string",
20
+ "description": "Parent directory where the gateway project is placed.",
21
+ "default": "packages"
22
+ },
23
+ "subDirectory": {
24
+ "type": "string",
25
+ "description": "The sub directory the project is placed in. By default this is the project name."
26
+ },
27
+ "protocol": {
28
+ "type": "string",
29
+ "description": "The inbound protocol exposed by your gateway. Only mcp is supported today; additional protocols may be added in future.",
30
+ "enum": ["mcp"],
31
+ "default": "mcp",
32
+ "x-priority": "important"
33
+ },
34
+ "auth": {
35
+ "type": "string",
36
+ "description": "The method used to authenticate inbound requests to your gateway. Only iam is supported today; cognito and custom-jwt may be added in future.",
37
+ "enum": ["iam"],
38
+ "default": "iam",
39
+ "x-priority": "important"
40
+ },
41
+ "cedarPolicy": {
42
+ "type": "boolean",
43
+ "description": "Whether to include a Cedar policy engine enforcing fine-grained authorization on the gateway.",
44
+ "default": true,
45
+ "x-priority": "important"
46
+ },
47
+ "infra": {
48
+ "type": "string",
49
+ "description": "The type of infrastructure to host your gateway. Select none for no hosting.",
50
+ "x-prompt": "How would you like to host your gateway?",
51
+ "enum": ["agentcore", "none"],
52
+ "default": "agentcore",
53
+ "x-priority": "important"
54
+ },
55
+ "iac": {
56
+ "type": "string",
57
+ "description": "The preferred IaC provider. By default this is inherited from your initial selection.",
58
+ "enum": ["inherit", "cdk", "terraform"],
59
+ "x-priority": "important",
60
+ "default": "inherit",
61
+ "x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
62
+ }
63
+ },
64
+ "required": ["name"]
65
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "py#agent#gateway-connection",
4
+ "title": "py#agent#gateway-connection",
5
+ "description": "Connect a Python Agent to an AgentCore Gateway",
6
+ "type": "object",
7
+ "properties": {
8
+ "sourceProject": {
9
+ "type": "string",
10
+ "description": "The Python Agent project"
11
+ },
12
+ "targetProject": {
13
+ "type": "string",
14
+ "description": "The AgentCore Gateway project"
15
+ },
16
+ "sourceComponent": {
17
+ "type": "string",
18
+ "description": "The agent component in the source project"
19
+ },
20
+ "targetComponent": {
21
+ "type": "string",
22
+ "description": "The gateway component in the target project"
23
+ }
24
+ },
25
+ "required": ["sourceProject", "targetProject"]
26
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "ts#agent#gateway-connection",
4
+ "title": "ts#agent#gateway-connection",
5
+ "description": "Connect a TypeScript Agent to an AgentCore Gateway",
6
+ "type": "object",
7
+ "properties": {
8
+ "sourceProject": {
9
+ "type": "string",
10
+ "description": "The TypeScript Agent project"
11
+ },
12
+ "targetProject": {
13
+ "type": "string",
14
+ "description": "The AgentCore Gateway project"
15
+ },
16
+ "sourceComponent": {
17
+ "type": "string",
18
+ "description": "The agent component in the source project"
19
+ },
20
+ "targetComponent": {
21
+ "type": "string",
22
+ "description": "The gateway component in the target project"
23
+ }
24
+ },
25
+ "required": ["sourceProject", "targetProject"]
26
+ }