@aws/nx-plugin-mcp 1.0.0-rc.13 → 1.0.0-rc.14

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
@@ -20124,7 +20124,7 @@ var generators$1 = {
20124
20124
  "ts#dynamodb": {
20125
20125
  "factory": "./src/ts/dynamodb/generator",
20126
20126
  "schema": "./src/ts/dynamodb/schema.json",
20127
- "description": "Create a DynamoDB project",
20127
+ "description": "Create a TypeScript DynamoDB project",
20128
20128
  "metric": "g43"
20129
20129
  },
20130
20130
  "ts#dynamodb#trpc-connection": {
@@ -20154,6 +20154,33 @@ var generators$1 = {
20154
20154
  "description": "Connect a ts#mcp-server to a ts#dynamodb project",
20155
20155
  "metric": "g47",
20156
20156
  "hidden": true
20157
+ },
20158
+ "py#dynamodb": {
20159
+ "factory": "./src/py/dynamodb/generator",
20160
+ "schema": "./src/py/dynamodb/schema.json",
20161
+ "description": "Create a Python DynamoDB project",
20162
+ "metric": "g52"
20163
+ },
20164
+ "py#dynamodb#fast-api-connection": {
20165
+ "factory": "./src/py/dynamodb/fast-api-connection/generator",
20166
+ "schema": "./src/py/dynamodb/fast-api-connection/schema.json",
20167
+ "description": "Connect a py#fast-api project to a py#dynamodb project",
20168
+ "metric": "g53",
20169
+ "hidden": true
20170
+ },
20171
+ "py#dynamodb#agent-connection": {
20172
+ "factory": "./src/py/dynamodb/agent-connection/generator",
20173
+ "schema": "./src/py/dynamodb/agent-connection/schema.json",
20174
+ "description": "Connect a py#agent to a py#dynamodb project",
20175
+ "metric": "g54",
20176
+ "hidden": true
20177
+ },
20178
+ "py#dynamodb#mcp-server-connection": {
20179
+ "factory": "./src/py/dynamodb/mcp-server-connection/generator",
20180
+ "schema": "./src/py/dynamodb/mcp-server-connection/schema.json",
20181
+ "description": "Connect a py#mcp-server to a py#dynamodb project",
20182
+ "metric": "g55",
20183
+ "hidden": true
20157
20184
  }
20158
20185
  };
20159
20186
  //#endregion
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Python Agent to DynamoDB
3
+ description: Connect a Python Agent to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#agent
6
+ targetType: py#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 Infrastructure from '@components/infrastructure.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+
14
+ The `connection` generator wires a <Link path="guides/py-agent">Python Agent</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
15
+
16
+ ## Prerequisites
17
+
18
+ Before using this generator, ensure you have:
19
+
20
+ 1. A <Link path="guides/py-agent">`py#agent`</Link> project
21
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
22
+
23
+ ## Usage
24
+
25
+ ### Run the Generator
26
+
27
+ <RunGenerator generator="connection" />
28
+
29
+ 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.
30
+
31
+ ### Options
32
+
33
+ <GeneratorParameters generator="connection" />
34
+
35
+ ## Generator Output
36
+
37
+ The generator updates the agent's `<agent-name>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target, and adds the DynamoDB package as a workspace dependency. No source files are modified.
38
+
39
+ ## Using DynamoDB in Agents
40
+
41
+ Import entity classes from the DynamoDB package and use them inside your agent tools:
42
+
43
+ ```python title="packages/my_project/my_project/my_agent/agent.py"
44
+ from my_scope.my_table.entities.example import ExampleModel
45
+ from strands import tool
46
+
47
+ @tool
48
+ def list_examples() -> list:
49
+ """List all example items."""
50
+ return [item.attribute_values for item in ExampleModel.scan()]
51
+ ```
52
+
53
+ ## Infrastructure
54
+
55
+ To allow the agent's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
56
+
57
+ <Infrastructure>
58
+ <Fragment slot="cdk">
59
+
60
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
61
+ import { MyTable } from ':my-scope/common-constructs';
62
+
63
+ const table = new MyTable(this, 'Table');
64
+ const myAgent = new MyAgent(this, 'MyAgent');
65
+
66
+ table.grantReadWriteData(myAgent);
67
+ ```
68
+
69
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the agent's execution role.
70
+ </Fragment>
71
+ <Fragment slot="terraform">
72
+
73
+ ```hcl title="packages/infra/src/main.tf"
74
+ module "my_table" {
75
+ source = "../../common/terraform/src/app/dynamodb/my-table"
76
+ }
77
+
78
+ resource "aws_iam_role_policy" "dynamodb_access" {
79
+ role = module.my_agent.lambda_role_name
80
+
81
+ policy = jsonencode({
82
+ Version = "2012-10-17"
83
+ Statement = [
84
+ {
85
+ Effect = "Allow"
86
+ Action = [
87
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
88
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
89
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
90
+ ]
91
+ Resource = [
92
+ module.my_table.table_arn,
93
+ "${module.my_table.table_arn}/index/*",
94
+ ]
95
+ },
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "kms:Encrypt",
100
+ "kms:Decrypt",
101
+ "kms:ReEncrypt*",
102
+ "kms:GenerateDataKey*",
103
+ "kms:DescribeKey"
104
+ ]
105
+ Resource = [module.my_table.kms_key_arn]
106
+ },
107
+ ]
108
+ })
109
+ }
110
+ ```
111
+ </Fragment>
112
+ </Infrastructure>
113
+
114
+ ## Local Development
115
+
116
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: FastAPI to DynamoDB
3
+ description: Connect a FastAPI to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#fast-api
6
+ targetType: py#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 Snippet from '@components/snippet.astro';
12
+
13
+ The `connection` generator wires a <Link path="guides/fastapi">FastAPI</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
14
+
15
+ ## Prerequisites
16
+
17
+ Before using this generator, ensure you have:
18
+
19
+ 1. A <Link path="guides/fastapi">`py#fast-api`</Link> project
20
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
21
+
22
+ ## Usage
23
+
24
+ ### Run the Generator
25
+
26
+ <RunGenerator generator="connection" />
27
+
28
+ Select your FastAPI project as the source and your DynamoDB project as the target.
29
+
30
+ ### Options
31
+
32
+ <GeneratorParameters generator="connection" />
33
+
34
+ ## Generator Output
35
+
36
+ The generator updates the FastAPI's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target, and adds the DynamoDB package as a workspace dependency. No source files are modified.
37
+
38
+ ## Using DynamoDB in Route Handlers
39
+
40
+ Import entity classes from the DynamoDB package and use them inside your route handlers:
41
+
42
+ ```python title="packages/my_api/my_api/api.py"
43
+ from my_scope.my_table.entities.example import ExampleModel
44
+
45
+ @app.get("/examples")
46
+ def list_examples():
47
+ return list(ExampleModel.scan())
48
+ ```
49
+
50
+ ## Infrastructure
51
+
52
+ <Snippet name="connection/lambda-dynamodb-access" />
53
+
54
+ ## Local Development
55
+
56
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Python MCP Server to DynamoDB
3
+ description: Connect a Python MCP Server to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#mcp-server
6
+ targetType: py#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 Infrastructure from '@components/infrastructure.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+
14
+ The `connection` generator wires a <Link path="guides/py-mcp-server">Python MCP Server</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
15
+
16
+ ## Prerequisites
17
+
18
+ Before using this generator, ensure you have:
19
+
20
+ 1. A <Link path="guides/py-mcp-server">`py#mcp-server`</Link> project
21
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
22
+
23
+ ## Usage
24
+
25
+ ### Run the Generator
26
+
27
+ <RunGenerator generator="connection" />
28
+
29
+ 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.
30
+
31
+ ### Options
32
+
33
+ <GeneratorParameters generator="connection" />
34
+
35
+ ## Generator Output
36
+
37
+ 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, and adds the DynamoDB package as a workspace dependency. No source files are modified.
38
+
39
+ ## Using DynamoDB in Tools
40
+
41
+ Import entity classes from the DynamoDB package and use them inside your MCP server tools:
42
+
43
+ ```python title="packages/my_project/my_project/my_mcp_server/server.py"
44
+ from my_scope.my_table.entities.example import ExampleModel
45
+
46
+ @mcp.tool()
47
+ def list_examples() -> str:
48
+ """List all example items."""
49
+ items = list(ExampleModel.scan())
50
+ return str([item.attribute_values for item in items])
51
+ ```
52
+
53
+ ## Infrastructure
54
+
55
+ To allow the MCP server's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
56
+
57
+ <Infrastructure>
58
+ <Fragment slot="cdk">
59
+
60
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
61
+ import { MyTable } from ':my-scope/common-constructs';
62
+
63
+ const table = new MyTable(this, 'Table');
64
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
65
+
66
+ table.grantReadWriteData(myMcpServer);
67
+ ```
68
+
69
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the MCP server's execution role.
70
+ </Fragment>
71
+ <Fragment slot="terraform">
72
+
73
+ ```hcl title="packages/infra/src/main.tf"
74
+ module "my_table" {
75
+ source = "../../common/terraform/src/app/dynamodb/my-table"
76
+ }
77
+
78
+ resource "aws_iam_role_policy" "dynamodb_access" {
79
+ role = module.my_mcp_server.lambda_role_name
80
+
81
+ policy = jsonencode({
82
+ Version = "2012-10-17"
83
+ Statement = [
84
+ {
85
+ Effect = "Allow"
86
+ Action = [
87
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
88
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
89
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
90
+ ]
91
+ Resource = [
92
+ module.my_table.table_arn,
93
+ "${module.my_table.table_arn}/index/*",
94
+ ]
95
+ },
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "kms:Encrypt",
100
+ "kms:Decrypt",
101
+ "kms:ReEncrypt*",
102
+ "kms:GenerateDataKey*",
103
+ "kms:DescribeKey"
104
+ ]
105
+ Resource = [module.my_table.kms_key_arn]
106
+ },
107
+ ]
108
+ })
109
+ }
110
+ ```
111
+ </Fragment>
112
+ </Infrastructure>
113
+
114
+ ## Local Development
115
+
116
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Smithy API to DynamoDB
3
- description: Connect a Smithy API to a DynamoDB table
3
+ description: Connect a Smithy API to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: smithy
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import GeneratorParameters from '@components/generator-parameters.astro';
12
12
  import NxCommands from '@components/nx-commands.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
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.
15
+ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
16
 
17
17
  ## Prerequisites
18
18
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: tRPC API to DynamoDB
3
- description: Connect a tRPC API to a DynamoDB table
3
+ description: Connect a tRPC API to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: ts#trpc-api
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import GeneratorParameters from '@components/generator-parameters.astro';
12
12
  import NxCommands from '@components/nx-commands.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
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.
15
+ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
16
 
17
17
  ## Prerequisites
18
18
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: TypeScript Agent to DynamoDB
3
- description: Connect a TypeScript Agent to a DynamoDB table
3
+ description: Connect a TypeScript Agent to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: ts#agent
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import NxCommands from '@components/nx-commands.astro';
12
12
  import Infrastructure from '@components/infrastructure.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
14
 
15
- The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
15
+ The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
16
 
17
17
  ## Prerequisites
18
18
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: MCP Server to DynamoDB
3
- description: Connect a TypeScript MCP Server to a DynamoDB table
3
+ description: Connect a TypeScript MCP Server to a TypeScript DynamoDB project
4
4
  when:
5
5
  sourceType: ts#mcp-server
6
6
  targetType: ts#dynamodb
@@ -12,7 +12,7 @@ import NxCommands from '@components/nx-commands.astro';
12
12
  import Infrastructure from '@components/infrastructure.astro';
13
13
  import Snippet from '@components/snippet.astro';
14
14
 
15
- The `connection` generator wires a <Link path="guides/ts-mcp-server">TypeScript MCP Server</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
15
+ The `connection` generator wires a <Link path="guides/ts-mcp-server">TypeScript MCP Server</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
16
 
17
17
  ## Prerequisites
18
18
 
@@ -120,21 +120,21 @@ The Connection generator supports the following connections:
120
120
  target="aurora"
121
121
  />
122
122
  <ConnectionCard
123
- title="tRPC API to DynamoDB"
123
+ title="tRPC API to TypeScript DynamoDB"
124
124
  description="Connect a tRPC API to a DynamoDB table"
125
125
  href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
126
126
  source="trpc"
127
127
  target="dynamodb"
128
128
  />
129
129
  <ConnectionCard
130
- title="Smithy API to DynamoDB"
130
+ title="Smithy API to TypeScript DynamoDB"
131
131
  description="Connect a Smithy API to a DynamoDB table"
132
132
  href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/smithy-dynamodb`}
