@aws/nx-plugin-mcp 1.0.0-rc.4 → 1.0.0-rc.41
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 +2240 -1030
- package/docs/get_started/building-with-ai.mdx +116 -0
- package/docs/get_started/concepts.mdx +52 -0
- package/docs/get_started/existing-project.mdx +176 -0
- package/docs/get_started/quick-start.mdx +266 -0
- package/docs/get_started/tutorials/contribute-generator.mdx +405 -0
- package/docs/get_started/tutorials/dungeon-game/1.mdx +1205 -0
- package/docs/get_started/tutorials/dungeon-game/2.mdx +237 -0
- package/docs/get_started/tutorials/dungeon-game/3.mdx +76 -0
- package/docs/get_started/tutorials/dungeon-game/4.mdx +162 -0
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +144 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
- package/docs/get_started/tutorials/existing-project.mdx +4 -0
- package/docs/guides/agentcore-gateway.mdx +376 -0
- package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
- package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
- package/docs/guides/connection/py-agent-a2a.mdx +47 -15
- package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-agent-gateway.mdx +176 -0
- package/docs/guides/connection/py-agent-mcp.mdx +42 -13
- package/docs/guides/connection/py-agent-rdb.mdx +178 -0
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
- package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
- package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -0
- package/docs/guides/connection/react-agui.mdx +4 -4
- package/docs/guides/connection/react-fastapi.mdx +38 -2
- package/docs/guides/connection/react-py-agent.mdx +7 -13
- package/docs/guides/connection/react-smithy.mdx +3 -3
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +8 -8
- package/docs/guides/connection/smithy-dynamodb.mdx +4 -4
- package/docs/guides/connection/smithy-rdb.mdx +5 -5
- package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
- package/docs/guides/connection/trpc-rdb.mdx +5 -5
- package/docs/guides/connection/ts-agent-a2a.mdx +12 -9
- package/docs/guides/connection/ts-agent-dynamodb.mdx +3 -3
- package/docs/guides/connection/ts-agent-gateway.mdx +141 -0
- package/docs/guides/connection/ts-agent-mcp.mdx +11 -8
- package/docs/guides/connection/ts-agent-rdb.mdx +66 -21
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +3 -3
- package/docs/guides/connection/ts-mcp-server-rdb.mdx +66 -16
- package/docs/guides/connection.mdx +104 -5
- package/docs/guides/docker-bundling.mdx +68 -8
- package/docs/guides/fastapi.mdx +244 -4
- package/docs/guides/license.mdx +264 -109
- package/docs/guides/local-development.mdx +87 -0
- package/docs/guides/nx-generator.mdx +7 -2
- package/docs/guides/py-agent.mdx +257 -49
- package/docs/guides/py-dynamodb.mdx +476 -0
- package/docs/guides/py-mcp-server.mdx +61 -2
- package/docs/guides/py-rdb.mdx +254 -0
- package/docs/guides/react-website-auth.mdx +58 -1
- package/docs/guides/react-website.mdx +130 -19
- package/docs/guides/security.mdx +75 -0
- package/docs/guides/terraform-project.mdx +1 -1
- package/docs/guides/trpc.mdx +45 -9
- package/docs/guides/ts-agent.mdx +149 -9
- package/docs/guides/ts-dynamodb.mdx +62 -239
- package/docs/guides/ts-mcp-server.mdx +66 -3
- package/docs/guides/ts-nx-plugin.mdx +1 -1
- package/docs/guides/ts-rdb.mdx +117 -470
- package/docs/guides/ts-smithy-api.mdx +183 -4
- package/docs/guides/typescript-infrastructure.mdx +9 -1
- package/docs/guides/typescript-project.mdx +5 -10
- package/docs/guides/workspace.mdx +2 -2
- package/docs/snippets/agent/architecture.mdx +1 -1
- package/docs/snippets/agent/bedrock-deployment.mdx +4 -0
- package/docs/snippets/agent/runtime-arn.mdx +21 -0
- package/docs/snippets/agent/securing-your-agent.mdx +39 -0
- package/docs/snippets/api/access-logging.mdx +33 -0
- package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
- package/docs/snippets/api/waf-configuration.mdx +1 -1
- package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
- package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
- package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
- package/docs/snippets/connection/rdb-api-infrastructure.mdx +50 -18
- package/docs/snippets/dynamodb/deploying-table.mdx +166 -0
- package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
- package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
- package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
- package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
- package/docs/snippets/mcp/architecture.mdx +1 -1
- package/docs/snippets/mcp/bedrock-deployment.mdx +4 -0
- package/docs/snippets/mcp/config.mdx +3 -2
- package/docs/snippets/rdb/architecture.mdx +38 -0
- package/docs/snippets/rdb/cluster-instances.mdx +31 -0
- package/docs/snippets/rdb/deletion-protection.mdx +34 -0
- package/docs/snippets/rdb/deploying.mdx +187 -0
- package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
- package/docs/snippets/rdb/engine-version.mdx +63 -0
- package/docs/snippets/rdb/infrastructure.mdx +35 -0
- package/docs/snippets/rdb/logging.mdx +32 -0
- package/docs/snippets/rdb/rds-proxy.mdx +50 -0
- package/docs/snippets/rdb/removal-policy.mdx +57 -0
- package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
- package/docs/snippets/required-prerequisites.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +27 -0
- package/generators.json +101 -2
- package/package.json +1 -1
- package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
- package/src/agentcore-gateway/schema.json +70 -0
- package/src/connection/schema.json +5 -0
- package/src/infra/app/schema.json +5 -0
- package/src/init/schema.json +35 -0
- package/src/license/schema.json +11 -0
- package/src/preset/schema.json +11 -5
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/gateway-connection/schema.json +31 -0
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/schema.json +5 -0
- package/src/py/agent/schema.json +6 -1
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/agent-connection/schema.json +27 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
- package/src/py/dynamodb/schema.json +75 -0
- package/src/py/fast-api/react/schema.json +5 -0
- package/src/py/fast-api/schema.json +5 -0
- package/src/py/lambda-function/schema.json +5 -0
- package/src/py/mcp-server/schema.json +5 -0
- package/src/py/project/schema.json +5 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.json +77 -0
- package/src/smithy/project/schema.json +5 -0
- package/src/smithy/react-connection/schema.json +5 -0
- package/src/smithy/ts/api/schema.json +5 -0
- package/src/terraform/project/schema.json +5 -0
- package/src/trpc/backend/schema.json +5 -0
- package/src/trpc/react/schema.json +5 -0
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/gateway-connection/schema.json +31 -0
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/schema.json +5 -0
- package/src/ts/agent/schema.json +5 -0
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/schema.json +3 -3
- package/src/ts/docs/schema.json +3 -3
- package/src/ts/dynamodb/agent-connection/schema.json +5 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
- package/src/ts/dynamodb/schema.json +25 -2
- package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/schema.json +5 -0
- package/src/ts/mcp-server/schema.json +5 -0
- package/src/ts/nx-generator/schema.json +5 -0
- package/src/ts/nx-plugin/schema.json +5 -0
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
- package/src/ts/rdb/schema.json +6 -1
- package/src/ts/rdb/smithy-connection/schema.json +5 -0
- package/src/ts/rdb/trpc-connection/schema.json +5 -0
- package/src/ts/react-website/app/schema.json +11 -6
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/runtime-config/schema.json +5 -0
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/schema.json +5 -0
- /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
- /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: DynamoDB
|
|
3
|
-
description: Create a DynamoDB project
|
|
2
|
+
title: TypeScript DynamoDB
|
|
3
|
+
description: Create a TypeScript DynamoDB project
|
|
4
4
|
generator: ts#dynamodb
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileTree } from '@astrojs/starlight/components';
|
|
7
|
+
import { FileTree, CardGrid } from '@astrojs/starlight/components';
|
|
8
|
+
import Astro from '@astrojs/react';
|
|
9
|
+
import ConnectionCard from '@components/connection-card.astro';
|
|
8
10
|
import Link from '@components/link.astro';
|
|
9
11
|
import RunGenerator from '@components/run-generator.astro';
|
|
10
12
|
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
11
|
-
import Infrastructure from '@components/infrastructure.astro';
|
|
12
|
-
import NxCommands from '@components/nx-commands.astro';
|
|
13
13
|
import Snippet from '@components/snippet.astro';
|
|
14
|
-
import OptionFilter from '@components/option-filter.astro';
|
|
15
14
|
|
|
16
|
-
This generator creates a new TypeScript project backed by [Amazon DynamoDB](https://aws.amazon.com/dynamodb/), using [ElectroDB](https://electrodb.dev/) for type-safe entity modelling. It generates the application code and infrastructure needed to provision and manage a DynamoDB table using AWS CDK or Terraform, with single-table design support and built-in local development via DynamoDB Local.
|
|
15
|
+
This generator creates a new TypeScript DynamoDB project backed by [Amazon DynamoDB](https://aws.amazon.com/dynamodb/), using [ElectroDB](https://electrodb.dev/) for type-safe entity modelling. It generates the application code and infrastructure needed to provision and manage a DynamoDB table using AWS CDK or Terraform, with single-table design support and built-in local development via DynamoDB Local.
|
|
17
16
|
|
|
18
17
|
## Usage
|
|
19
18
|
|
|
20
|
-
### Generate a DynamoDB Project
|
|
19
|
+
### Generate a TypeScript DynamoDB Project
|
|
21
20
|
|
|
22
21
|
<RunGenerator generator="ts#dynamodb" />
|
|
23
22
|
|
|
@@ -30,65 +29,38 @@ This generator creates a new TypeScript project backed by [Amazon DynamoDB](http
|
|
|
30
29
|
The generator creates the following project structure in the `<directory>/<name>` directory:
|
|
31
30
|
|
|
32
31
|
<FileTree>
|
|
33
|
-
- scripts
|
|
34
|
-
- create-local-table.ts Creates the DynamoDB table in the local DynamoDB Local instance
|
|
35
|
-
- pull-image.ts Pulls the DynamoDB Local image
|
|
36
|
-
- start-container.ts Starts the DynamoDB Local container
|
|
37
32
|
- src
|
|
38
33
|
- index.ts Project entry point and exports
|
|
39
|
-
- constants.ts Local development constants and runtime config key
|
|
40
34
|
- client.ts DynamoDB client singleton and table name resolution
|
|
41
35
|
- entities
|
|
42
36
|
- example.ts Example ElectroDB entity definition
|
|
43
37
|
- index.ts Entity exports
|
|
38
|
+
- config.json Table configuration including GSI definitions and local development settings
|
|
44
39
|
- project.json Project configuration and build targets
|
|
45
40
|
</FileTree>
|
|
46
41
|
|
|
42
|
+
The local development scripts are shared across all DynamoDB projects (both TypeScript and Python) and generated once into:
|
|
43
|
+
|
|
44
|
+
<FileTree>
|
|
45
|
+
- packages/common/scripts/src/dynamodb
|
|
46
|
+
- create-local-table.ts Creates the DynamoDB table in the local DynamoDB Local instance
|
|
47
|
+
- pull-image.ts Pulls the DynamoDB Local image
|
|
48
|
+
- start-container.ts Starts the DynamoDB Local container
|
|
49
|
+
</FileTree>
|
|
50
|
+
|
|
47
51
|
### Infrastructure
|
|
48
52
|
|
|
49
|
-
<Snippet name="
|
|
50
|
-
|
|
51
|
-
<Infrastructure>
|
|
52
|
-
<Fragment slot="cdk">
|
|
53
|
-
<FileTree>
|
|
54
|
-
- packages/common/constructs/src
|
|
55
|
-
- app
|
|
56
|
-
- dynamodb
|
|
57
|
-
- \<name>.ts Infrastructure specific to your table
|
|
58
|
-
- core
|
|
59
|
-
- dynamodb.ts Generic DynamoDB table construct
|
|
60
|
-
</FileTree>
|
|
61
|
-
</Fragment>
|
|
62
|
-
<Fragment slot="terraform">
|
|
63
|
-
<FileTree>
|
|
64
|
-
- packages/common/terraform/src
|
|
65
|
-
- app
|
|
66
|
-
- dynamodb
|
|
67
|
-
- \<name>
|
|
68
|
-
- \<name>.tf Module specific to your table
|
|
69
|
-
- core
|
|
70
|
-
- dynamodb
|
|
71
|
-
- dynamodb.tf Generic DynamoDB module
|
|
72
|
-
</FileTree>
|
|
73
|
-
</Fragment>
|
|
74
|
-
</Infrastructure>
|
|
53
|
+
<Snippet name="dynamodb/infrastructure" />
|
|
75
54
|
|
|
76
55
|
## Local Development
|
|
77
56
|
|
|
78
57
|
### Starting Local DynamoDB
|
|
79
58
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<NxCommands commands={['run <project-name>:serve-local']} />
|
|
83
|
-
|
|
84
|
-
This automatically:
|
|
85
|
-
1. Pulls the DynamoDB Local image (`pull-image` target)
|
|
86
|
-
2. Starts a container
|
|
87
|
-
3. Creates a local table with pre-defined indexes
|
|
59
|
+
<Snippet name="dynamodb/local-dev-start" />
|
|
88
60
|
|
|
89
61
|
### Data Modelling
|
|
90
62
|
|
|
91
|
-
The generated project uses [ElectroDB](https://electrodb.dev/) for type-safe entity modelling on a single DynamoDB table. Add or update entity files under `src/entities/`, using the generated example entity as a starting point.
|
|
63
|
+
The generated project uses [ElectroDB](https://electrodb.dev/) for type-safe entity modelling on a single DynamoDB table, following [DynamoDB's single-table design](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/data-modeling-foundations.html). Add or update entity files under `src/entities/`, using the generated example entity as a starting point.
|
|
92
64
|
|
|
93
65
|
Example entity definition:
|
|
94
66
|
|
|
@@ -146,30 +118,18 @@ For more details, see the [ElectroDB entity documentation](https://electrodb.dev
|
|
|
146
118
|
|
|
147
119
|
The generated `src/client.ts` exports two key utilities:
|
|
148
120
|
|
|
149
|
-
- `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `
|
|
150
|
-
- `resolveTableName()` — returns the DynamoDB table name. When `
|
|
121
|
+
- `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `LOCAL_DEV=true`, connects to the local DynamoDB Local instance; otherwise creates an AWS client using the default credential chain.
|
|
122
|
+
- `resolveTableName()` — returns the DynamoDB table name. When `LOCAL_DEV=true`, returns the local table name constant; otherwise fetches the name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable and caches it for subsequent calls.
|
|
151
123
|
|
|
152
124
|
### Stopping Local DynamoDB
|
|
153
125
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
:::caution[Windows]
|
|
157
|
-
Due to limitations with signal handling on Windows, the container is not automatically removed when `serve-local` is stopped. You will need to remove it manually:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
<engine> rm -f <scope>-dynamodb
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Replace `<engine>` with your container engine (`docker` or `finch`) and `<scope>` with your Nx workspace scope (e.g. `proj`).
|
|
164
|
-
:::
|
|
126
|
+
<Snippet name="dynamodb/local-dev-windows" />
|
|
165
127
|
|
|
166
128
|
## Adding/Removing Global Secondary Indexes
|
|
167
129
|
|
|
168
|
-
|
|
130
|
+
GSIs are defined in `config.json` at the project root under the `tableConfig.globalSecondaryIndexes` key. Add an entry for each GSI, following the [single-table design](https://electrodb.dev/en/core-concepts/single-table-relationships/) naming convention for GSI keys:
|
|
169
131
|
|
|
170
|
-
<
|
|
171
|
-
Unlike CDK, changes to `src/gsi.ts` are not automatically reflected in your Terraform module. You must also manually update your Terraform module to add or remove the corresponding GSI definitions before deploying.
|
|
172
|
-
</OptionFilter>
|
|
132
|
+
<Snippet name="dynamodb/gsi-config" parentHeading="Adding/Removing Global Secondary Indexes" />
|
|
173
133
|
|
|
174
134
|
## Connecting to the Table
|
|
175
135
|
|
|
@@ -186,179 +146,42 @@ const result = await entity.query.primary({ id: '123' }).go();
|
|
|
186
146
|
When running in AWS, `resolveTableName()` fetches the table name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable. Projects built with this plugin (tRPC APIs, Smithy APIs, agents, MCP servers) already have this variable configured automatically. For other TypeScript projects, ensure `RUNTIME_CONFIG_APP_ID` is set in the runtime environment with the AppConfig application ID provisioned by your infrastructure. For more information, see the <Link path="guides/runtime-config">Runtime Configuration guide</Link>.
|
|
187
147
|
:::
|
|
188
148
|
|
|
189
|
-
### Connection Generators
|
|
190
|
-
|
|
191
|
-
For specific project types, use the `connection` generator to automatically wire up local development dependencies so DynamoDB Local starts automatically alongside your project:
|
|
192
|
-
|
|
193
|
-
- <Link path="guides/connection/trpc-dynamodb">tRPC API → DynamoDB</Link>
|
|
194
|
-
- <Link path="guides/connection/smithy-dynamodb">Smithy API → DynamoDB</Link>
|
|
195
|
-
- <Link path="guides/connection/ts-agent-dynamodb">TypeScript Agent → DynamoDB</Link>
|
|
196
|
-
- <Link path="guides/connection/ts-mcp-server-dynamodb">MCP Server → DynamoDB</Link>
|
|
197
|
-
|
|
198
149
|
## Deploying your Table
|
|
199
150
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
- `pk` (partition key) and `sk` (sort key), both `String` type
|
|
238
|
-
- 2 Global Secondary Indexes by default, as defined in `src/gsi.ts`
|
|
239
|
-
- On-demand (`PAY_PER_REQUEST`) billing
|
|
240
|
-
- Customer-managed KMS encryption with automatic key rotation
|
|
241
|
-
- Point-in-time recovery enabled
|
|
242
|
-
- Deletion protection enabled
|
|
243
|
-
- Table name registered in Runtime Config
|
|
244
|
-
</Fragment>
|
|
245
|
-
</Infrastructure>
|
|
246
|
-
|
|
247
|
-
### Granting Access
|
|
248
|
-
|
|
249
|
-
<Snippet name="connection/lambda-dynamodb-access" />
|
|
250
|
-
|
|
251
|
-
### Deletion Protection
|
|
252
|
-
|
|
253
|
-
Deletion protection is enabled by default to prevent accidental table deletion.
|
|
254
|
-
|
|
255
|
-
#### Disable Deletion Protection
|
|
256
|
-
|
|
257
|
-
Disable it for environments where table deletion is expected, such as short-lived development or preview stacks.
|
|
258
|
-
|
|
259
|
-
<Infrastructure>
|
|
260
|
-
<Fragment slot="cdk">
|
|
261
|
-
|
|
262
|
-
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
263
|
-
import { MyTable } from ':my-scope/common-constructs';
|
|
264
|
-
|
|
265
|
-
const table = new MyTable(this, 'Table', {
|
|
266
|
-
deletionProtection: false,
|
|
267
|
-
});
|
|
268
|
-
```
|
|
269
|
-
</Fragment>
|
|
270
|
-
<Fragment slot="terraform">
|
|
271
|
-
|
|
272
|
-
```hcl title="packages/infra/src/main.tf"
|
|
273
|
-
module "my_table" {
|
|
274
|
-
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
275
|
-
deletion_protection_enabled = false
|
|
276
|
-
}
|
|
277
|
-
```
|
|
278
|
-
</Fragment>
|
|
279
|
-
</Infrastructure>
|
|
280
|
-
|
|
281
|
-
### Billing Mode
|
|
282
|
-
|
|
283
|
-
The table defaults to on-demand (`PAY_PER_REQUEST`) billing. Switch to provisioned capacity for predictable, high-throughput workloads.
|
|
284
|
-
|
|
285
|
-
<Infrastructure>
|
|
286
|
-
<Fragment slot="cdk">
|
|
287
|
-
|
|
288
|
-
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
289
|
-
import { BillingMode } from 'aws-cdk-lib/aws-dynamodb';
|
|
290
|
-
import { MyTable } from ':my-scope/common-constructs';
|
|
291
|
-
|
|
292
|
-
const table = new MyTable(this, 'Table', {
|
|
293
|
-
billingMode: BillingMode.PROVISIONED,
|
|
294
|
-
readCapacity: 5,
|
|
295
|
-
writeCapacity: 5,
|
|
296
|
-
});
|
|
297
|
-
```
|
|
298
|
-
</Fragment>
|
|
299
|
-
<Fragment slot="terraform">
|
|
300
|
-
|
|
301
|
-
```hcl title="packages/infra/src/main.tf"
|
|
302
|
-
module "my_table" {
|
|
303
|
-
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
304
|
-
billing_mode = "PROVISIONED"
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
</Fragment>
|
|
308
|
-
</Infrastructure>
|
|
309
|
-
|
|
310
|
-
### Point-in-time Recovery
|
|
311
|
-
|
|
312
|
-
[Point-in-time recovery](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Point-in-time-recovery.html) is enabled by default, allowing you to restore the table to any point in the last 35 days.
|
|
313
|
-
|
|
314
|
-
#### Disable Point-in-time Recovery
|
|
315
|
-
|
|
316
|
-
<Infrastructure>
|
|
317
|
-
<Fragment slot="cdk">
|
|
318
|
-
|
|
319
|
-
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
320
|
-
import { MyTable } from ':my-scope/common-constructs';
|
|
321
|
-
|
|
322
|
-
const table = new MyTable(this, 'Table', {
|
|
323
|
-
pointInTimeRecoverySpecification: { pointInTimeRecoveryEnabled: false },
|
|
324
|
-
});
|
|
325
|
-
```
|
|
326
|
-
</Fragment>
|
|
327
|
-
<Fragment slot="terraform">
|
|
328
|
-
|
|
329
|
-
```hcl title="packages/infra/src/main.tf"
|
|
330
|
-
module "my_table" {
|
|
331
|
-
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
332
|
-
point_in_time_recovery_enabled = false
|
|
333
|
-
}
|
|
334
|
-
```
|
|
335
|
-
</Fragment>
|
|
336
|
-
</Infrastructure>
|
|
337
|
-
|
|
338
|
-
### Encryption Key Rotation
|
|
339
|
-
|
|
340
|
-
The KMS key used to encrypt the table has automatic key rotation enabled by default. Disable it if your security policy manages rotation externally.
|
|
341
|
-
|
|
342
|
-
#### Disable Encryption Key Rotation
|
|
343
|
-
|
|
344
|
-
<Infrastructure>
|
|
345
|
-
<Fragment slot="cdk">
|
|
346
|
-
|
|
347
|
-
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
348
|
-
import { MyTable } from ':my-scope/common-constructs';
|
|
349
|
-
|
|
350
|
-
const table = new MyTable(this, 'Table', {
|
|
351
|
-
enableKeyRotation: false,
|
|
352
|
-
});
|
|
353
|
-
```
|
|
354
|
-
</Fragment>
|
|
355
|
-
<Fragment slot="terraform">
|
|
356
|
-
|
|
357
|
-
```hcl title="packages/infra/src/main.tf"
|
|
358
|
-
module "my_table" {
|
|
359
|
-
source = "../../common/terraform/src/app/dynamodb/my-table"
|
|
360
|
-
enable_key_rotation = false
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
</Fragment>
|
|
364
|
-
</Infrastructure>
|
|
151
|
+
<Snippet name="dynamodb/deploying-table" parentHeading="Deploying your Table" />
|
|
152
|
+
|
|
153
|
+
## Connections
|
|
154
|
+
|
|
155
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
156
|
+
|
|
157
|
+
<CardGrid>
|
|
158
|
+
<ConnectionCard
|
|
159
|
+
title="tRPC API to TypeScript DynamoDB"
|
|
160
|
+
description="Connect a tRPC API to a DynamoDB table"
|
|
161
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
|
|
162
|
+
source="trpc"
|
|
163
|
+
target="dynamodb"
|
|
164
|
+
/>
|
|
165
|
+
<ConnectionCard
|
|
166
|
+
title="Smithy API to TypeScript DynamoDB"
|
|
167
|
+
description="Connect a Smithy API to a DynamoDB table"
|
|
168
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/smithy-dynamodb`}
|
|
169
|
+
source="smithy"
|
|
170
|
+
target="dynamodb"
|
|
171
|
+
/>
|
|
172
|
+
<ConnectionCard
|
|
173
|
+
title="TypeScript Agent to TypeScript DynamoDB"
|
|
174
|
+
description="Connect a TypeScript Agent to a DynamoDB table"
|
|
175
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
|
|
176
|
+
source="strands"
|
|
177
|
+
sourceBadge="typescript"
|
|
178
|
+
target="dynamodb"
|
|
179
|
+
/>
|
|
180
|
+
<ConnectionCard
|
|
181
|
+
title="MCP Server to TypeScript DynamoDB"
|
|
182
|
+
description="Connect a TypeScript MCP Server to a DynamoDB table"
|
|
183
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
|
|
184
|
+
source="mcp"
|
|
185
|
+
target="dynamodb"
|
|
186
|
+
/>
|
|
187
|
+
</CardGrid>
|
|
@@ -4,7 +4,9 @@ description: Generate a TypeScript Model Context Protocol (MCP) server for provi
|
|
|
4
4
|
generator: ts#mcp-server
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileTree } from '@astrojs/starlight/components';
|
|
7
|
+
import { FileTree, CardGrid } from '@astrojs/starlight/components';
|
|
8
|
+
import Astro from '@astrojs/react';
|
|
9
|
+
import ConnectionCard from '@components/connection-card.astro';
|
|
8
10
|
import RunGenerator from '@components/run-generator.astro';
|
|
9
11
|
import NxCommands from '@components/nx-commands.astro';
|
|
10
12
|
import Link from '@components/link.astro';
|
|
@@ -54,7 +56,6 @@ The generator will add the following files to your existing TypeScript project:
|
|
|
54
56
|
- resources/
|
|
55
57
|
- sample-guidance.ts Sample resource
|
|
56
58
|
- Dockerfile Entry point for hosting your MCP server (excluded when `infra` is set to `None`)
|
|
57
|
-
- package.json Updated with bin entry and MCP dependencies
|
|
58
59
|
- project.json Updated with MCP server serve target
|
|
59
60
|
</FileTree>
|
|
60
61
|
|
|
@@ -120,14 +121,28 @@ server.registerResource('dynamic-resource', 'dynamic://resource', {}, async (uri
|
|
|
120
121
|
|
|
121
122
|
## Running Your MCP Server
|
|
122
123
|
|
|
124
|
+
### Local Development
|
|
125
|
+
|
|
126
|
+
To run your MCP server (and everything connected to it, such as a local database) locally, use the project's `dev` target:
|
|
127
|
+
|
|
128
|
+
<NxCommands commands={['dev your-project']} />
|
|
129
|
+
|
|
130
|
+
If you have added multiple components to your project (MCP servers, agents, etc.), this starts them all. To run just this MCP server, target its `<your-server-name>-dev` target:
|
|
131
|
+
|
|
132
|
+
<NxCommands commands={['your-server-name-dev your-project']} />
|
|
133
|
+
|
|
123
134
|
### Inspector
|
|
124
135
|
|
|
125
|
-
The generator configures a target named `<your-server-name>-inspect`, which starts the [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
|
|
136
|
+
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-dev` target, including any connected dependencies such as a local database) and launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) pre-configured to connect to it over Streamable HTTP transport.
|
|
126
137
|
|
|
127
138
|
<NxCommands commands={['your-server-name-inspect your-project']} />
|
|
128
139
|
|
|
129
140
|
This will start the inspector at `http://localhost:6274`. Get started by clicking on the "Connect" button.
|
|
130
141
|
|
|
142
|
+
:::tip
|
|
143
|
+
To inspect the server using STDIO transport instead, use the `<your-server-name>-inspect-stdio` target, which launches the inspector against a STDIO instance of your server.
|
|
144
|
+
:::
|
|
145
|
+
|
|
131
146
|
### STDIO
|
|
132
147
|
|
|
133
148
|
The easiest way to test and use an MCP server is by using the inspector or configuring it with an AI assistant (as above).
|
|
@@ -163,7 +178,55 @@ The generator configures a `<your-server-name>-docker` target which copies the `
|
|
|
163
178
|
|
|
164
179
|
A `docker` target is also generated which prepares the docker context for all MCP servers if you have multiple defined.
|
|
165
180
|
|
|
181
|
+
### Image Scanning
|
|
182
|
+
|
|
183
|
+
<Snippet name="trivy-image-scan" parentHeading="Image Scanning" />
|
|
184
|
+
|
|
166
185
|
### Observability
|
|
167
186
|
|
|
168
187
|
<Snippet name="mcp/observability" parentHeading="Observability" />
|
|
169
188
|
</OptionFilter>
|
|
189
|
+
|
|
190
|
+
## Connections
|
|
191
|
+
|
|
192
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
193
|
+
|
|
194
|
+
<CardGrid>
|
|
195
|
+
<ConnectionCard
|
|
196
|
+
title="TypeScript Agent to MCP"
|
|
197
|
+
description="Connect a TypeScript Agent to an MCP server"
|
|
198
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-mcp`}
|
|
199
|
+
source="strands"
|
|
200
|
+
sourceBadge="typescript"
|
|
201
|
+
target="mcp"
|
|
202
|
+
/>
|
|
203
|
+
<ConnectionCard
|
|
204
|
+
title="Python Agent to MCP"
|
|
205
|
+
description="Connect a Python Agent to an MCP server"
|
|
206
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-mcp`}
|
|
207
|
+
source="strands"
|
|
208
|
+
sourceBadge="python"
|
|
209
|
+
target="mcp"
|
|
210
|
+
/>
|
|
211
|
+
<ConnectionCard
|
|
212
|
+
title="MCP Server to Relational Database"
|
|
213
|
+
description="Connect a TypeScript MCP Server to an Aurora relational database"
|
|
214
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-rdb`}
|
|
215
|
+
source="mcp"
|
|
216
|
+
target="aurora"
|
|
217
|
+
/>
|
|
218
|
+
<ConnectionCard
|
|
219
|
+
title="MCP Server to TypeScript DynamoDB"
|
|
220
|
+
description="Connect a TypeScript MCP Server to a DynamoDB table"
|
|
221
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
|
|
222
|
+
source="mcp"
|
|
223
|
+
target="dynamodb"
|
|
224
|
+
/>
|
|
225
|
+
<ConnectionCard
|
|
226
|
+
title="AgentCore Gateway to MCP Server"
|
|
227
|
+
description="Aggregate an MCP server behind an AgentCore Gateway"
|
|
228
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-mcp`}
|
|
229
|
+
source="agentcore"
|
|
230
|
+
target="mcp"
|
|
231
|
+
/>
|
|
232
|
+
</CardGrid>
|
|
@@ -46,7 +46,7 @@ The generator will create the following project structure:
|
|
|
46
46
|
- generator-guide.ts Tool for detailed generator information
|
|
47
47
|
- utils.ts Utility functions for the MCP server
|
|
48
48
|
- generators.json Nx generator configuration (initially empty)
|
|
49
|
-
- package.json Plugin package configuration
|
|
49
|
+
- package.json Plugin package configuration
|
|
50
50
|
- tsconfig.json TypeScript configuration (CommonJS for Nx compatibility)
|
|
51
51
|
- project.json Nx project configuration with build and package targets
|
|
52
52
|
</FileTree>
|