@aws/nx-plugin-mcp 1.0.0-rc.43 → 1.0.0-rc.45

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.
Files changed (34) hide show
  1. package/bin/aws-nx-mcp.js +86 -79
  2. package/docs/get_started/tutorials/dungeon-game/1.mdx +4 -4
  3. package/docs/get_started/tutorials/dungeon-game/3.mdx +1 -1
  4. package/docs/guides/agentcore-gateway.mdx +94 -7
  5. package/docs/guides/connection/py-agent-a2a.mdx +1 -1
  6. package/docs/guides/connection/py-agent-gateway.mdx +3 -1
  7. package/docs/guides/connection/react-agui.mdx +9 -9
  8. package/docs/guides/connection/react-py-agent.mdx +2 -2
  9. package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
  10. package/docs/guides/connection/ts-agent-gateway.mdx +3 -1
  11. package/docs/guides/docker-bundling.mdx +10 -13
  12. package/docs/guides/fastapi.mdx +2 -2
  13. package/docs/guides/py-dynamodb.mdx +3 -3
  14. package/docs/guides/py-rdb.mdx +3 -1
  15. package/docs/guides/python-lambda-function.mdx +1 -1
  16. package/docs/guides/react-website-auth.mdx +1 -1
  17. package/docs/guides/react-website.mdx +3 -3
  18. package/docs/guides/security.mdx +1 -1
  19. package/docs/guides/trpc.mdx +2 -2
  20. package/docs/guides/ts-dcr-proxy.mdx +569 -0
  21. package/docs/guides/ts-dynamodb.mdx +3 -3
  22. package/docs/guides/ts-lambda-function.mdx +1 -1
  23. package/docs/guides/ts-rdb.mdx +4 -0
  24. package/docs/guides/ts-smithy-api.mdx +3 -3
  25. package/docs/guides/typescript-infrastructure.mdx +6 -6
  26. package/docs/snippets/lambda-function/deploying-your-function.mdx +1 -1
  27. package/docs/snippets/rdb/deploying.mdx +1 -1
  28. package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
  29. package/docs/snippets/shared-constructs.mdx +1 -1
  30. package/docs/snippets/trivy-image-scan.mdx +13 -3
  31. package/generators.json +6 -0
  32. package/package.json +1 -1
  33. package/src/agentcore-gateway/schema.json +3 -2
  34. package/src/ts/dcr-proxy/schema.json +44 -0
@@ -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 `enableStageConfig` option, the generator also creates two shared packages for centralized credential management (if they don't already exist):
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,9 +99,9 @@ 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 `enableStageConfig`, the `main.ts` reads account and region from a centralized config file instead, falling back to environment variables when no config is set:
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 enableStageConfig)"
104
+ ```ts title="src/main.ts (with stageConfig)"
105
105
  import stagesConfig from ':my-scope/common-infra-config';
106
106
 
107
107
  const projectStages = stagesConfig.projects?.['packages/infra']?.stages ?? {};
@@ -158,12 +158,12 @@ export class ApplicationStage extends Stage {
158
158
  ### Stage Credential Configuration
159
159
 
160
160
  :::note[Staged Configuration]
161
- This section applies when you generate with `enableStageConfig`. Without it, the generator produces a simpler setup where you manage AWS credentials yourself (e.g., by exporting `AWS_PROFILE` before deploying).
161
+ 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
162
  :::
163
163
 
164
164
  When you have multiple stages targeting different AWS accounts, managing credentials manually can be error-prone, especially as the number of stages grows.
165
165
 
166
- The `enableStageConfig` option solves this by generating two shared packages:
166
+ The `stageConfig` option solves this by generating two shared packages:
167
167
 
168
168
  - **`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
169
  - **`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.
@@ -375,7 +375,7 @@ After a build, you can deploy your infrastructure to AWS using the `deploy` targ
375
375
  Use the `deploy-ci` target if deploying in a CI/CD pipeline. See below for more details.
376
376
  :::
377
377
 
378
- First, make sure you have AWS credentials configured. If you generated with `enableStageConfig` 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.
378
+ 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
379
 
380
380
  Then run the deploy target:
381
381
 
@@ -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 `iacProvider`. You can use this to deploy your function.
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 `iacProvider`.
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">
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Runtime Config App ID Note
3
+ ---
4
+ import Link from '@components/link.astro';
5
+
6
+ :::note[Runtime config]
7
+ This relies on the `RUNTIME_CONFIG_APP_ID` environment variable to fetch configuration from AWS AppConfig at runtime. Projects built with this plugin (APIs, Agents, MCP servers) already have this variable configured automatically. For other 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>.
8
+ :::
@@ -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 `iacProvider`, it will create a project in `packages/common` which includes the relevant CDK constructs or Terraform modules.
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
- The Docker image built for this project is scanned for vulnerabilities as part of the build using [Trivy](https://trivy.dev/), running from the [ECR-hosted Trivy image](https://gallery.ecr.aws/aquasecurity/trivy).
5
+ import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
6
6
 
7
- A `trivy` target is added to your project which scans the built image and **fails the build** 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.
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
- 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.
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
@@ -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": "g56"
219
+ },
214
220
  "ts#mcp-server": {
215
221
  "factory": "./src/ts/mcp-server/generator",
216
222
  "schema": "./src/ts/mcp-server/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.43",
3
+ "version": "1.0.0-rc.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -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 iam is supported today; cognito and custom-jwt may be added in future.",
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
+ }