133
133
  source="smithy"
134
134
  target="dynamodb"
135
135
  />
136
136
  <ConnectionCard
137
- title="TypeScript Agent to DynamoDB"
137
+ title="TypeScript Agent to TypeScript DynamoDB"
138
138
  description="Connect a TypeScript Agent to a DynamoDB table"
139
139
  href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
140
140
  source="strands"
@@ -142,12 +142,38 @@ The Connection generator supports the following connections:
142
142
  target="dynamodb"
143
143
  />
144
144
  <ConnectionCard
145
- title="MCP Server to DynamoDB"
145
+ title="MCP Server to TypeScript DynamoDB"
146
146
  description="Connect a TypeScript MCP Server to a DynamoDB table"
147
147
  href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-mcp-server-dynamodb`}
148
148
  source="mcp"
149
149
  target="dynamodb"
150
150
  />
151
+ <ConnectionCard
152
+ title="FastAPI to Python DynamoDB"
153
+ description="Connect a FastAPI to a DynamoDB table"
154
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-fast-api-dynamodb`}
155
+ source="fastapi"
156
+ target="dynamodb"
157
+ targetBadge="python"
158
+ />
159
+ <ConnectionCard
160
+ title="Python Agent to Python DynamoDB"
161
+ description="Connect a Python Agent to a DynamoDB table"
162
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-dynamodb`}
163
+ source="strands"
164
+ sourceBadge="python"
165
+ target="dynamodb"
166
+ targetBadge="python"
167
+ />
168
+ <ConnectionCard
169
+ title="Python MCP Server to Python DynamoDB"
170
+ description="Connect a Python MCP Server to a DynamoDB table"
171
+ href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-mcp-server-dynamodb`}
172
+ source="mcp"
173
+ sourceBadge="python"
174
+ target="dynamodb"
175
+ targetBadge="python"
176
+ />
151
177
  <ConnectionCard
152
178
  title="AgentCore Gateway to MCP Server"
153
179
  description="Aggregate an MCP server behind an AgentCore Gateway"