@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,169 @@
1
+ ---
2
+ title: TypeScript MCP Server
3
+ description: Generate a TypeScript Model Context Protocol (MCP) server for providing context to Large Language Models
4
+ generator: ts#mcp-server
5
+ ---
6
+
7
+ import { FileTree } from '@astrojs/starlight/components';
8
+ import RunGenerator from '@components/run-generator.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import Link from '@components/link.astro';
11
+ import Snippet from '@components/snippet.astro';
12
+ import GeneratorParameters from '@components/generator-parameters.astro';
13
+ import OptionFilter from '@components/option-filter.astro';
14
+
15
+ Generate a TypeScript [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for providing context to Large Language Models (LLMs), and optionally deploy it to [Amazon Bedrock AgentCore](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/).
16
+
17
+ ## What is MCP?
18
+
19
+ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) is an open standard that allows AI assistants to interact with external tools and resources. It provides a consistent way for LLMs to:
20
+
21
+ - Execute tools (functions) that perform actions or retrieve information
22
+ - Access resources that provide context or data
23
+
24
+ ## Usage
25
+
26
+ ### Generate an MCP Server
27
+
28
+ You can generate a TypeScript MCP server in two ways:
29
+
30
+ <RunGenerator generator="ts#mcp-server" />
31
+
32
+ :::tip[Project Prerequisite]
33
+ First use the <Link path="/guides/typescript-project">`ts#project`</Link> generator to create a project to add your MCP server to.
34
+ :::
35
+
36
+ ### Options
37
+
38
+ <GeneratorParameters generator="ts#mcp-server" />
39
+
40
+ ## Generator Output
41
+
42
+ The generator will add the following files to your existing TypeScript project:
43
+
44
+ <FileTree>
45
+ - your-project/
46
+ - src/
47
+ - mcp-server/ (or custom name if specified)
48
+ - index.ts Exports your server
49
+ - server.ts Main server definition
50
+ - stdio.ts Entry point for STDIO transport, useful for simple local MCP servers
51
+ - http.ts Entry point for Streamable HTTP transport, useful for hosting your MCP server
52
+ - tools/
53
+ - divide.ts Sample tool
54
+ - resources/
55
+ - sample-guidance.ts Sample resource
56
+ - Dockerfile Entry point for hosting your MCP server (excluded when `computeType` is set to `None`)
57
+ - package.json Updated with bin entry and MCP dependencies
58
+ - project.json Updated with MCP server serve target
59
+ </FileTree>
60
+
61
+ ### Infrastructure
62
+
63
+ <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment">
64
+ <Snippet name="shared-constructs" />
65
+
66
+ <Snippet name="mcp/shared-constructs" />
67
+ </OptionFilter>
68
+
69
+ <OptionFilter when={{ computeType: 'None' }} description="No infrastructure is vended for computeType=None">
70
+ If you selected `None` for `computeType`, no CDK constructs or Terraform modules are generated — the MCP server is configured for local STDIO / HTTP use only. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
71
+ </OptionFilter>
72
+
73
+ #### Architecture
74
+
75
+ <Snippet name="mcp/architecture" />
76
+
77
+ ## Working with Your MCP Server
78
+
79
+ ### Adding Tools
80
+
81
+ Tools are functions that the AI assistant can call to perform actions. You can add new tools in the `server.ts` file:
82
+
83
+ ```typescript
84
+ server.registerTool("toolName", {
85
+ description: "tool description",
86
+ inputSchema: { param1: z.string(), param2: z.number() } // Input schema using Zod
87
+ },
88
+ async ({ param1, param2 }) => {
89
+ // Tool implementation
90
+ return {
91
+ content: [{ type: "text", text: "Result" }]
92
+ };
93
+ }
94
+ );
95
+ ```
96
+
97
+ ### Adding Resources
98
+
99
+ Resources provide context to the AI assistant. You can add static resources from files or dynamic resources:
100
+
101
+ ```typescript
102
+ const exampleContext = 'some context to return';
103
+
104
+ server.registerResource('resource-name', 'example://resource', {}, async (uri) => ({
105
+ contents: [{ uri: uri.href, text: exampleContext }],
106
+ }));
107
+
108
+ // Dynamic resource
109
+ server.registerResource('dynamic-resource', 'dynamic://resource', {}, async (uri) => {
110
+ const data = await fetchSomeData();
111
+ return {
112
+ contents: [{ uri: uri.href, text: data }],
113
+ };
114
+ });
115
+ ```
116
+
117
+ ## Configuring with AI Assistants
118
+
119
+ <Snippet name="mcp/configuration-ts" parentHeading="Configuring with AI Assistants" />
120
+
121
+ ## Running Your MCP Server
122
+
123
+ ### Inspector
124
+
125
+ The generator configures a target named `<your-server-name>-inspect`, which starts the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) with the configuration to connect to your MCP server using STDIO transport.
126
+
127
+ <NxCommands commands={['your-server-name-inspect your-project']} />
128
+
129
+ This will start the inspector at `http://localhost:6274`. Get started by clicking on the "Connect" button.
130
+
131
+ ### STDIO
132
+
133
+ The easiest way to test and use an MCP server is by using the inspector or configuring it with an AI assistant (as above).
134
+
135
+ You can however run your server with [STDIO transport](https://modelcontextprotocol.io/docs/concepts/transports#standard-input%2Foutput-stdio) directly using the `<your-server-name>-serve-stdio` target.
136
+
137
+ <NxCommands commands={['your-server-name-serve-stdio your-project']} />
138
+
139
+ This command uses `tsx --watch` to automatically restart the server when files change.
140
+
141
+ ### Streamable HTTP
142
+
143
+ If you would like to run your MCP server locally using [Streamable HTTP transport](https://modelcontextprotocol.io/docs/concepts/transports#streamable-http), you can use the `<your-server-name>-serve` target.
144
+
145
+ <NxCommands commands={['your-server-name-serve your-project']} />
146
+
147
+ This command uses `tsx --watch` to automatically restart the server when files change.
148
+
149
+ <OptionFilter when={{ computeType: 'BedrockAgentCoreRuntime' }} description="Bedrock AgentCore Runtime deployment details">
150
+ ## Deploying Your MCP Server to Bedrock AgentCore Runtime
151
+
152
+ <Snippet name="mcp/bedrock-deployment" parentHeading="Deploying Your MCP Server to Bedrock AgentCore Runtime" />
153
+
154
+ ### Bundle Target
155
+
156
+ <Snippet name="ts-bundle" />
157
+
158
+ The bundle target uses `http.ts` as the entrypoint for the Streamable HTTP MCP server to host on Bedrock AgentCore Runtime.
159
+
160
+ ### Docker Target
161
+
162
+ The generator configures a `<your-server-name>-docker` target which copies the `Dockerfile` from your MCP server source directory into the bundle output directory. This co-locates the `Dockerfile` with the bundled artifacts, allowing CDK to build the Docker image directly using `AgentRuntimeArtifact.fromAsset`.
163
+
164
+ A `docker` target is also generated which prepares the docker context for all MCP servers if you have multiple defined.
165
+
166
+ ### Observability
167
+
168
+ <Snippet name="mcp/observability" parentHeading="Observability" />
169
+ </OptionFilter>
@@ -0,0 +1,159 @@
1
+ ---
2
+ title: TypeScript Nx Plugin
3
+ description: Generate an Nx Plugin of your own! Build custom generators automatically made available for AI vibe-coding via MCP
4
+ generator: ts#nx-plugin
5
+ ---
6
+
7
+ import { FileTree } from '@astrojs/starlight/components';
8
+ import RunGenerator from '@components/run-generator.astro';
9
+ import NxCommands from '@components/nx-commands.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import Link from '@components/link.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+ import InstallCommand from '@components/install-command.astro';
14
+
15
+ Generate a complete TypeScript [Nx Plugin](https://nx.dev/extending-nx/intro/getting-started) with an integrated [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server. This generator creates a foundation for building custom generators that can be seamlessly used by AI assistants for automated code generation and project scaffolding.
16
+
17
+ ## Usage
18
+
19
+ ### Generate an Nx Plugin
20
+
21
+ You can generate a TypeScript Nx Plugin in two ways:
22
+
23
+ <RunGenerator generator="ts#nx-plugin" />
24
+
25
+ ### Options
26
+
27
+ <GeneratorParameters generator="ts#nx-plugin" />
28
+
29
+ ## Generator Output
30
+
31
+ The generator will create the following project structure:
32
+
33
+ <FileTree>
34
+ - your-plugin/
35
+ - src/
36
+ - index.ts Empty entry point for your plugin
37
+ - mcp-server/
38
+ - index.ts Exports your server
39
+ - server.ts Main MCP server configuration
40
+ - stdio.ts Entry point for your MCP server with STDIO transport
41
+ - http.ts Entry point for your MCP server with Streamable HTTP transport
42
+ - tools/
43
+ - create-workspace-command.ts Tool for workspace creation guidance
44
+ - general-guidance.ts Tool for general Nx and plugin guidance
45
+ - list-generators.ts Tool to list available generators
46
+ - generator-guide.ts Tool for detailed generator information
47
+ - utils.ts Utility functions for the MCP server
48
+ - generators.json Nx generator configuration (initially empty)
49
+ - package.json Plugin package configuration with MCP server binary
50
+ - tsconfig.json TypeScript configuration (CommonJS for Nx compatibility)
51
+ - project.json Nx project configuration with build and package targets
52
+ </FileTree>
53
+
54
+ ## Working with Your Nx Plugin
55
+
56
+ ### Adding Generators
57
+
58
+ Once you have your plugin project, you can add generators using the <Link path="/guides/ts-nx-generator">`ts#nx-generator`</Link> generator:
59
+
60
+ <RunGenerator generator="ts#nx-generator" requiredParameters={{ pluginProject: 'your-plugin' }} />
61
+
62
+ This will add a new generator to your plugin.
63
+
64
+ :::tip[Generator Documentation]
65
+ Read the <Link path="/guides/ts-nx-generator">`ts#nx-generator` guide</Link> for details about how to implement generators.
66
+ :::
67
+
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
+
70
+ ### Project Targets
71
+
72
+ The generated plugin includes several important targets:
73
+
74
+ #### Build Target
75
+ Compiles your TypeScript code and prepares the plugin for use:
76
+
77
+ <NxCommands commands={['build your-plugin']} />
78
+
79
+ #### Package Target
80
+ Creates a distributable package ready for NPM publishing:
81
+
82
+ <NxCommands commands={['package your-plugin']} />
83
+
84
+ The package target includes all necessary assets:
85
+ - Compiled JavaScript files
86
+ - TypeScript declaration files
87
+ - Generator and executor configuration files
88
+ - Documentation and license files
89
+
90
+ ## MCP Server Integration
91
+
92
+ The plugin configures an MCP server using the <Link path="/guides/ts-mcp-server">`ts#mcp-server`</Link> generator.
93
+
94
+ ### Tools
95
+
96
+ The plugin includes a complete MCP server that provides AI assistants the following tools:
97
+
98
+ - `general-guidance`: Get best practices for working with Nx and your plugin
99
+ - `create-workspace-command`: Learn how to create new workspaces that can use your plugin
100
+ - `list-generators`: List all available generators in your plugin
101
+ - `generator-guide`: Get detailed information about specific generators including schemas and usage
102
+
103
+ ### Configuring with AI Assistants
104
+
105
+ <Snippet name="mcp/configuration-ts" parentHeading="Configuring with AI Assistants" />
106
+
107
+ ### Customizing the MCP Server
108
+
109
+ You can extend the MCP server by modifying `server.ts` to add additional tools or resources specific to your plugin's domain.
110
+
111
+ For more details about writing MCP Servers, refer to the <Link path="/guides/ts-mcp-server">`ts#mcp-server` guide</Link>.
112
+
113
+ ## Publishing Your Plugin
114
+
115
+ ### Preparing for Publication
116
+
117
+ 1. **Update Package Information**: Edit your plugin's [`package.json`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json) with proper name, version, description, and repository information.
118
+
119
+ 2. **Build the Package**:
120
+ <NxCommands commands={['package your-plugin']} />
121
+
122
+ 3. **Test Locally**: You can test your plugin locally by installing it in another workspace:
123
+ ```bash
124
+ npm install /path/to/your/workspace/dist/your-plugin/package
125
+ ```
126
+
127
+ ### Publishing to NPM
128
+
129
+ Once your plugin is ready:
130
+
131
+ ```bash
132
+ cd dist/your-plugin/package
133
+ npm publish
134
+ ```
135
+
136
+ ### Using Published Plugins
137
+
138
+ After publishing, others can install and use your plugin:
139
+
140
+ <InstallCommand pkg="your-plugin-name" />
141
+
142
+ Then use your generators:
143
+
144
+ <RunGenerator namespace="your-plugin-name" generator="your-generator-name" />
145
+
146
+ #### Configure AI Assistants with your Published Plugin
147
+
148
+ Your published plugin's MCP server can be configured as follows:
149
+
150
+ ```json {3-6}
151
+ {
152
+ "mcpServers": {
153
+ "aws-nx-mcp": {
154
+ "command": "npx",
155
+ "args": ["-y", "-p", "your-plugin-name", "your-plugin-name-mcp-server"]
156
+ }
157
+ }
158
+ }
159
+ ```