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

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
@@ -19358,6 +19358,40 @@ var generators$1 = {
19358
19358
  "description": "Connect a ts#mcp-server to a ts#rdb project",
19359
19359
  "metric": "g42",
19360
19360
  "hidden": true
19361
+ },
19362
+ "ts#dynamodb": {
19363
+ "factory": "./src/ts/dynamodb/generator",
19364
+ "schema": "./src/ts/dynamodb/schema.json",
19365
+ "description": "Create a DynamoDB project",
19366
+ "metric": "g43"
19367
+ },
19368
+ "ts#dynamodb#trpc-connection": {
19369
+ "factory": "./src/ts/dynamodb/trpc-connection/generator",
19370
+ "schema": "./src/ts/dynamodb/trpc-connection/schema.json",
19371
+ "description": "Connect a ts#trpc-api project to a ts#dynamodb project",
19372
+ "metric": "g44",
19373
+ "hidden": true
19374
+ },
19375
+ "ts#dynamodb#smithy-connection": {
19376
+ "factory": "./src/ts/dynamodb/smithy-connection/generator",
19377
+ "schema": "./src/ts/dynamodb/smithy-connection/schema.json",
19378
+ "description": "Connect a Smithy backend to a ts#dynamodb project",
19379
+ "metric": "g45",
19380
+ "hidden": true
19381
+ },
19382
+ "ts#dynamodb#agent-connection": {
19383
+ "factory": "./src/ts/dynamodb/agent-connection/generator",
19384
+ "schema": "./src/ts/dynamodb/agent-connection/schema.json",
19385
+ "description": "Connect a ts#agent to a ts#dynamodb project",
19386
+ "metric": "g46",
19387
+ "hidden": true
19388
+ },
19389
+ "ts#dynamodb#mcp-server-connection": {
19390
+ "factory": "./src/ts/dynamodb/mcp-server-connection/generator",
19391
+ "schema": "./src/ts/dynamodb/mcp-server-connection/schema.json",
19392
+ "description": "Connect a ts#mcp-server to a ts#dynamodb project",
19393
+ "metric": "g47",
19394
+ "hidden": true
19361
19395
  }
19362
19396
  };
