@aws/nx-plugin-mcp 0.119.0 → 0.121.0

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 (89) hide show
  1. package/bin/aws-nx-mcp.js +23 -35
  2. package/docs/guides/astro-docs.mdx +142 -0
  3. package/docs/guides/connection/py-agent-a2a.mdx +105 -0
  4. package/docs/guides/connection/py-agent-mcp.mdx +147 -0
  5. package/docs/guides/connection/react-agui.mdx +240 -0
  6. package/docs/guides/connection/react-fastapi.mdx +1476 -0
  7. package/docs/guides/connection/react-py-agent.mdx +198 -0
  8. package/docs/guides/connection/react-smithy.mdx +1355 -0
  9. package/docs/guides/connection/react-trpc.mdx +447 -0
  10. package/docs/guides/connection/react-ts-agent.mdx +198 -0
  11. package/docs/guides/connection/smithy-rdb.mdx +161 -0
  12. package/docs/guides/connection/trpc-rdb.mdx +127 -0
  13. package/docs/guides/connection/ts-agent-a2a.mdx +106 -0
  14. package/docs/guides/connection/ts-agent-mcp.mdx +144 -0
  15. package/docs/guides/connection/ts-agent-rdb.mdx +141 -0
  16. package/docs/guides/connection/ts-mcp-server-rdb.mdx +135 -0
  17. package/docs/guides/connection.mdx +126 -0
  18. package/docs/guides/docker-bundling.mdx +403 -0
  19. package/docs/guides/fastapi.mdx +509 -0
  20. package/docs/guides/license.mdx +293 -0
  21. package/docs/guides/nx-generator.mdx +588 -0
  22. package/docs/guides/py-agent.mdx +483 -0
  23. package/docs/guides/py-mcp-server.mdx +161 -0
  24. package/docs/guides/python-lambda-function.mdx +207 -0
  25. package/docs/guides/python-project.mdx +228 -0
  26. package/docs/guides/react-website-auth.mdx +216 -0
  27. package/docs/guides/react-website.mdx +421 -0
  28. package/docs/guides/runtime-config.mdx +312 -0
  29. package/docs/guides/terraform-project.mdx +317 -0
  30. package/docs/guides/trpc.mdx +816 -0
  31. package/docs/guides/ts-agent.mdx +436 -0
  32. package/docs/guides/ts-lambda-function.mdx +218 -0
  33. package/docs/guides/ts-mcp-server.mdx +169 -0
  34. package/docs/guides/ts-nx-plugin.mdx +159 -0
  35. package/docs/guides/ts-rdb.mdx +759 -0
  36. package/docs/guides/ts-smithy-api.mdx +661 -0
  37. package/docs/guides/typescript-infrastructure.mdx +408 -0
  38. package/docs/guides/typescript-project.mdx +312 -0
  39. package/docs/guides/workspace.mdx +181 -0
  40. package/docs/snippets/agent/architecture.mdx +72 -0
  41. package/docs/snippets/agent/bedrock-deployment.mdx +172 -0
  42. package/docs/snippets/agent/runtime-arn.mdx +64 -0
  43. package/docs/snippets/api/api-architecture.mdx +93 -0
  44. package/docs/snippets/api/api-choice-note.mdx +6 -0
  45. package/docs/snippets/api/cors-configuration-cdk-note.mdx +25 -0
  46. package/docs/snippets/api/cors-configuration-terraform-note.mdx +28 -0
  47. package/docs/snippets/api/shared-constructs.mdx +38 -0
  48. package/docs/snippets/api/type-safe-api-integrations.mdx +643 -0
  49. package/docs/snippets/api/waf-configuration.mdx +37 -0
  50. package/docs/snippets/connection/a2a-infrastructure.mdx +63 -0
  51. package/docs/snippets/connection/lambda-rdb-ssl-requirements.mdx +40 -0
  52. package/docs/snippets/connection/mcp-server-rdb-ssl-requirements.mdx +35 -0
  53. package/docs/snippets/connection/rdb-api-infrastructure.mdx +72 -0
  54. package/docs/snippets/connection/react-agent-infrastructure.mdx +61 -0
  55. package/docs/snippets/connection/strands-agent-rdb-ssl-requirements.mdx +35 -0
  56. package/docs/snippets/lambda-function/architecture.mdx +36 -0
  57. package/docs/snippets/lambda-function/deploying-your-function.mdx +118 -0
  58. package/docs/snippets/mcp/architecture.mdx +58 -0
  59. package/docs/snippets/mcp/assistant-docs.mdx +10 -0
  60. package/docs/snippets/mcp/bedrock-deployment.mdx +167 -0
  61. package/docs/snippets/mcp/config.mdx +13 -0
  62. package/docs/snippets/mcp/configuration-py.mdx +42 -0
  63. package/docs/snippets/mcp/configuration-ts.mdx +53 -0
  64. package/docs/snippets/mcp/observability.mdx +8 -0
  65. package/docs/snippets/mcp/shared-constructs.mdx +32 -0
  66. package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +602 -0
  67. package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +915 -0
  68. package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +161 -0
  69. package/docs/snippets/pdk-migration/example/04-deploy.mdx +229 -0
  70. package/docs/snippets/pdk-migration/faq/aws-arch.mdx +17 -0
  71. package/docs/snippets/pdk-migration/faq/cdk-graph.mdx +29 -0
  72. package/docs/snippets/pdk-migration/faq/infrastructure-python-java.mdx +19 -0
  73. package/docs/snippets/pdk-migration/faq/pdk-nag.mdx +15 -0
  74. package/docs/snippets/pdk-migration/faq/pipeline.mdx +15 -0
  75. package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +310 -0
  76. package/docs/snippets/pdk-migration/faq/use-of-projen.mdx +15 -0
  77. package/docs/snippets/prerequisites.mdx +20 -0
  78. package/docs/snippets/required-prerequisites.mdx +12 -0
  79. package/docs/snippets/shared-constructs.mdx +40 -0
  80. package/docs/snippets/tools/acurl.mdx +73 -0
  81. package/docs/snippets/ts-bundle.mdx +14 -0
  82. package/package.json +1 -1
  83. package/src/py/agent/schema.json +1 -1
  84. package/src/py/fast-api/schema.json +2 -2
  85. package/src/py/mcp-server/schema.json +1 -1
  86. package/src/smithy/ts/api/schema.json +2 -2
  87. package/src/trpc/backend/schema.json +2 -2
  88. package/src/ts/agent/schema.json +1 -1
  89. package/src/ts/mcp-server/schema.json +1 -1
