@aws/nx-plugin-mcp 1.0.0-rc.98 → 1.0.1
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 +17 -9
- package/docs/get_started/building-with-ai.mdx +21 -14
- package/docs/get_started/concepts.mdx +1 -1
- package/docs/get_started/existing-project.mdx +7 -4
- package/docs/get_started/quick-start.mdx +153 -65
- package/docs/get_started/tutorials/contribute-generator.mdx +5 -5
- package/docs/get_started/tutorials/dungeon-game/1.mdx +17 -17
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +5 -76
- package/docs/guides/agentcore-gateway.mdx +2 -26
- package/docs/guides/connection/agentcore-gateway-agent.mdx +1 -1
- package/docs/guides/connection/py-agent-a2a.mdx +2 -2
- package/docs/guides/connection/py-agent-gateway.mdx +1 -1
- package/docs/guides/connection/py-agent-mcp.mdx +1 -1
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +1 -1
- package/docs/guides/open-api-py-client.mdx +270 -0
- package/docs/guides/py-dynamodb.mdx +7 -0
- package/docs/guides/react-website-auth.mdx +3 -33
- package/docs/guides/react-website.mdx +3 -28
- package/docs/guides/runtime-config.mdx +2 -34
- package/docs/guides/terraform-project.mdx +1 -1
- package/docs/guides/ts-dynamodb.mdx +7 -0
- package/docs/guides/ts-smithy-api.mdx +8 -47
- package/docs/guides/typescript-project.mdx +2 -2
- package/docs/guides/workspace.mdx +7 -10
- package/docs/snippets/agent/architecture.mdx +9 -52
- package/docs/snippets/agent/bedrock-deployment.mdx +1 -1
- package/docs/snippets/agent/runtime-arn.mdx +1 -1
- package/docs/snippets/api/access-logging.mdx +1 -1
- package/docs/snippets/api/api-architecture.mdx +4 -75
- package/docs/snippets/api/type-safe-api-integrations.mdx +2 -4
- package/docs/snippets/lambda-function/architecture.mdx +3 -29
- package/docs/snippets/mcp/architecture.mdx +9 -38
- package/docs/snippets/mcp/bedrock-deployment.mdx +1 -1
- package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +8 -6
- package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +7 -7
- package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -3
- package/docs/snippets/pdk-migration/example/04-deploy.mdx +8 -7
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +4 -4
- package/docs/snippets/prerequisites.mdx +0 -5
- package/docs/snippets/rdb/architecture.mdx +2 -33
- package/docs/snippets/recommended-prerequisites.mdx +1 -1
- package/docs/snippets/workspace-prerequisite.mdx +8 -0
- package/generators.json +7 -0
- package/package.json +1 -1
- package/src/agentcore-gateway/schema.json +1 -0
- package/src/open-api/py-client/schema.json +28 -0
- package/src/py/agent/schema.json +2 -0
- package/src/py/mcp-server/schema.json +1 -0
- package/src/ts/agent/schema.json +1 -0
- package/src/ts/api/schema.json +2 -0
- package/src/ts/mcp-server/schema.json +1 -0
- package/src/ts/react-website/app/schema.json +1 -0
- package/src/ts/website/app/schema.json +1 -0
|
@@ -2,57 +2,28 @@
|
|
|
2
2
|
title: MCP Server Architecture
|
|
3
3
|
---
|
|
4
4
|
import { Tabs, TabItem } from '@astrojs/starlight/components';
|
|
5
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
5
6
|
|
|
6
7
|
<Tabs syncKey="infra">
|
|
7
|
-
<TabItem label="
|
|
8
|
+
<TabItem label="AgentCore Runtime" _filter={{ infra: 'agentcore' }}>
|
|
8
9
|
|
|
9
|
-
When deployed to [Bedrock AgentCore Runtime](https://aws.amazon.com/bedrock/agentcore/),
|
|
10
|
+
When deployed to [Bedrock AgentCore Runtime](https://aws.amazon.com/bedrock/agentcore/), your server's code is packaged as a zip and run in the AgentCore managed runtime. AI assistants invoke the AgentCore Runtime data plane endpoint, which forwards `tools/*` and `resources/*` calls to your server over the [streamable HTTP transport](https://modelcontextprotocol.io/specification/draft/basic/transports#streamable-http).
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
direction: right
|
|
12
|
+
<ArchitectureDiagram options={{ infra: 'agentcore' }} />
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
ecr: ECR {
|
|
20
|
-
shape: image
|
|
21
|
-
icon: /nx-plugin-for-aws/icons/aws/ecr.svg
|
|
22
|
-
}
|
|
14
|
+
</TabItem>
|
|
15
|
+
<TabItem label="AgentCore Runtime (container)" _filter={{ infra: 'agentcore-ecr' }}>
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
shape: image
|
|
26
|
-
icon: /nx-plugin-for-aws/icons/aws/bedrock-agentcore-runtime.svg
|
|
27
|
-
}
|
|
17
|
+
With `infra: agentcore-ecr`, the MCP server is built into a container image, pushed to Amazon ECR and run in AgentCore Runtime. This gives you OS-level control over the runtime environment, at the cost of a longer build and deploy cycle than the zip packaging above.
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
shape: image
|
|
31
|
-
icon: /nx-plugin-for-aws/icons/aws/cloudwatch.svg
|
|
32
|
-
}
|
|
19
|
+
<ArchitectureDiagram options={{ infra: 'agentcore-ecr' }} />
|
|
33
20
|
|
|
34
|
-
assistant -> agentcore: Streamable\nHTTP
|
|
35
|
-
ecr -> agentcore: Container\nimage
|
|
36
|
-
agentcore -> cw
|
|
37
|
-
```
|
|
38
21
|
</TabItem>
|
|
39
22
|
<TabItem label="None (local only)" _filter={{ infra: 'none' }}>
|
|
40
23
|
|
|
41
24
|
With `infra: none`, no AWS infrastructure is generated. The MCP server is configured for local STDIO and HTTP transports only, and is consumed by AI assistants running on the same machine.
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
direction: right
|
|
45
|
-
|
|
46
|
-
assistant: AI Assistant {
|
|
47
|
-
shape: image
|
|
48
|
-
icon: /nx-plugin-for-aws/icons/aws/client.svg
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
server: MCP Server\n(local process) {
|
|
52
|
-
shape: rectangle
|
|
53
|
-
}
|
|
26
|
+
<ArchitectureDiagram options={{ infra: 'none' }} />
|
|
54
27
|
|
|
55
|
-
assistant -> server: STDIO\nor\nStreamable HTTP
|
|
56
|
-
```
|
|
57
28
|
</TabItem>
|
|
58
29
|
</Tabs>
|
|
@@ -106,7 +106,7 @@ export class ExampleStack extends Stack {
|
|
|
106
106
|
```
|
|
107
107
|
</Fragment>
|
|
108
108
|
<Fragment slot="terraform">
|
|
109
|
-
```terraform {
|
|
109
|
+
```terraform {6-7}
|
|
110
110
|
# MCP Server
|
|
111
111
|
module "my_project_mcp_server" {
|
|
112
112
|
# Relative path to the generated module in the common/terraform project
|
|
@@ -8,6 +8,7 @@ import Link from '@components/link.astro';
|
|
|
8
8
|
import NxCommands from '@components/nx-commands.astro';
|
|
9
9
|
import Drawer from '@components/drawer.astro';
|
|
10
10
|
import InstallCommand from '@components/install-command.astro';
|
|
11
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
11
12
|
|
|
12
13
|
The `TypeSafeApiProject` used in the shopping list application made use of:
|
|
13
14
|
|
|
@@ -25,7 +26,7 @@ If you used OpenAPI or TypeSpec as your modelling language, or have handlers imp
|
|
|
25
26
|
|
|
26
27
|
Run the <Link path="/guides/ts-smithy-api">`ts#api` generator</Link> with `framework` set to `smithy` to set up your api project in `packages/api`:
|
|
27
28
|
|
|
28
|
-
<RunGenerator generator="ts#api" noInteractive requiredParameters={{ name: 'api', framework: 'smithy', namespace: 'com.aws', auth: 'iam' }} />
|
|
29
|
+
<RunGenerator generator="ts#api" noInteractive requiredParameters={{ name: 'api', framework: 'smithy', namespace: 'com.aws', auth: 'iam' }} noOptions />
|
|
29
30
|
|
|
30
31
|
You will notice this generates a `model` project, as well as a `backend` project. The `model` project contains your Smithy model, and `backend` contains your server implementation.
|
|
31
32
|
|
|
@@ -114,12 +115,12 @@ Now that we have the basic structure for our Smithy API project, we can migrate
|
|
|
114
115
|
|
|
115
116
|
At this point, let's run a build to check our model changes and ensure we have some generated server code to work with. There will be some failures in the backend project (`@shopping-list/api`) but we'll address those next.
|
|
116
117
|
|
|
117
|
-
<
|
|
118
|
+
<PackageManagerShortCommand commands={["build"]} />
|
|
118
119
|
|
|
119
120
|
:::note
|
|
120
121
|
You may see a build failure due to lint issues. These can usually be automatically fixed:
|
|
121
122
|
|
|
122
|
-
<
|
|
123
|
+
<PackageManagerShortCommand commands={["lint"]} />
|
|
123
124
|
:::
|
|
124
125
|
|
|
125
126
|
#### Migrate the Lambda Handlers
|
|
@@ -132,7 +133,7 @@ The shopping list application's lambda handlers rely on the `@aws-sdk/client-dyn
|
|
|
132
133
|
|
|
133
134
|
<InstallCommand pkg="@aws-sdk/client-dynamodb" project="@shopping-list/api" />
|
|
134
135
|
|
|
135
|
-
Then, let's copy the `handlers/src/dynamo-client.ts` file from the PDK project to `backend/src/operations` so it's available for our handlers.
|
|
136
|
+
Then, let's copy the `handlers/typescript/src/dynamo-client.ts` file from the PDK project to `backend/src/operations` so it's available for our handlers.
|
|
136
137
|
|
|
137
138
|
The `ts#smithy-api` generator scaffolds an example `Echo` operation. Since we removed this from our model, delete the corresponding handler in `backend/src/operations/echo.ts`. We'll register our migrated operations in `service.ts` further below.
|
|
138
139
|
|
|
@@ -587,6 +588,7 @@ Additionally, update `packages/api/backend/project.json` and update `metadata.ap
|
|
|
587
588
|
+ "apiName": "my-api",
|
|
588
589
|
"auth": "iam",
|
|
589
590
|
"modelProject": "@shopping-list/api-model",
|
|
591
|
+
"iac": "cdk",
|
|
590
592
|
"ports": [3001]
|
|
591
593
|
},
|
|
592
594
|
```
|
|
@@ -595,10 +597,10 @@ Additionally, update `packages/api/backend/project.json` and update `metadata.ap
|
|
|
595
597
|
|
|
596
598
|
We can now build the project to check that the migration has worked so far:
|
|
597
599
|
|
|
598
|
-
<
|
|
600
|
+
<PackageManagerShortCommand commands={["build"]} />
|
|
599
601
|
|
|
600
602
|
:::note
|
|
601
603
|
You may see a build failure due to lint issues. These can usually be automatically fixed:
|
|
602
604
|
|
|
603
|
-
<
|
|
605
|
+
<PackageManagerShortCommand commands={["lint"]} />
|
|
604
606
|
:::
|
|
@@ -8,6 +8,7 @@ import Link from '@components/link.astro';
|
|
|
8
8
|
import NxCommands from '@components/nx-commands.astro';
|
|
9
9
|
import Drawer from '@components/drawer.astro';
|
|
10
10
|
import InstallCommand from '@components/install-command.astro';
|
|
11
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
11
12
|
|
|
12
13
|
The `CloudscapeReactTsWebsiteProject` used in the shopping list application configured a React website with CloudScape and Cognito authentication built in.
|
|
13
14
|
|
|
@@ -19,13 +20,13 @@ As part of the migration, we will also move from PDK's configured React Router t
|
|
|
19
20
|
|
|
20
21
|
Run the <Link path="/guides/react-website">`ts#website` generator</Link> with `framework` set to `react` to set up your website project in `packages/website`. Since the shopping list application is built with CloudScape components, we also set `ux` to `cloudscape` (the default is `shadcn`):
|
|
21
22
|
|
|
22
|
-
<RunGenerator generator="ts#website" noInteractive requiredParameters={{ name: 'website', framework: 'react', ux: 'cloudscape' }} />
|
|
23
|
+
<RunGenerator generator="ts#website" noInteractive requiredParameters={{ name: 'website', framework: 'react', ux: 'cloudscape' }} noOptions />
|
|
23
24
|
|
|
24
25
|
#### Add Cognito Authentication
|
|
25
26
|
|
|
26
27
|
The React website generator above doesn't bundle cognito authentication by default like `CloudscapeReactTsWebsiteProject`, instead it's added explicitly via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>.
|
|
27
28
|
|
|
28
|
-
<RunGenerator generator="ts#website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} />
|
|
29
|
+
<RunGenerator generator="ts#website#auth" noInteractive requiredParameters={{ project: 'website', cognitoDomain: 'shopping-list' }} noOptions />
|
|
29
30
|
|
|
30
31
|
This adds React components which manage the appropriate redirects to ensure users log in using the Cognito hosted UI. This also adds a CDK construct to deploy the Cognito resources in `packages/common/constructs`, called `UserIdentity`.
|
|
31
32
|
|
|
@@ -33,13 +34,12 @@ This adds React components which manage the appropriate redirects to ensure user
|
|
|
33
34
|
The PDK `CloudscapeReactTsWebsiteProject` relied on `@aws-northstar/ui` to provide Cognito login components in-app. If you would prefer to use this approach instead of moving to the hosted UI, you can replace the generated `packages/common/constructs/src/core/user-identity.ts` with the [implementation from PDK](https://github.com/aws/aws-pdk/blob/mainline/packages/identity/src/user-identity.ts), replacing the constructs from `@aws-cdk/aws-cognito-identitypool-alpha` with those vended by `aws-cdk-lib`, and make sure to set the relevant values in `RuntimeConfig`:
|
|
34
35
|
|
|
35
36
|
```ts
|
|
36
|
-
RuntimeConfig.ensure(this).
|
|
37
|
-
...RuntimeConfig.ensure(this).config,
|
|
37
|
+
RuntimeConfig.ensure(this).set('connection', 'cognitoProps', {
|
|
38
38
|
region: Stack.of(this).region,
|
|
39
39
|
identityPoolId: this.identityPool.identityPoolId,
|
|
40
40
|
userPoolId: this.userPool.userPoolId,
|
|
41
41
|
userPoolWebClientId: this.userPoolClient.userPoolClientId,
|
|
42
|
-
};
|
|
42
|
+
});
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
You can then reuse the `Auth` component from your `CloudscapeReactTsWebsiteProject`.
|
|
@@ -51,7 +51,7 @@ In PDK you could pass the vended Projen projects to one another to trigger integ
|
|
|
51
51
|
|
|
52
52
|
With the Nx Plugin for AWS, API integration is supported via the <Link path="/guides/connection">`connection` generator</Link>. Next, we use this generator so that our website can invoke our Smithy API:
|
|
53
53
|
|
|
54
|
-
<RunGenerator generator="connection" noInteractive requiredParameters={{ sourceProject: 'website', targetProject: 'api' }} />
|
|
54
|
+
<RunGenerator generator="connection" noInteractive requiredParameters={{ sourceProject: 'website', targetProject: 'api' }} noOptions />
|
|
55
55
|
|
|
56
56
|
This generates the necessary client providers and build targets for your website to call your API via a generated TypeScript client.
|
|
57
57
|
|
|
@@ -100,7 +100,7 @@ Since we're using [file-based routing](https://tanstack.com/router/latest/docs/f
|
|
|
100
100
|
|
|
101
101
|
Let's start the local website server:
|
|
102
102
|
|
|
103
|
-
<
|
|
103
|
+
<PackageManagerShortCommand commands={["dev"]} />
|
|
104
104
|
|
|
105
105
|
:::tip
|
|
106
106
|
We're using the `dev` target here, which also starts local servers for any APIs which have been connected with `connection`, and hot-reloads if your website, model, or backend changes! This allows us to test our API and website locally before we've even written any CDK code.
|
|
@@ -8,6 +8,7 @@ import Link from '@components/link.astro';
|
|
|
8
8
|
import NxCommands from '@components/nx-commands.astro';
|
|
9
9
|
import Drawer from '@components/drawer.astro';
|
|
10
10
|
import InstallCommand from '@components/install-command.astro';
|
|
11
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
11
12
|
|
|
12
13
|
The last project we need to migrate for our shopping list application is the `InfrastructureTsProject`. This is a TypeScript CDK project, for which the Nx Plugin for AWS equivalent is the <Link path="/guides/typescript-infrastructure">`ts#infra` generator</Link>.
|
|
13
14
|
|
|
@@ -21,7 +22,7 @@ A big advantage of the Nx Plugin for AWS over PDK is that the CDK constructs it
|
|
|
21
22
|
|
|
22
23
|
Run the <Link path="/guides/typescript-infrastructure">`ts#infra` generator</Link> to set up your infrastructure project in `packages/infra`:
|
|
23
24
|
|
|
24
|
-
<RunGenerator generator="ts#infra" noInteractive requiredParameters={{ name: 'infra' }} />
|
|
25
|
+
<RunGenerator generator="ts#infra" noInteractive requiredParameters={{ name: 'infra' }} noOptions />
|
|
25
26
|
|
|
26
27
|
#### Migrate the CDK Infrastructure
|
|
27
28
|
|
|
@@ -152,10 +153,10 @@ Notice that we don't pass the identity or API to the website - runtime config is
|
|
|
152
153
|
|
|
153
154
|
Let's build the project now that we've migrated all the relevant parts of the codebase to our new project.
|
|
154
155
|
|
|
155
|
-
<
|
|
156
|
+
<PackageManagerShortCommand commands={["build"]} />
|
|
156
157
|
|
|
157
158
|
:::caution
|
|
158
159
|
You may see a build failure due to lint issues. These can usually be automatically fixed:
|
|
159
160
|
|
|
160
|
-
<
|
|
161
|
+
<PackageManagerShortCommand commands={["lint"]} />
|
|
161
162
|
:::
|
|
@@ -8,6 +8,7 @@ import Link from '@components/link.astro';
|
|
|
8
8
|
import NxCommands from '@components/nx-commands.astro';
|
|
9
9
|
import Drawer from '@components/drawer.astro';
|
|
10
10
|
import InstallCommand from '@components/install-command.astro';
|
|
11
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
Now we've got our fully migrated codebase, we can look at deploying it. There are two paths we can take at this point.
|
|
@@ -22,7 +23,7 @@ The simplest approach is to treat this as a completely new application, meaning
|
|
|
22
23
|
|
|
23
24
|
1. Deploy the new application:
|
|
24
25
|
|
|
25
|
-
<NxCommands commands={[
|
|
26
|
+
<NxCommands commands={['deploy-sandbox infra']} />
|
|
26
27
|
|
|
27
28
|
</Steps>
|
|
28
29
|
|
|
@@ -63,7 +64,7 @@ For our shopping list application, the stateful resources we care about are the
|
|
|
63
64
|
|
|
64
65
|
```diff lang="ts"
|
|
65
66
|
// packages/common/constructs/src/core/user-identity.ts
|
|
66
|
-
-this.userPool = this.createUserPool();
|
|
67
|
+
-this.userPool = this.createUserPool(mfa, mfaSecondFactor);
|
|
67
68
|
+this.userPool = UserPool.fromUserPoolId(
|
|
68
69
|
+ this,
|
|
69
70
|
+ 'UserPool',
|
|
@@ -73,9 +74,9 @@ For our shopping list application, the stateful resources we care about are the
|
|
|
73
74
|
|
|
74
75
|
1. Build and deploy the new application:
|
|
75
76
|
|
|
76
|
-
<
|
|
77
|
+
<PackageManagerShortCommand commands={["build"]} />
|
|
77
78
|
|
|
78
|
-
<NxCommands commands={[
|
|
79
|
+
<NxCommands commands={['deploy-sandbox infra']} />
|
|
79
80
|
|
|
80
81
|
Now we have our new application stood up referencing the existing resources, not yet taking any traffic.
|
|
81
82
|
|
|
@@ -98,7 +99,7 @@ For our shopping list application, the stateful resources we care about are the
|
|
|
98
99
|
|
|
99
100
|
```diff lang="ts"
|
|
100
101
|
// packages/common/constructs/src/core/user-identity.ts
|
|
101
|
-
+this.userPool = this.createUserPool();
|
|
102
|
+
+this.userPool = this.createUserPool(mfa, mfaSecondFactor);
|
|
102
103
|
-this.userPool = UserPool.fromUserPoolId(
|
|
103
104
|
- this,
|
|
104
105
|
- 'UserPool',
|
|
@@ -108,7 +109,7 @@ For our shopping list application, the stateful resources we care about are the
|
|
|
108
109
|
|
|
109
110
|
And then run a build
|
|
110
111
|
|
|
111
|
-
<
|
|
112
|
+
<PackageManagerShortCommand commands={["build"]} />
|
|
112
113
|
|
|
113
114
|
1. Use `cdk import` in your new application's `packages/infra` folder to see which resources we'll be prompted to import.
|
|
114
115
|
|
|
@@ -199,7 +200,7 @@ For our shopping list application, the stateful resources we care about are the
|
|
|
199
200
|
|
|
200
201
|
1. Deploy the new application again to make sure that any changes to these existing resources (now managed by your new stack) are made:
|
|
201
202
|
|
|
202
|
-
<NxCommands commands={[
|
|
203
|
+
<NxCommands commands={['deploy-sandbox infra']} />
|
|
203
204
|
|
|
204
205
|
1. Perform a full test of your new application again
|
|
205
206
|
|
|
@@ -14,7 +14,7 @@ The most commonly used components from Type Safe API are covered in the example
|
|
|
14
14
|
|
|
15
15
|
#### APIs Modelled with OpenAPI
|
|
16
16
|
|
|
17
|
-
The Nx Plugin for AWS supports APIs modelled in Smithy, but not those modelled directly OpenAPI. The <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link> is a good starting point which you can then modify. You can define your OpenAPI specification in the `model` project's `src` folder instead of Smithy, and
|
|
17
|
+
The Nx Plugin for AWS supports APIs modelled in Smithy, but not those modelled directly OpenAPI. The <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link> is a good starting point which you can then modify. You can define your OpenAPI specification in the `model` project's `src` folder instead of Smithy, and update the `model` project's `compile` target to run your desired code generation tool for clients/servers. If your desired tools are on NPM, you can install them as dev dependencies to your Nx workspace and call them directly as Nx build targets.
|
|
18
18
|
|
|
19
19
|
##### Backend
|
|
20
20
|
|
|
@@ -79,7 +79,7 @@ Type Safe API provided a Projen project type named `SmithyShapeLibraryProject` w
|
|
|
79
79
|
|
|
80
80
|
The equivalent is the <Link path="/guides/smithy-project">`smithy#project` generator</Link> with `type` set to `shapes`:
|
|
81
81
|
|
|
82
|
-
<RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} />
|
|
82
|
+
<RunGenerator generator="smithy#project" requiredParameters={{ name: 'my-shapes', type: 'shapes' }} noOptions />
|
|
83
83
|
|
|
84
84
|
Move the shapes from your `SmithyShapeLibraryProject` into the generated project's `src` folder, then refer to the <Link path="/guides/smithy-project#depending-on-a-shape-library">Smithy project guide</Link> for how to wire the library up as a dependency of your API's model.
|
|
85
85
|
|
|
@@ -153,7 +153,7 @@ const pythonLambdaHandler = new Function(this, 'PythonImplementation', {
|
|
|
153
153
|
...
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
new
|
|
156
|
+
new Api(this, 'MyApi', {
|
|
157
157
|
integrations: Api.defaultIntegrations(this)
|
|
158
158
|
.withOverrides({
|
|
159
159
|
echo: {
|
|
@@ -167,7 +167,7 @@ new MyApi(this, 'MyApi', {
|
|
|
167
167
|
|
|
168
168
|
You will need to "stub" your service/router for your service to compile if using the `ts#smithy-api` and the TypeScript Server SDK, eg:
|
|
169
169
|
|
|
170
|
-
```ts {
|
|
170
|
+
```ts {4}
|
|
171
171
|
// service.ts
|
|
172
172
|
export const Service: ApiService<ServiceContext> = {
|
|
173
173
|
...
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Prerequisites
|
|
3
3
|
---
|
|
4
|
-
import Link from '@components/link.astro';
|
|
5
4
|
import Snippet from '@components/snippet.astro';
|
|
6
5
|
|
|
7
6
|
### Required
|
|
@@ -11,7 +10,3 @@ import Snippet from '@components/snippet.astro';
|
|
|
11
10
|
### Recommended
|
|
12
11
|
|
|
13
12
|
<Snippet name="recommended-prerequisites" parentHeading="Recommended" />
|
|
14
|
-
|
|
15
|
-
:::tip[AI Assistant Setup]
|
|
16
|
-
If you use an AI Assistant such as Kiro, Kiro CLI, Cursor, Claude Code or Codex, you may also wish to <Link path="/get_started/building-with-ai">install the Nx Plugin for AWS MCP server.</Link>
|
|
17
|
-
:::
|
|
@@ -1,39 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: RDB Architecture
|
|
3
3
|
---
|
|
4
|
+
import ArchitectureDiagram from '@components/architecture-diagram.astro';
|
|
4
5
|
|
|
5
6
|
The deployed database has the following architecture. By default, an [Amazon RDS Proxy](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html) sits in front of the Aurora cluster to pool connections and to enable [IAM authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) — see [Disable RDS Proxy](#disable-rds-proxy) for the alternative. The architecture is the same whether you select the PostgreSQL or MySQL engine; only the Aurora engine flavor differs.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
direction: right
|
|
9
|
-
|
|
10
|
-
app: Application\n(Lambda, Agent, ...) {
|
|
11
|
-
shape: hexagon
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
proxy: RDS Proxy {
|
|
15
|
-
shape: image
|
|
16
|
-
icon: /nx-plugin-for-aws/icons/aws/rds.svg
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
migrations: Migrations Lambda {
|
|
20
|
-
shape: image
|
|
21
|
-
icon: /nx-plugin-for-aws/icons/aws/lambda.svg
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
aurora: Aurora\n(PostgreSQL or MySQL) {
|
|
25
|
-
shape: image
|
|
26
|
-
icon: /nx-plugin-for-aws/icons/aws/aurora.svg
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
secrets: Secrets Manager\n(DB credentials) {
|
|
30
|
-
shape: image
|
|
31
|
-
icon: /nx-plugin-for-aws/icons/aws/secrets-manager.svg
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
app -> proxy: SQL (IAM auth)
|
|
35
|
-
proxy -> aurora
|
|
36
|
-
migrations -> aurora: Schema migrations
|
|
37
|
-
migrations -> secrets: Admin credentials
|
|
38
|
-
aurora -> secrets: Generates and rotates\nadmin credentials
|
|
39
|
-
```
|
|
8
|
+
<ArchitectureDiagram />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Recommended Prerequisites
|
|
3
3
|
---
|
|
4
|
-
- [PNPM >= 11](https://pnpm.io/installation#using-npm) (you can also use [Yarn >= 4](https://yarnpkg.com/getting-started/install), [Bun >= 1](https://bun.sh/docs/installation), or [NPM >=
|
|
4
|
+
- [PNPM >= 11](https://pnpm.io/installation#using-npm) (you can also use [Yarn >= 4](https://yarnpkg.com/getting-started/install), [Bun >= 1](https://bun.sh/docs/installation), or [NPM >= 11](https://nodejs.org/en/learn/getting-started/an-introduction-to-the-npm-package-manager) if you prefer)
|
|
5
5
|
- verify by running `pnpm --version`, `yarn --version`, `bun --version` or `npm --version`
|
|
6
6
|
- [AWS Credentials](https://docs.aws.amazon.com/sdkref/latest/guide/access.html) configured to your target AWS account are required to deploy your application (as well as for some local development workflows).
|
|
7
7
|
- [Docker](https://www.docker.com/) or [Finch >= 1.6.0](https://runfinch.com/) is required for some generators. For Docker, [multi-platform builds](https://docs.docker.com/build/building/multi-platform/) must be set up; Finch supports [multi-platform builds](https://runfinch.com/docs/getting-started/building-images/#building-a-multi-architecture-container-image) out of the box.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Workspace Prerequisite
|
|
3
|
+
---
|
|
4
|
+
import Link from '@components/link.astro';
|
|
5
|
+
|
|
6
|
+
:::note[Start here]
|
|
7
|
+
Generators run inside an Nx workspace with `@aws/nx-plugin` installed. If you don't have one yet, start by <Link path="guides/workspace">creating a workspace</Link>, or <Link path="get_started/existing-project">adding the plugin to an existing project</Link>.
|
|
8
|
+
:::
|
package/generators.json
CHANGED
|
@@ -104,6 +104,13 @@
|
|
|
104
104
|
"metric": "g15",
|
|
105
105
|
"hidden": true
|
|
106
106
|
},
|
|
107
|
+
"open-api#py-client": {
|
|
108
|
+
"factory": "./src/open-api/py-client/generator",
|
|
109
|
+
"schema": "./src/open-api/py-client/schema.json",
|
|
110
|
+
"description": "Generate a Python httpx client from an OpenAPI specification",
|
|
111
|
+
"metric": "g73",
|
|
112
|
+
"hidden": true
|
|
113
|
+
},
|
|
107
114
|
"open-api#ts-client": {
|
|
108
115
|
"factory": "./src/open-api/ts-client/generator",
|
|
109
116
|
"schema": "./src/open-api/ts-client/schema.json",
|
package/package.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"auth": {
|
|
36
36
|
"type": "string",
|
|
37
37
|
"description": "The method used to authenticate inbound requests to your gateway. Only applicable when infra is set (ignored when infra is none).",
|
|
38
|
+
"x-when": { "infra": "agentcore" },
|
|
38
39
|
"enum": ["iam", "cognito"],
|
|
39
40
|
"default": "iam",
|
|
40
41
|
"x-prompt": "How would you like to authenticate inbound requests to your gateway?",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "OpenApiPyClient",
|
|
4
|
+
"title": "OpenAPI Python Client",
|
|
5
|
+
"description": "Generate a Python httpx client from an OpenAPI specification",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"openApiSpecPath": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Path to the OpenAPI specification relative to the monorepo root",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"outputPath": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Path to the directory in which to generate the client relative to the monorepo root",
|
|
16
|
+
"x-priority": "important"
|
|
17
|
+
},
|
|
18
|
+
"clientType": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Which clients to emit. 'sync' emits client.py using httpx.Client, 'async' emits async_client.py using httpx.AsyncClient, 'both' emits both.",
|
|
21
|
+
"enum": ["sync", "async", "both"],
|
|
22
|
+
"x-prompt": "Which clients would you like to emit?",
|
|
23
|
+
"default": "both",
|
|
24
|
+
"x-priority": "important"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": ["openApiSpecPath", "outputPath"]
|
|
28
|
+
}
|
package/src/py/agent/schema.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"auth": {
|
|
33
33
|
"type": "string",
|
|
34
34
|
"description": "The method used to authenticate with your Agent. Only applicable when infra is set (ignored when infra is none).",
|
|
35
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
35
36
|
"default": "iam",
|
|
36
37
|
"enum": ["iam", "cognito"],
|
|
37
38
|
"x-prompt": "How would you like to authenticate with your Agent?",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"description": "The storage used to persist session for your Agent. LangChain supports 's3' or 'dynamodb-s3'; Strands supports 's3'; 'in-memory' is valid for both.",
|
|
67
68
|
"x-prompt": "How would you like to persist session for your Agent?",
|
|
68
69
|
"enum": ["s3", "dynamodb-s3", "in-memory"],
|
|
70
|
+
"x-value-when": { "dynamodb-s3": { "framework": "langchain" } },
|
|
69
71
|
"default": "s3",
|
|
70
72
|
"x-priority": "important"
|
|
71
73
|
},
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"auth": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "The method used to authenticate with your MCP server. Only applicable when infra is set (ignored when infra is none).",
|
|
27
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
27
28
|
"default": "iam",
|
|
28
29
|
"enum": ["iam", "cognito"],
|
|
29
30
|
"x-prompt": "How would you like to authenticate with your MCP server?",
|
package/src/ts/agent/schema.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"auth": {
|
|
33
33
|
"type": "string",
|
|
34
34
|
"description": "The method used to authenticate with your Agent. Only applicable when infra is set (ignored when infra is none).",
|
|
35
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
35
36
|
"default": "iam",
|
|
36
37
|
"enum": ["iam", "cognito"],
|
|
37
38
|
"x-prompt": "How would you like to authenticate with your Agent?",
|
package/src/ts/api/schema.json
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"namespace": {
|
|
40
40
|
"type": "string",
|
|
41
41
|
"description": "The namespace for the Smithy API (only applicable for the smithy framework). Defaults to your monorepo scope",
|
|
42
|
+
"x-when": { "framework": "smithy" },
|
|
42
43
|
"x-prompt": "What namespace would you like your API to have? i.e: com.example"
|
|
43
44
|
},
|
|
44
45
|
"integrationPattern": {
|
|
@@ -97,6 +98,7 @@
|
|
|
97
98
|
"description": "The type of infrastructure to use to deploy this API.",
|
|
98
99
|
"default": "rest-lambda",
|
|
99
100
|
"enum": ["rest-lambda", "http-lambda", "none"],
|
|
101
|
+
"x-value-when": { "http-lambda": { "framework": "trpc" } },
|
|
100
102
|
"x-prompt": "What infrastructure would you like to deploy your API with?",
|
|
101
103
|
"x-priority": "important"
|
|
102
104
|
},
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"auth": {
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "The method used to authenticate with your MCP server. Only applicable when infra is set (ignored when infra is none).",
|
|
27
|
+
"x-when": { "infra": ["agentcore", "agentcore-ecr"] },
|
|
27
28
|
"default": "iam",
|
|
28
29
|
"enum": ["iam", "cognito"],
|
|
29
30
|
"x-prompt": "How would you like to authenticate with your MCP server?",
|