@aws/nx-plugin-mcp 1.0.0-rc.44 → 1.0.0-rc.46
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/tutorials/contribute-generator.mdx +1 -1
- package/docs/get_started/tutorials/dungeon-game/1.mdx +4 -4
- package/docs/get_started/tutorials/dungeon-game/3.mdx +1 -1
- package/docs/guides/agentcore-gateway.mdx +94 -7
- package/docs/guides/connection/py-agent-a2a.mdx +1 -1
- package/docs/guides/connection/py-agent-gateway.mdx +3 -1
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +1 -1
- package/docs/guides/connection/py-fast-api-rdb.mdx +1 -1
- package/docs/guides/connection/react-agui.mdx +9 -9
- package/docs/guides/connection/react-py-agent.mdx +2 -2
- package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
- package/docs/guides/connection/ts-agent-gateway.mdx +3 -1
- package/docs/guides/docker-bundling.mdx +10 -13
- package/docs/guides/fastapi.mdx +2 -2
- package/docs/guides/python-lambda-function.mdx +1 -1
- package/docs/guides/react-website-auth.mdx +2 -2
- package/docs/guides/react-website.mdx +4 -4
- package/docs/guides/security.mdx +1 -1
- package/docs/guides/trpc.mdx +2 -2
- package/docs/guides/ts-dcr-proxy.mdx +569 -0
- package/docs/guides/ts-lambda-function.mdx +1 -1
- package/docs/guides/ts-mcp-server.mdx +44 -27
- package/docs/guides/ts-nx-plugin.mdx +2 -2
- package/docs/guides/ts-smithy-api.mdx +3 -3
- package/docs/guides/typescript-infrastructure.mdx +11 -10
- package/docs/snippets/lambda-function/deploying-your-function.mdx +1 -1
- package/docs/snippets/rdb/deploying.mdx +1 -1
- package/docs/snippets/shared-constructs.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +13 -3
- package/generators.json +13 -7
- package/package.json +1 -1
- package/src/agentcore-gateway/schema.json +3 -2
- package/src/ts/dcr-proxy/schema.json +44 -0
|
@@ -55,14 +55,14 @@ The generator will create the following project structure:
|
|
|
55
55
|
|
|
56
56
|
### Adding Generators
|
|
57
57
|
|
|
58
|
-
Once you have your plugin project, you can add generators using the <Link path="/guides/
|
|
58
|
+
Once you have your plugin project, you can add generators using the <Link path="/guides/nx-generator">`ts#nx-generator`</Link> generator:
|
|
59
59
|
|
|
60
60
|
<RunGenerator generator="ts#nx-generator" requiredParameters={{ pluginProject: 'your-plugin' }} />
|
|
61
61
|
|
|
62
62
|
This will add a new generator to your plugin.
|
|
63
63
|
|
|
64
64
|
:::tip[Generator Documentation]
|
|
65
|
-
Read the <Link path="/guides/
|
|
65
|
+
Read the <Link path="/guides/nx-generator">`ts#nx-generator` guide</Link> for details about how to implement generators.
|
|
66
66
|
:::
|
|
67
67
|
|
|
68
68
|
Make sure to write a detailed `README.md` for your generator, since this is used by the MCP Server's `generator-guide` tool.
|
|
@@ -69,7 +69,7 @@ The generator creates two related projects in the `<directory>/<api-name>` direc
|
|
|
69
69
|
|
|
70
70
|
### Infrastructure
|
|
71
71
|
|
|
72
|
-
Since this generator creates infrastructure as code based on your chosen `
|
|
72
|
+
Since this generator creates infrastructure as code based on your chosen `iac`, it will create a project in `packages/common` which includes the relevant CDK constructs or Terraform modules.
|
|
73
73
|
|
|
74
74
|
The common infrastructure as code project is structured as follows:
|
|
75
75
|
|
|
@@ -581,7 +581,7 @@ The local server will not only hot-reload when you make TypeScript changes to yo
|
|
|
581
581
|
|
|
582
582
|
## Deploying your Smithy API
|
|
583
583
|
|
|
584
|
-
The generator creates CDK or Terraform infrastructure based on your selected `
|
|
584
|
+
The generator creates CDK or Terraform infrastructure based on your selected `iac`.
|
|
585
585
|
|
|
586
586
|
<Infrastructure>
|
|
587
587
|
<Fragment slot="cdk">
|
|
@@ -765,7 +765,7 @@ If you are actively working on both your CDK infrastructure and Smithy API toget
|
|
|
765
765
|
</Fragment>
|
|
766
766
|
<Fragment slot="terraform">
|
|
767
767
|
:::note[Terraform Limitations]
|
|
768
|
-
We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `
|
|
768
|
+
We do not support type-safe integrations for Terraform, and therefore no code generation targets are configured if you selected Terraform for your `iac`.
|
|
769
769
|
:::
|
|
770
770
|
</Fragment>
|
|
771
771
|
</Infrastructure>
|
|
@@ -43,7 +43,7 @@ The generator will create the following project structure in the `<directory>/<n
|
|
|
43
43
|
|
|
44
44
|
</FileTree>
|
|
45
45
|
|
|
46
|
-
If you set the `
|
|
46
|
+
If you set the `stageConfig` option, the generator also creates two shared packages for centralized credential management (if they don't already exist):
|
|
47
47
|
|
|
48
48
|
<FileTree>
|
|
49
49
|
|
|
@@ -99,13 +99,14 @@ new ApplicationStage(app, 'my-app-sandbox', {
|
|
|
99
99
|
|
|
100
100
|
The `env` property tells CDK which AWS account and region to deploy to. `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` are resolved automatically by the CDK CLI from your active AWS credentials. See the [CDK environments documentation](https://docs.aws.amazon.com/cdk/v2/guide/environments.html) for more details.
|
|
101
101
|
|
|
102
|
-
If you generated with `
|
|
102
|
+
If you generated with `stageConfig`, the `main.ts` reads account and region from a centralized config file instead, falling back to environment variables when no config is set:
|
|
103
103
|
|
|
104
|
-
```ts title="src/main.ts (with
|
|
105
|
-
import
|
|
104
|
+
```ts title="src/main.ts (with stageConfig)"
|
|
105
|
+
import { resolveStage } from ':my-scope/common-infra-config';
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// Looks up the stage under this project (packages/infra), falling back to
|
|
108
|
+
// shared stages. Returns undefined when no config exists for the stage.
|
|
109
|
+
const sandboxConfig = resolveStage('packages/infra', 'my-app-sandbox');
|
|
109
110
|
|
|
110
111
|
new ApplicationStage(app, 'my-app-sandbox', {
|
|
111
112
|
env: {
|
|
@@ -158,12 +159,12 @@ export class ApplicationStage extends Stage {
|
|
|
158
159
|
### Stage Credential Configuration
|
|
159
160
|
|
|
160
161
|
:::note[Staged Configuration]
|
|
161
|
-
This section applies when you generate with `
|
|
162
|
+
This section applies when you generate with `stageConfig`. Without it, the generator produces a simpler setup where you manage AWS credentials yourself (e.g., by exporting `AWS_PROFILE` before deploying).
|
|
162
163
|
:::
|
|
163
164
|
|
|
164
165
|
When you have multiple stages targeting different AWS accounts, managing credentials manually can be error-prone, especially as the number of stages grows.
|
|
165
166
|
|
|
166
|
-
The `
|
|
167
|
+
The `stageConfig` option solves this by generating two shared packages:
|
|
167
168
|
|
|
168
169
|
- **`packages/common/infra-config`** — A single config file where you map each stage to its AWS credentials, account, and region. This is importable from any package in your workspace, so your CDK `main.ts` can read account and region from the same source of truth.
|
|
169
170
|
- **`packages/common/scripts`** — `infra-deploy` and `infra-destroy` commands that wrap CDK with automatic credential resolution. When you run `deploy`, the script reads the config, sets the right AWS environment variables for the CDK child process, and runs `cdk deploy`. Your shell environment is never modified.
|
|
@@ -242,7 +243,7 @@ Each stage config includes a required `region` and an optional `account`:
|
|
|
242
243
|
The generated `main.ts` reads these values from the config so that CDK synthesis and deployment use the same environment settings:
|
|
243
244
|
|
|
244
245
|
```ts title="src/main.ts"
|
|
245
|
-
const sandboxConfig =
|
|
246
|
+
const sandboxConfig = resolveStage('packages/infra', 'my-app-sandbox');
|
|
246
247
|
new ApplicationStage(app, 'my-app-sandbox', {
|
|
247
248
|
env: {
|
|
248
249
|
account: sandboxConfig?.account ?? process.env.CDK_DEFAULT_ACCOUNT,
|
|
@@ -375,7 +376,7 @@ After a build, you can deploy your infrastructure to AWS using the `deploy` targ
|
|
|
375
376
|
Use the `deploy-ci` target if deploying in a CI/CD pipeline. See below for more details.
|
|
376
377
|
:::
|
|
377
378
|
|
|
378
|
-
First, make sure you have AWS credentials configured. If you generated with `
|
|
379
|
+
First, make sure you have AWS credentials configured. If you generated with `stageConfig` and have configured stage credentials in `packages/common/infra-config/src/stages.config.ts`, the deploy command will automatically resolve and apply the correct credentials for the target stage. Otherwise, ensure your AWS credentials are set in your environment (e.g., via `AWS_PROFILE` or environment variables). See the [AWS credentials documentation](https://docs.aws.amazon.com/sdkref/latest/guide/access.html) for the available options.
|
|
379
380
|
|
|
380
381
|
Then run the deploy target:
|
|
381
382
|
|
|
@@ -3,7 +3,7 @@ title: Deploying your Function
|
|
|
3
3
|
---
|
|
4
4
|
import Infrastructure from '@components/infrastructure.astro';
|
|
5
5
|
|
|
6
|
-
This generator creates CDK or Terraform infrastructure as code based on your selected `
|
|
6
|
+
This generator creates CDK or Terraform infrastructure as code based on your selected `iac`. You can use this to deploy your function.
|
|
7
7
|
|
|
8
8
|
<Infrastructure>
|
|
9
9
|
<Fragment slot="cdk">
|
|
@@ -5,7 +5,7 @@ import Infrastructure from '@components/infrastructure.astro';
|
|
|
5
5
|
import Link from '@components/link.astro';
|
|
6
6
|
import Drawer from '@components/drawer.astro';
|
|
7
7
|
|
|
8
|
-
The relational database generator creates CDK or Terraform infrastructure based on your selected `
|
|
8
|
+
The relational database generator creates CDK or Terraform infrastructure based on your selected `iac`.
|
|
9
9
|
|
|
10
10
|
<Infrastructure>
|
|
11
11
|
<Fragment slot="cdk">
|
|
@@ -5,7 +5,7 @@ import { FileTree } from '@astrojs/starlight/components';
|
|
|
5
5
|
import Infrastructure from '@components/infrastructure.astro';
|
|
6
6
|
import Link from '@components/link.astro';
|
|
7
7
|
|
|
8
|
-
Since this generator vends infrastructure as code based on your chosen `
|
|
8
|
+
Since this generator vends infrastructure as code based on your chosen `iac`, it will create a project in `packages/common` which includes the relevant CDK constructs or Terraform modules.
|
|
9
9
|
|
|
10
10
|
The common infrastructure as code project is structured as follows:
|
|
11
11
|
|
|
@@ -2,11 +2,21 @@
|
|
|
2
2
|
title: Container Image Scanning
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The Docker image built for this project can be scanned for vulnerabilities using [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A `trivy` target is added to your project which scans the built image and **exits non-zero** if any `HIGH` or `CRITICAL` severity vulnerability is found. The generated `Dockerfile` uses a base image with no known fixable vulnerabilities of these severities at time of generation, and upgrades bundled tooling (such as `npm`) to keep it that way.
|
|
10
|
+
|
|
11
|
+
The scan uses the same container engine as your image build (`docker` or `finch`), so no additional tooling is required. Since the scan is only re-run when the image changes, an unchanged image is not re-scanned. The vended `trivy` root script scans every image in the workspace:
|
|
12
|
+
|
|
13
|
+
<PackageManagerShortCommand commands={['trivy']} />
|
|
14
|
+
|
|
15
|
+
:::tip[Run Trivy in CI]
|
|
16
|
+
The scan is intentionally not wired into `build` since this can introduce unnecessary friction when iterating during development, as Trivy's vulnerabilty database is continually updated with new CVEs.
|
|
17
|
+
|
|
18
|
+
Instead we recommend running the above command as a dedicated step in your CI pipeline prior to deployment to production stages.
|
|
19
|
+
:::
|
|
10
20
|
|
|
11
21
|
:::caution[Unfixable vulnerabilities are ignored]
|
|
12
22
|
The scan runs with `--ignore-unfixed`, so vulnerabilities without an available fix do not fail the build, since they cannot be actioned by upgrading tooling in your `Dockerfile` — they are not reported in the build's scan output. As new vulnerabilities are disclosed the result of scans may change over time, so review the image periodically by running `trivy image <your-image>` without the flag, and rebuild against a newer base image (or add container steps to apply available patches) once a fix is published.
|
package/generators.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"factory": "./src/init/generator",
|
|
8
8
|
"schema": "./src/init/schema.json",
|
|
9
9
|
"description": "Configure an existing Nx workspace to use the @aws/nx-plugin",
|
|
10
|
-
"metric": "
|
|
10
|
+
"metric": "g66",
|
|
11
11
|
"guidePages": ["existing-project"]
|
|
12
12
|
},
|
|
13
13
|
"agentcore-gateway": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"factory": "./src/agentcore-gateway/gateway-connection/generator",
|
|
28
28
|
"schema": "./src/agentcore-gateway/gateway-connection/schema.json",
|
|
29
29
|
"description": "Connect an AgentCore Gateway to another AgentCore Gateway",
|
|
30
|
-
"metric": "
|
|
30
|
+
"metric": "g65",
|
|
31
31
|
"hidden": true
|
|
32
32
|
},
|
|
33
33
|
"connection": {
|
|
@@ -211,6 +211,12 @@
|
|
|
211
211
|
"description": "Generate a TypeScript lambda function",
|
|
212
212
|
"metric": "g21"
|
|
213
213
|
},
|
|
214
|
+
"ts#dcr-proxy": {
|
|
215
|
+
"factory": "./src/ts/dcr-proxy/generator",
|
|
216
|
+
"schema": "./src/ts/dcr-proxy/schema.json",
|
|
217
|
+
"description": "Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers",
|
|
218
|
+
"metric": "g67"
|
|
219
|
+
},
|
|
214
220
|
"ts#mcp-server": {
|
|
215
221
|
"factory": "./src/ts/mcp-server/generator",
|
|
216
222
|
"schema": "./src/ts/mcp-server/schema.json",
|
|
@@ -242,7 +248,7 @@
|
|
|
242
248
|
"factory": "./src/ts/website/app/generator",
|
|
243
249
|
"schema": "./src/ts/website/app/schema.json",
|
|
244
250
|
"description": "Generates a website application",
|
|
245
|
-
"metric": "
|
|
251
|
+
"metric": "g60",
|
|
246
252
|
"guidePages": ["website", "react-website"]
|
|
247
253
|
},
|
|
248
254
|
"ts#website#auth": {
|
|
@@ -399,27 +405,27 @@
|
|
|
399
405
|
"factory": "./src/ts/dynamodb/generator",
|
|
400
406
|
"schema": "./src/ts/dynamodb/schema.json",
|
|
401
407
|
"description": "Create a TypeScript DynamoDB project",
|
|
402
|
-
"metric": "
|
|
408
|
+
"metric": "g61"
|
|
403
409
|
},
|
|
404
410
|
"ts#dynamodb#trpc-connection": {
|
|
405
411
|
"factory": "./src/ts/dynamodb/trpc-connection/generator",
|
|
406
412
|
"schema": "./src/ts/dynamodb/trpc-connection/schema.json",
|
|
407
413
|
"description": "Connect a ts#trpc-api project to a ts#dynamodb project",
|
|
408
|
-
"metric": "
|
|
414
|
+
"metric": "g62",
|
|
409
415
|
"hidden": true
|
|
410
416
|
},
|
|
411
417
|
"ts#dynamodb#smithy-connection": {
|
|
412
418
|
"factory": "./src/ts/dynamodb/smithy-connection/generator",
|
|
413
419
|
"schema": "./src/ts/dynamodb/smithy-connection/schema.json",
|
|
414
420
|
"description": "Connect a Smithy backend to a ts#dynamodb project",
|
|
415
|
-
"metric": "
|
|
421
|
+
"metric": "g63",
|
|
416
422
|
"hidden": true
|
|
417
423
|
},
|
|
418
424
|
"ts#dynamodb#agent-connection": {
|
|
419
425
|
"factory": "./src/ts/dynamodb/agent-connection/generator",
|
|
420
426
|
"schema": "./src/ts/dynamodb/agent-connection/schema.json",
|
|
421
427
|
"description": "Connect a ts#agent to a ts#dynamodb project",
|
|
422
|
-
"metric": "
|
|
428
|
+
"metric": "g64",
|
|
423
429
|
"hidden": true
|
|
424
430
|
},
|
|
425
431
|
"ts#dynamodb#mcp-server-connection": {
|
package/package.json
CHANGED
|
@@ -33,9 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"auth": {
|
|
35
35
|
"type": "string",
|
|
36
|
-
"description": "The method used to authenticate inbound requests to your gateway. Only
|
|
37
|
-
"enum": ["iam"],
|
|
36
|
+
"description": "The method used to authenticate inbound requests to your gateway. Only applicable when infra is set (ignored when infra is none).",
|
|
37
|
+
"enum": ["iam", "cognito"],
|
|
38
38
|
"default": "iam",
|
|
39
|
+
"x-prompt": "How would you like to authenticate inbound requests to your gateway?",
|
|
39
40
|
"x-priority": "important"
|
|
40
41
|
},
|
|
41
42
|
"cedarPolicy": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ts#dcr-proxy",
|
|
4
|
+
"title": "ts#dcr-proxy",
|
|
5
|
+
"description": "Generate an OAuth Dynamic Client Registration (DCR) proxy construct for Cognito-authenticated MCP servers",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of your DCR proxy, used for its TypeScript handler project, the construct/module class name, and its directory under common/constructs or common/terraform",
|
|
11
|
+
"default": "dcr-proxy",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-prompt": "What would you like to call your DCR proxy?",
|
|
17
|
+
"x-priority": "important"
|
|
18
|
+
},
|
|
19
|
+
"directory": {
|
|
20
|
+
"description": "The directory to store the DCR proxy handler project in.",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"alias": "dir",
|
|
23
|
+
"x-priority": "important",
|
|
24
|
+
"default": "packages"
|
|
25
|
+
},
|
|
26
|
+
"subDirectory": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "The sub directory the handler project is placed in. By default this is the project name."
|
|
29
|
+
},
|
|
30
|
+
"iac": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The preferred IaC provider (cdk or terraform). By default this is inherited from your initial selection.",
|
|
33
|
+
"enum": ["inherit", "cdk", "terraform"],
|
|
34
|
+
"x-priority": "important",
|
|
35
|
+
"default": "inherit",
|
|
36
|
+
"x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
|
|
37
|
+
},
|
|
38
|
+
"preferInstallDependencies": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
|
|
41
|
+
"default": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|