@@ -0,0 +1,167 @@
1
+ ---
2
+ title: MCP Bedrock Deployment
3
+ ---
4
+ import Link from '@components/link.astro';
5
+ import Infrastructure from '@components/infrastructure.astro';
6
+
7
+ ### Infrastructure as Code
8
+
9
+ If you selected `BedrockAgentCoreRuntime` for `computeType`, the relevant CDK or Terraform infrastructure is generated which you can use to deploy your MCP server to [Amazon Bedrock AgentCore Runtime](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agents-tools-runtime.html).
10
+
11
+ <Infrastructure>
12
+ <Fragment slot="cdk">
13
+ A CDK construct is generated for your MCP Server, named based on the `name` you chose when running the generator, or `<ProjectName>McpServer` by default.
14
+
15
+ You can use this CDK construct in a CDK application:
16
+
17
+ ```ts {6}
18
+ import { MyProjectMcpServer } from ':my-scope/common-constructs';
19
+
20
+ export class ExampleStack extends Stack {
21
+ constructor(scope: Construct, id: string) {
22
+ // Add the MCP server to your stack
23
+ new MyProjectMcpServer(this, 'MyProjectMcpServer');
24
+ }
25
+ }
26
+ ```
27
+
28
+ :::note[CDK Construct]
29
+ This construct uses the [`aws-cdk-lib/aws-bedrockagentcore` module](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore-readme.html).
30
+ :::
31
+ </Fragment>
32
+ <Fragment slot="terraform">
33
+ A Terraform module is generated for you, named based on the `name` you chose when running the generator, or `<ProjectName>-mcp-server` by default.
34
+
35
+ Pass the shared <Link path="/guides/runtime-config#writing-configuration">`runtime_config_appconfig`</Link> module's outputs into the MCP server module:
36
+
37
+ ```terraform
38
+ module "my_project_mcp_server" {
39
+ source = "../../common/terraform/src/app/mcp-servers/my-project-mcp-server"
40
+
41
+ appconfig_application_id = module.runtime_config_appconfig.application_id
42
+ appconfig_application_arn = module.runtime_config_appconfig.application_arn
43
+ }
44
+ ```
45
+ </Fragment>
46
+ </Infrastructure>
47
+
48
+ :::caution[Docker Required]
49
+ [Docker](https://www.docker.com/) is required to build and deploy your MCP server. Make sure you have installed and launched Docker to avoid errors such as:
50
+
51
+ ```
52
+ ERROR: Cannot connect to the Docker daemon at unix://path/to/docker.sock.
53
+ ```
54
+ :::
55
+
56
+ ### Authentication
57
+
58
+ The generator provides an `auth` option to configure authentication for your MCP server. You can choose between `IAM` (default) or `Cognito` authentication when generating your MCP server.
59
+
60
+ #### IAM
61
+
62
+ By default, your MCP server will be secured using IAM authentication, simply deploy it without any arguments:
63
+
64
+ <Infrastructure>
65
+ <Fragment slot="cdk">
66
+ ```ts {5}
67
+ import { MyProjectMcpServer } from ':my-scope/common-constructs';
68
+
69
+ export class ExampleStack extends Stack {
70
+ constructor(scope: Construct, id: string) {
71
+ new MyProjectMcpServer(this, 'MyProjectMcpServer');
72
+ }
73
+ }
74
+ ```
75
+
76
+ You can grant access to invoke your MCP server on Bedrock AgentCore Runtime using the `grantInvokeAccess` method. For example you may wish for an agent generated with the <Link path="/guides/py-agent">`py#agent`</Link> generator to call your MCP server:
77
+
78
+ ```ts {8}
79
+ import { MyProjectAgent, MyProjectMcpServer } from ':my-scope/common-constructs';
80
+
81
+ export class ExampleStack extends Stack {
82
+ constructor(scope: Construct, id: string) {
83
+ const agent = new MyProjectAgent(this, 'MyProjectAgent');
84
+ const mcpServer = new MyProjectMcpServer(this, 'MyProjectMcpServer');
85
+
86
+ mcpServer.grantInvokeAccess(agent);
87
+ }
88
+ }
89
+ ```
90
+ </Fragment>
91
+ <Fragment slot="terraform">
92
+ ```terraform {5-6}
93
+ # MCP Server
94
+ module "my_project_mcp_server" {
95
+ # Relative path to the generated module in the common/terraform project
96
+ source = "../../common/terraform/src/app/mcp-servers/my-project-mcp-server"
97
+
98
+ appconfig_application_id = module.runtime_config_appconfig.application_id
99
+ appconfig_application_arn = module.runtime_config_appconfig.application_arn
100
+ }
101
+ ```
102
+
103
+ To grant access to invoke your MCP server, you will need to add a policy such as the following, referencing the `module.my_project_mcp_server.agent_core_runtime_arn` output:
104
+
105
+ ```terraform
106
+ {
107
+ Effect = "Allow"
108
+ Action = [
109
+ "bedrock-agentcore:InvokeAgentRuntime"
110
+ ]
111
+ Resource = [
112
+ module.my_project_mcp_server.agent_core_runtime_arn,
113
+ "${module.my_project_mcp_server.agent_core_runtime_arn}/*"
114
+ ]
115
+ }
116
+ ```
117
+ </Fragment>
118
+ </Infrastructure>
119
+
120
+ #### Cognito Authentication
121
+
122
+ When you select `Cognito` authentication, the generator configures the MCP server to use Cognito for authentication.
123
+
124
+ <Infrastructure>
125
+ <Fragment slot="cdk">
126
+ The generated construct accepts an `identity` prop which configures Cognito authentication:
127
+
128
+ ```ts {8}
129
+ import { MyProjectMcpServer, UserIdentity } from ':my-scope/common-constructs';
130
+
131
+ export class ExampleStack extends Stack {
132
+ constructor(scope: Construct, id: string) {
133
+ const identity = new UserIdentity(this, 'Identity');
134
+
135
+ new MyProjectMcpServer(this, 'MyProjectMcpServer', {
136
+ identity,
137
+ });
138
+ }
139
+ }
140
+ ```
141
+
142
+ The `UserIdentity` construct can be generated using the <Link path="/guides/react-website-auth">`ts#react-website#auth` generator</Link>, or you can create your own CDK `UserPool` and `UserPoolClient`.
143
+ </Fragment>
144
+ <Fragment slot="terraform">
145
+ The generated module accepts `user_pool_id` and `user_pool_client_ids` variables for Cognito authentication:
146
+
147
+ ```terraform {8-9}
148
+ module "user_identity" {
149
+ source = "../../common/terraform/src/core/user-identity"
150
+ }
151
+
152
+ module "my_project_mcp_server" {
153
+ source = "../../common/terraform/src/app/mcp-servers/my-project-mcp-server"
154
+
155
+ appconfig_application_id = module.runtime_config_appconfig.application_id
156
+ appconfig_application_arn = module.runtime_config_appconfig.application_arn
157
+
158
+ user_pool_id = module.user_identity.user_pool_id
159
+ user_pool_client_ids = [module.user_identity.user_pool_client_id]
160
+ }
161
+ ```
162
+ </Fragment>
163
+ </Infrastructure>
164
+
165
+ :::note[Custom OIDC Providers]
166
+ If you require custom JWT authentication with a non-Cognito OIDC provider, you can modify the generated CDK construct or Terraform module for your MCP server directly. Note that the connection generator will only support `IAM` or `Cognito` authentication.
167
+ :::
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: MCP Server Configuration
3
+ ---
4
+ ```json {3-6}
5
+ {
6
+ "mcpServers": {
7
+ "nx-plugin-for-aws": {
8
+ "command": "npx",
9
+ "args": ["-y", "@aws/nx-plugin-mcp"]
10
+ }
11
+ }
12
+ }
13
+ ```
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: MCP Server Configuration
3
+ ---
4
+
5
+ ### Configuration Files
6
+
7
+ Most AI assistants that support MCP use a similar configuration approach. You'll need to create or update a configuration file with your MCP server details:
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "your-mcp-server": {
13
+ "command": "uv",
14
+ "args": [
15
+ "run",
16
+ "python",
17
+ "-m",
18
+ "my_module.mcp_server.stdio"
19
+ ],
20
+ "env": {
21
+ "VIRTUAL_ENV": "/path/to/your/project/.venv"
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ :::caution[Path Resolution]
29
+ If you receive an error such as `ENOENT uv` when connecting to your server, you might need to specify the full path to `uv`, which you can obtain by running `which uv` in your terminal.
30
+ :::
31
+
32
+ ### Assistant-Specific Configuration
33
+
34
+ Please refer to the following documentation for configuring MCP with specific AI Assistants:
35
+
36
+ import Snippet from '@components/snippet.astro';
37
+
38
+ <Snippet name="mcp/assistant-docs" />
39
+
40
+ :::tip[Workspace Configuration]
41
+ Some AI Assistants, such as Kiro, allow you to specify workspace level MCP server configuration, which is particularly useful for defining the relevant MCP servers for a particular project.
42
+ :::
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: MCP Server Configuration
3
+ ---
4
+
5
+ ### Configuration Files
6
+
7
+ Most AI assistants that support MCP use a similar configuration approach. You'll need to create or update a configuration file with your MCP server details:
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "your-mcp-server": {
13
+ "command": "npx",
14
+ "args": ["tsx", "/path/to/your-mcp-server/stdio.ts"]
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ :::caution[Path Resolution]
21
+ If you receive an error such as `ENOENT npx` when connecting to your server, you might need to specify the full path to `npx`, which you can obtain by running `which npx` in your terminal.
22
+ :::
23
+
24
+ ### Hot Reload
25
+
26
+ While developing your MCP server, you may wish to configure the `--watch` flag so that the AI assistant always sees the latest versions of tools/resources:
27
+
28
+ ```json {5}
29
+ {
30
+ "mcpServers": {
31
+ "your-mcp-server": {
32
+ "command": "npx",
33
+ "args": ["tsx", "--watch", "/path/to/your-mcp-server/stdio.ts"]
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ :::note[Refreshing Tools]
40
+ If you add new tools or resources you may need to refresh your MCP server in the AI assistant.
41
+ :::
42
+
43
+ ### Assistant-Specific Configuration
44
+
45
+ Please refer to the following documentation for configuring MCP with specific AI Assistants:
46
+
47
+ import Snippet from '@components/snippet.astro';
48
+
49
+ <Snippet name="mcp/assistant-docs" />
50
+
51
+ :::tip[Workspace Configuration]
52
+ Some AI Assistants, such as Kiro, allow you to specify workspace level MCP server configuration, which is particularly useful for defining the relevant MCP servers for a particular project.
53
+ :::
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: MCP Observability
3
+ ---
4
+ Your MCP server is automatically configured with observability using the [AWS Distro for Open Telemetry](https://aws.amazon.com/otel/) (ADOT), by configuring auto-instrumentation in your `Dockerfile`.
5
+
6
+ You can find traces in the CloudWatch AWS Console, by selecting "GenAI Observability" in the menu. Note that for traces to be populated you will need to enable [Transaction Search](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Transaction-Search.html).
7
+
8
+ For more details, refer to the [AgentCore documentation on observability](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/observability-configure.html).
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: MCP Shared Constructs
3
+ ---
4
+ import { FileTree } from '@astrojs/starlight/components';
5
+ import Infrastructure from '@components/infrastructure.astro';
6
+
7
+ For deploying your MCP Server, the following files are generated:
8
+
9
+ <Infrastructure>
10
+ <Fragment slot="cdk">
11
+ <FileTree>
12
+ - packages/common/constructs/src
13
+ - app
14
+ - mcp-servers
15
+ - \<project-name>
16
+ - \<project-name>.ts CDK construct for deploying your MCP Server
17
+ - Dockerfile Passthrough docker file used by the CDK construct
18
+ </FileTree>
19
+ </Fragment>
20
+ <Fragment slot="terraform">
21
+ <FileTree>
22
+ - packages/common/terraform/src
23
+ - app
24
+ - mcp-servers
25
+ - \<project-name>
26
+ - \<project-name>.tf Module for deploying your MCP Server
27
+ - core
28
+ - agent-core
29
+ - runtime.tf Generic module for deploying to Bedrock AgentCore Runtime
30
+ </FileTree>
31
+ </Fragment>
32
+ </Infrastructure>