19363
19397
  //#endregion
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Smithy API to DynamoDB
3
+ description: Connect a Smithy API to a DynamoDB table
4
+ when:
5
+ sourceType: smithy
6
+ targetType: ts#dynamodb
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 Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-smithy-api">`ts#smithy-api`</Link> project (TypeScript backend)
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your Smithy API backend project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your Smithy API's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Operations
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your operation implementations:
43
+
44
+ ```ts title="packages/api/src/operations/list-examples.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import {
47
+ ListExamplesOperationInput,
48
+ ListExamplesOperationOutput,
49
+ } from '../generated/ssdk/index.js';
50
+ import { ServiceContext } from '../context.js';
51
+
52
+ export const listExamples = async (
53
+ _input: ListExamplesOperationInput,
54
+ _ctx: ServiceContext,
55
+ ): Promise<ListExamplesOperationOutput> => {
56
+ const entity = await createExampleEntity();
57
+ const result = await entity.scan.go();
58
+ return { items: result.data };
59
+ };
60
+ ```
61
+
62
+ ## Infrastructure
63
+
64
+ <Snippet name="connection/lambda-dynamodb-access" />
65
+
66
+ ## Local Development
67
+
68
+ <Snippet name="connection/dynamodb-local-development" />
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: tRPC API to DynamoDB
3
+ description: Connect a tRPC API to a DynamoDB table
4
+ when:
5
+ sourceType: ts#trpc-api
6
+ targetType: ts#dynamodb
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 Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/trpc">`ts#trpc-api`</Link> project
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your tRPC API project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your tRPC API's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Procedures
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your tRPC procedures:
43
+
44
+ ```ts title="packages/api/src/procedures/example.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import { publicProcedure } from '../init.js';
47
+
48
+ export const listExamples = publicProcedure
49
+ .query(async () => {
50
+ const entity = await createExampleEntity();
51
+ const result = await entity.scan.go();
52
+ return result.data;
53
+ });
54
+ ```
55
+
56
+ ## Infrastructure
57
+
58
+ <Snippet name="connection/lambda-dynamodb-access" />
59
+
60
+ ## Local Development
61
+
62
+ <Snippet name="connection/dynamodb-local-development" />
@@ -0,0 +1,128 @@
1
+ ---
2
+ title: TypeScript Agent to DynamoDB
3
+ description: Connect a TypeScript Agent to a DynamoDB table
4
+ when:
5
+ sourceType: ts#agent
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import NxCommands from '@components/nx-commands.astro';
12
+ import Infrastructure from '@components/infrastructure.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-agent">`ts#agent`</Link> project
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your Agent project as the source and your DynamoDB project as the target. If the project contains multiple agent components, specify `sourceComponent` to disambiguate.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
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.
39
+
40
+ ## Using DynamoDB in Agents
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your agent definition:
43
+
44
+ ```ts title="packages/my-service/src/my-agent/agent.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+
47
+ export const getAgent = async () => {
48
+ // ...
49
+ return new Agent({
50
+ tools: [
51
+ tool({
52
+ name: 'list_examples',
53
+ description: 'List all example items',
54
+ func: async () => {
55
+ const entity = await createExampleEntity();
56
+ const result = await entity.scan.go();
57
+ return result.data;
58
+ },
59
+ }),
60
+ ],
61
+ });
62
+ };
63
+ ```
64
+
65
+ ## Infrastructure
66
+
67
+ To allow the agent's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
68
+
69
+ <Infrastructure>
70
+ <Fragment slot="cdk">
71
+
72
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
73
+ import { MyTable } from ':my-scope/common-constructs';
74
+
75
+ const table = new MyTable(this, 'Table');
76
+ const myAgent = new MyAgent(this, 'MyAgent');
77
+
78
+ table.grantReadWriteData(myAgent);
79
+ ```
80
+
81
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the agent's execution role.
82
+ </Fragment>
83
+ <Fragment slot="terraform">
84
+
85
+ ```hcl title="packages/infra/src/main.tf"
86
+ module "my_table" {
87
+ source = "../../common/terraform/src/app/dynamodb/my-table"
88
+ }
89
+
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
+ })
121
+ }
122
+ ```
123
+ </Fragment>
124
+ </Infrastructure>
125
+
126
+ ## Local Development
127
+
128
+ <Snippet name="connection/dynamodb-local-development" />
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: MCP Server to DynamoDB
3
+ description: Connect a TypeScript MCP Server to a DynamoDB table
4
+ when:
5
+ sourceType: ts#mcp-server
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import NxCommands from '@components/nx-commands.astro';
12
+ import Infrastructure from '@components/infrastructure.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-mcp-server">TypeScript MCP Server</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-mcp-server">`ts#mcp-server`</Link> project
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your MCP server project as the source and your DynamoDB project as the target. If the project contains multiple MCP server components, specify `sourceComponent` to disambiguate.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates the MCP server's `<mcp-server-name>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Tools
41
+
42
+ Import entity factories from the DynamoDB package and use them inside `createServer`:
43
+
44
+ ```ts title="packages/my-service/src/my-mcp/server.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+
47
+ export const createServer = async () => {
48
+ const server = new McpServer({ name: 'my-service', version: '1.0.0' });
49
+
50
+ server.tool('list_examples', 'List all example items', {}, async () => {
51
+ const entity = await createExampleEntity();
52
+ const result = await entity.scan.go();
53
+ return {
54
+ content: [{ type: 'text', text: JSON.stringify(result.data) }],
55
+ };
56
+ });
57
+
58
+ return server;
59
+ };
60
+ ```
61
+
62
+ ## Infrastructure
63
+
64
+ To allow the MCP server to access the DynamoDB table, grant the necessary permissions in your infrastructure.
65
+
66
+ <Infrastructure>
67
+ <Fragment slot="cdk">
68
+
69
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
70
+ import { MyTable } from ':my-scope/common-constructs';
71
+
72
+ const table = new MyTable(this, 'Table');
73
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
74
+
75
+ table.grantReadWriteData(myMcpServer);
76
+ ```
77
+
78
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the MCP server's execution role.
79
+ </Fragment>
80
+ <Fragment slot="terraform">
81
+
82
+ ```hcl title="packages/infra/src/main.tf"
83
+ module "my_table" {
84
+ source = "../../common/terraform/src/app/dynamodb/my-table"
85
+ }
86
+
87
+ resource "aws_iam_role_policy" "dynamodb_access" {
88
+ role = module.my_mcp_server.lambda_role_name
89
+
90
+ policy = jsonencode({
91
+ Version = "2012-10-17"
92
+ Statement = [
93
+ {
94
+ Effect = "Allow"
95
+ Action = [
96
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
97
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
98
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
99
+ ]
100
+ Resource = [
101
+ module.my_table.table_arn,
102
+ "${module.my_table.table_arn}/index/*",
103
+ ]
104
+ },
105
+ {
106
+ Effect = "Allow"
107
+ Action = [
108
+ "kms:Encrypt",
109
+ "kms:Decrypt",
110
+ "kms:ReEncrypt*",
111
+ "kms:GenerateDataKey*",
112
+ "kms:DescribeKey",
113
+ ]
114
+ Resource = [module.my_table.kms_key_arn]
115
+ },
116
+ ]
117
+ })
118
+ }
119
+ ```
120
+ </Fragment>
121
+ </Infrastructure>
122
+
123
+ ## Local Development
124
+
125
+ <Snippet name="connection/dynamodb-local-development" />
@@ -119,6 +119,35 @@ The Connection generator supports the following connections:
119
119
  source="mcp"
120
120
  target="aurora"
121
121
  />
122
+ <ConnectionCard
123
+ title="tRPC API to DynamoDB"
124
+ description="Connect a tRPC API to a DynamoDB table"
125
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
126
+ source="trpc"
127
+ target="dynamodb"
128
+ />
129
+ <ConnectionCard
130
+ title="Smithy API to DynamoDB"
131
+ description="Connect a Smithy API to a DynamoDB table"
132
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/smithy-dynamodb`}
133
+ source="smithy"
134
+ target="dynamodb"
135
+ />
136
+ <ConnectionCard
137
+ title="TypeScript Agent to DynamoDB"
138
+ description="Connect a TypeScript Agent to a DynamoDB table"
139
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
140
+ source="strands"
141
+ sourceBadge="typescript"
142
+ target="dynamodb"
143
+ />
144
+ <ConnectionCard
145
+ title="MCP Server to DynamoDB"
146
+ description="Connect a TypeScript MCP Server to a DynamoDB table"
147
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
148
+ source="mcp"
149
+ target="dynamodb"
150
+ />
122
151
  </CardGrid>
123
152
 
124
153
  :::note[Runtime Configuration]