@aws/nx-plugin 0.18.3 → 0.19.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.
- package/README.md +2 -0
- package/generators.json +13 -1
- package/package.json +1 -1
- package/src/ts/lib/ts-project-utils.js +0 -1
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +330 -0
- package/src/ts/mcp-server/files/README.md.template +108 -0
- package/src/ts/mcp-server/files/src/global.d.ts.template +4 -0
- package/src/ts/mcp-server/files/src/index.ts.template +6 -0
- package/src/ts/mcp-server/files/src/resources/example-context.md +3 -0
- package/src/ts/mcp-server/files/src/server.ts.template +28 -0
- package/src/ts/mcp-server/generator.d.ts +10 -0
- package/src/ts/mcp-server/generator.js +61 -0
- package/src/ts/mcp-server/generator.js.map +1 -0
- package/src/ts/mcp-server/schema.d.ts +11 -0
- package/src/ts/mcp-server/schema.json +27 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +263 -0
- package/src/ts/nx-generator/files/common/schema.d.ts.template +8 -0
- package/src/ts/nx-generator/files/common/schema.json.template +16 -0
- package/src/ts/nx-generator/files/local/files/hello.ts.template.template +4 -0
- package/src/ts/nx-generator/files/local/generator.spec.ts.template +17 -0
- package/src/ts/nx-generator/files/local/generator.ts.template +9 -0
- package/src/ts/nx-generator/files/nx-plugin-for-aws/docs/__nameKebabCase__.mdx.template +41 -0
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.spec.ts.template +27 -0
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +22 -0
- package/src/ts/nx-generator/generator.d.ts +9 -0
- package/src/ts/nx-generator/generator.js +137 -0
- package/src/ts/nx-generator/generator.js.map +1 -0
- package/src/ts/nx-generator/schema.d.ts +11 -0
- package/src/ts/nx-generator/schema.json +38 -0
- package/src/utils/versions.d.ts +3 -1
- package/src/utils/versions.js +2 -0
- package/src/utils/versions.js.map +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
- `ts#cloudscape-website` - Generate a new Cloudscape/React/Vite based web application.
|
|
57
57
|
- `ts#cloudscape-website#auth` - Add AWS Cognito authentication to your Cloudscape website.
|
|
58
58
|
- `ts#trpc-api` - Generate a tRPC backend service with Amazon API Gateway/AWS Lambda integration and [AWS Powertools](https://github.com/aws-powertools/powertools-lambda-typescript) pre-configured.
|
|
59
|
+
- `ts#nx-generator` - Add an [Nx Generator](https://nx.dev/features/generate-code) to a TypeScript project.
|
|
60
|
+
- `ts#mcp-server` - Generate a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server in TypeScript.
|
|
59
61
|
- `py#project` - Generate a uv based Python project.
|
|
60
62
|
- `py#fast-api` - Generate a FastAPI backend service with [AWS Powertools](https://github.com/aws-powertools/powertools-lambda-python) pre-configured.
|
|
61
63
|
- `py#lambda-function` - Add a lambda function to an existing python project with optional type-safe event sources.
|
package/generators.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"name": "
|
|
3
|
+
"name": "@aws/nx-plugin",
|
|
4
4
|
"version": "0.0.1",
|
|
5
5
|
"generators": {
|
|
6
6
|
"ts#project": {
|
|
@@ -104,6 +104,18 @@
|
|
|
104
104
|
"schema": "./src/py/lambda-function/schema.json",
|
|
105
105
|
"description": "Adds a lambda function to a python project",
|
|
106
106
|
"metric": "g16"
|
|
107
|
+
},
|
|
108
|
+
"ts#nx-generator": {
|
|
109
|
+
"factory": "./src/ts/nx-generator/generator",
|
|
110
|
+
"schema": "./src/ts/nx-generator/schema.json",
|
|
111
|
+
"description": "Generator for adding an Nx Generator to an existing TypeScript project",
|
|
112
|
+
"metric": "g17"
|
|
113
|
+
},
|
|
114
|
+
"ts#mcp-server": {
|
|
115
|
+
"factory": "./src/ts/mcp-server/generator",
|
|
116
|
+
"schema": "./src/ts/mcp-server/schema.json",
|
|
117
|
+
"description": "Generate a TypeScript Model Context Protocol (MCP) server for providing context to Large Language Models",
|
|
118
|
+
"metric": "g18"
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
121
|
}
|
package/package.json
CHANGED
|
@@ -34,7 +34,6 @@ const configureTsProject = (tree, options) => {
|
|
|
34
34
|
// Add aliases which begin with colon (eg :foo/bar) to avoid sniping attacks
|
|
35
35
|
[(0, npm_scope_1.toScopeAlias)(options.fullyQualifiedName)]: [
|
|
36
36
|
(0, devkit_1.joinPathFragments)(options.dir, 'src', 'index.ts'),
|
|
37
|
-
(0, devkit_1.joinPathFragments)('dist', options.dir, 'src', 'index.d.ts'),
|
|
38
37
|
] }) }) }));
|
|
39
38
|
});
|
|
40
39
|
if (tree.exists('tsconfig.json')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-project-utils.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAAiE;AACjE,+BAAsC;AACtC,qDAAqD;AAErD,qCAA2C;AAC3C,qCAA2C;AAE3C;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,IAAU,EACV,OAAgC,EAChC,EAAE;IACF,mDAAmD;IACnD,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE;;QAAC,OAAA,iCAC9D,QAAQ,KACX,eAAe,kCACV,QAAQ,CAAC,eAAe,KAC3B,MAAM,EACJ,CAAA,MAAA,QAAQ,CAAC,eAAe,0CAAE,MAAM,MAAK,UAAU;oBAC7C,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,MAAA,QAAQ,CAAC,eAAe,0CAAE,MAAM,OAExC,CAAA;KAAA,CAAC,CAAC;IACJ,MAAM,wBAAwB,GAAG,IAAA,eAAQ,EACvC,IAAA,WAAI,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AI,EAAE,KAAK,OAAO,CAAC,GAAG,EAAE;qBACzB;iBACF,IACD,CAAA;SAAA,CAAC,CAAC;IACN,CAAC;IACD,+BAA+B;IAC/B,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,iCAC7C,WAAW,KACd,IAAI,EAAE,QAAQ,IACd,CAAC,CAAC;IACJ,mCAAmC;IACnC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAA,wBAAe,EAAC,IAAI,CAAC,CAAC;IACtB,IAAA,wBAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC;AAhFW,QAAA,kBAAkB,sBAgF7B"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`ts#mcp-server generator > should match snapshot > mcp-server-files 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"test-server/README.md": "# test-server
|
|
6
|
+
|
|
7
|
+
This package defines a Model Context Protocol (MCP) Server in TypeScript.
|
|
8
|
+
|
|
9
|
+
## What is MCP?
|
|
10
|
+
|
|
11
|
+
The Model Context Protocol (MCP) is a standardized protocol for providing context to Large Language Models (LLMs). It allows AI assistants to access external tools and resources through a consistent interface.
|
|
12
|
+
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
16
|
+
- [MCP TypeScript SDK Documentation](https://github.com/modelcontextprotocol/sdk-typescript)
|
|
17
|
+
|
|
18
|
+
## Developer Guide
|
|
19
|
+
|
|
20
|
+
### Getting Started
|
|
21
|
+
|
|
22
|
+
This MCP server is built using the MCP TypeScript SDK. Here's how to work with it:
|
|
23
|
+
|
|
24
|
+
1. **Server Structure**: The main server code is in \`src/server.ts\`. This file defines the server, its tools, and resources.
|
|
25
|
+
|
|
26
|
+
2. **Adding Tools**: Tools are functions that the LLM can call to perform actions. Add new tools using the \`server.tool()\` method:
|
|
27
|
+
|
|
28
|
+
\`\`\`typescript
|
|
29
|
+
server.tool(
|
|
30
|
+
'toolName',
|
|
31
|
+
{ param1: z.string(), param2: z.number() }, // Input schema using Zod
|
|
32
|
+
async ({ param1, param2 }) => {
|
|
33
|
+
// Tool implementation
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: 'text', text: 'Result' }],
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
3. **Adding Resources**: Resources provide context to the LLM. You can add static resources from files or dynamic resources:
|
|
42
|
+
|
|
43
|
+
\`\`\`typescript
|
|
44
|
+
// Static resource from a file
|
|
45
|
+
import resourceContent from './resources/my-resource.md';
|
|
46
|
+
|
|
47
|
+
server.resource('resource-name', 'example://resource', async (uri) => ({
|
|
48
|
+
contents: [{ uri: uri.href, text: resourceContent }],
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
// Dynamic resource
|
|
52
|
+
server.resource('dynamic-resource', 'dynamic://resource', async (uri) => {
|
|
53
|
+
const data = await fetchSomeData();
|
|
54
|
+
return {
|
|
55
|
+
contents: [{ uri: uri.href, text: data }],
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
### Building the Server
|
|
61
|
+
|
|
62
|
+
To build the server for use with AI assistants:
|
|
63
|
+
|
|
64
|
+
\`\`\`bash
|
|
65
|
+
nx run <project-name>:bundle
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
This creates a bundled version of your server in \`dist/<project-path>/bundle/index.js\`.
|
|
69
|
+
|
|
70
|
+
## Using with AI Assistants
|
|
71
|
+
|
|
72
|
+
To use your MCP server with AI assistants, you need to build it first to create the bundle:
|
|
73
|
+
|
|
74
|
+
\`\`\`bash
|
|
75
|
+
nx run <project-name>:bundle
|
|
76
|
+
\`\`\`
|
|
77
|
+
|
|
78
|
+
### Configuration
|
|
79
|
+
|
|
80
|
+
Most AI assistants (Amazon Q Developer CLI, Cline, Cursor, Claude Code, etc.) use a similar configuration approach. You'll need to create or update a configuration file with your MCP server details:
|
|
81
|
+
|
|
82
|
+
\`\`\`json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"test-server": {
|
|
86
|
+
"command": "node",
|
|
87
|
+
"args": ["/path/to/workspace/dist/test-server/bundle/index.js"],
|
|
88
|
+
"transportType": "stdio"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
Replace \`/path/to/workspace/dist/test-server/bundle/index.js\` with the actual path to your bundled MCP server.
|
|
95
|
+
|
|
96
|
+
Note that if you receive an error due to \`node\` missing (eg \`ENOENT node\`), you might need to specify the full path to \`node\` which you can obtain by running \`which node\`.
|
|
97
|
+
|
|
98
|
+
### Development Mode
|
|
99
|
+
|
|
100
|
+
During development, you can use the \`dev\` target to continuously rebuild the bundle whenever you make changes:
|
|
101
|
+
|
|
102
|
+
\`\`\`bash
|
|
103
|
+
nx run <project-name>:dev
|
|
104
|
+
\`\`\`
|
|
105
|
+
|
|
106
|
+
This will watch for changes in your project files and automatically rebuild the bundle.
|
|
107
|
+
|
|
108
|
+
Whenever you've made changes, you'll need to restart the MCP server in your AI assistant to test it out. The exact process depends on the assistant, but generally:
|
|
109
|
+
|
|
110
|
+
1. Find your MCP server in the assistant's settings or configuration
|
|
111
|
+
2. Look for a "Restart" or "Reload" option
|
|
112
|
+
",
|
|
113
|
+
"test-server/eslint.config.mjs": "import baseConfig from '../eslint.config.mjs';
|
|
114
|
+
|
|
115
|
+
export default [
|
|
116
|
+
...baseConfig,
|
|
117
|
+
{
|
|
118
|
+
files: ['**/*.json'],
|
|
119
|
+
rules: {
|
|
120
|
+
'@nx/dependency-checks': [
|
|
121
|
+
'error',
|
|
122
|
+
{
|
|
123
|
+
ignoredFiles: [
|
|
124
|
+
'{projectRoot}/eslint.config.{js,cjs,mjs}',
|
|
125
|
+
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
languageOptions: {
|
|
131
|
+
parser: await import('jsonc-eslint-parser'),
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
",
|
|
136
|
+
"test-server/project.json": "{
|
|
137
|
+
"name": "@proj/test-server",
|
|
138
|
+
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
|
139
|
+
"sourceRoot": "test-server/src",
|
|
140
|
+
"projectType": "library",
|
|
141
|
+
"tags": [],
|
|
142
|
+
"targets": {
|
|
143
|
+
"build": {
|
|
144
|
+
"dependsOn": ["lint", "compile", "test", "bundle"]
|
|
145
|
+
},
|
|
146
|
+
"compile": {
|
|
147
|
+
"executor": "nx:run-commands",
|
|
148
|
+
"outputs": ["{workspaceRoot}/dist/test-server/tsc"],
|
|
149
|
+
"options": {
|
|
150
|
+
"command": "tsc --build tsconfig.lib.json",
|
|
151
|
+
"cwd": "{projectRoot}"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"test": {
|
|
155
|
+
"executor": "@nx/vite:test",
|
|
156
|
+
"outputs": ["{options.reportsDirectory}"],
|
|
157
|
+
"options": {
|
|
158
|
+
"reportsDirectory": "../coverage/test-server"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"bundle": {
|
|
162
|
+
"executor": "nx:run-commands",
|
|
163
|
+
"options": {
|
|
164
|
+
"commands": [
|
|
165
|
+
"esbuild \\"test-server/src/index.ts\\" --bundle --platform=node --format=esm --loader:.md=text --outfile=dist/test-server/bundle/index.js"
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"dev": {
|
|
170
|
+
"executor": "nx:run-commands",
|
|
171
|
+
"options": {
|
|
172
|
+
"commands": [
|
|
173
|
+
"nx watch --projects=@proj/test-server --includeDependentProjects -- nx run @proj/test-server:bundle"
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
",
|
|
180
|
+
"test-server/src/global.d.ts": "declare module '*.md' {
|
|
181
|
+
const content: string;
|
|
182
|
+
export default content;
|
|
183
|
+
}
|
|
184
|
+
",
|
|
185
|
+
"test-server/src/index.ts": "import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
186
|
+
import { createServer } from './server.js';
|
|
187
|
+
|
|
188
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
189
|
+
const transport = new StdioServerTransport();
|
|
190
|
+
await createServer().connect(transport);
|
|
191
|
+
",
|
|
192
|
+
"test-server/src/resources/example-context.md": "## Example Context
|
|
193
|
+
|
|
194
|
+
This is some example context in a markdown file!
|
|
195
|
+
",
|
|
196
|
+
"test-server/src/server.ts": "import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
197
|
+
import { z } from 'zod';
|
|
198
|
+
import exampleContext from './resources/example-context.md';
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Create the MCP Server
|
|
202
|
+
*/
|
|
203
|
+
export const createServer = () => {
|
|
204
|
+
const server = new McpServer({
|
|
205
|
+
name: 'test-server',
|
|
206
|
+
version: '1.0.0',
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Add an addition tool
|
|
210
|
+
server.tool('add', { a: z.number(), b: z.number() }, async ({ a, b }) => ({
|
|
211
|
+
content: [{ type: 'text', text: String(a + b) }],
|
|
212
|
+
}));
|
|
213
|
+
|
|
214
|
+
// Add a resource which provides context from a markdown file
|
|
215
|
+
server.resource('example-context', 'example://context', async (uri) => ({
|
|
216
|
+
contents: [{ uri: uri.href, text: exampleContext }],
|
|
217
|
+
}));
|
|
218
|
+
|
|
219
|
+
return server;
|
|
220
|
+
};
|
|
221
|
+
",
|
|
222
|
+
"test-server/tsconfig.json": "{
|
|
223
|
+
"extends": "../tsconfig.base.json",
|
|
224
|
+
"files": [],
|
|
225
|
+
"include": [],
|
|
226
|
+
"references": [
|
|
227
|
+
{
|
|
228
|
+
"path": "./tsconfig.lib.json"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"path": "./tsconfig.spec.json"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"nx": {
|
|
235
|
+
"addTypecheckTarget": false
|
|
236
|
+
},
|
|
237
|
+
"compilerOptions": {}
|
|
238
|
+
}
|
|
239
|
+
",
|
|
240
|
+
"test-server/tsconfig.lib.json": "{
|
|
241
|
+
"extends": "../tsconfig.base.json",
|
|
242
|
+
"compilerOptions": {
|
|
243
|
+
"rootDir": ".",
|
|
244
|
+
"outDir": "../dist/test-server/tsc",
|
|
245
|
+
"tsBuildInfoFile": "../dist/test-server/tsc/tsconfig.lib.tsbuildinfo",
|
|
246
|
+
"emitDeclarationOnly": false,
|
|
247
|
+
"module": "nodenext",
|
|
248
|
+
"moduleResolution": "nodenext",
|
|
249
|
+
"types": ["node"]
|
|
250
|
+
},
|
|
251
|
+
"include": ["src/**/*.ts"],
|
|
252
|
+
"references": [],
|
|
253
|
+
"exclude": [
|
|
254
|
+
"vite.config.ts",
|
|
255
|
+
"vite.config.mts",
|
|
256
|
+
"vitest.config.ts",
|
|
257
|
+
"vitest.config.mts",
|
|
258
|
+
"src/**/*.test.ts",
|
|
259
|
+
"src/**/*.spec.ts",
|
|
260
|
+
"src/**/*.test.tsx",
|
|
261
|
+
"src/**/*.spec.tsx",
|
|
262
|
+
"src/**/*.test.js",
|
|
263
|
+
"src/**/*.spec.js",
|
|
264
|
+
"src/**/*.test.jsx",
|
|
265
|
+
"src/**/*.spec.jsx"
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
",
|
|
269
|
+
"test-server/tsconfig.spec.json": "{
|
|
270
|
+
"extends": "../tsconfig.base.json",
|
|
271
|
+
"compilerOptions": {
|
|
272
|
+
"outDir": "./out-tsc/vitest",
|
|
273
|
+
"types": [
|
|
274
|
+
"vitest/globals",
|
|
275
|
+
"vitest/importMeta",
|
|
276
|
+
"vite/client",
|
|
277
|
+
"node",
|
|
278
|
+
"vitest"
|
|
279
|
+
],
|
|
280
|
+
"module": "nodenext",
|
|
281
|
+
"moduleResolution": "nodenext"
|
|
282
|
+
},
|
|
283
|
+
"include": [
|
|
284
|
+
"vite.config.ts",
|
|
285
|
+
"vite.config.mts",
|
|
286
|
+
"vitest.config.ts",
|
|
287
|
+
"vitest.config.mts",
|
|
288
|
+
"src/**/*.test.ts",
|
|
289
|
+
"src/**/*.spec.ts",
|
|
290
|
+
"src/**/*.test.tsx",
|
|
291
|
+
"src/**/*.spec.tsx",
|
|
292
|
+
"src/**/*.test.js",
|
|
293
|
+
"src/**/*.spec.js",
|
|
294
|
+
"src/**/*.test.jsx",
|
|
295
|
+
"src/**/*.spec.jsx",
|
|
296
|
+
"src/**/*.d.ts"
|
|
297
|
+
],
|
|
298
|
+
"references": [
|
|
299
|
+
{
|
|
300
|
+
"path": "./tsconfig.lib.json"
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
",
|
|
305
|
+
"test-server/vite.config.ts": "import { defineConfig } from 'vite';
|
|
306
|
+
|
|
307
|
+
export default defineConfig(() => ({
|
|
308
|
+
root: __dirname,
|
|
309
|
+
cacheDir: '../node_modules/.vite/test-server',
|
|
310
|
+
plugins: [],
|
|
311
|
+
// Uncomment this if you are using workers.
|
|
312
|
+
// worker: {
|
|
313
|
+
// plugins: [ nxViteTsPaths() ],
|
|
314
|
+
// },
|
|
315
|
+
test: {
|
|
316
|
+
watch: false,
|
|
317
|
+
globals: true,
|
|
318
|
+
environment: 'jsdom',
|
|
319
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
320
|
+
reporters: ['default'],
|
|
321
|
+
coverage: {
|
|
322
|
+
reportsDirectory: './test-output/vitest/coverage',
|
|
323
|
+
provider: 'v8' as const,
|
|
324
|
+
},
|
|
325
|
+
passWithNoTests: true,
|
|
326
|
+
},
|
|
327
|
+
}));
|
|
328
|
+
",
|
|
329
|
+
}
|
|
330
|
+
`;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# <%- name %>
|
|
2
|
+
|
|
3
|
+
This package defines a Model Context Protocol (MCP) Server in TypeScript.
|
|
4
|
+
|
|
5
|
+
## What is MCP?
|
|
6
|
+
|
|
7
|
+
The Model Context Protocol (MCP) is a standardized protocol for providing context to Large Language Models (LLMs). It allows AI assistants to access external tools and resources through a consistent interface.
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
12
|
+
- [MCP TypeScript SDK Documentation](https://github.com/modelcontextprotocol/sdk-typescript)
|
|
13
|
+
|
|
14
|
+
## Developer Guide
|
|
15
|
+
|
|
16
|
+
### Getting Started
|
|
17
|
+
|
|
18
|
+
This MCP server is built using the MCP TypeScript SDK. Here's how to work with it:
|
|
19
|
+
|
|
20
|
+
1. **Server Structure**: The main server code is in `src/server.ts`. This file defines the server, its tools, and resources.
|
|
21
|
+
|
|
22
|
+
2. **Adding Tools**: Tools are functions that the LLM can call to perform actions. Add new tools using the `server.tool()` method:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
server.tool("toolName",
|
|
26
|
+
{ param1: z.string(), param2: z.number() }, // Input schema using Zod
|
|
27
|
+
async ({ param1, param2 }) => {
|
|
28
|
+
// Tool implementation
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: "Result" }]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. **Adding Resources**: Resources provide context to the LLM. You can add static resources from files or dynamic resources:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Static resource from a file
|
|
40
|
+
import resourceContent from './resources/my-resource.md';
|
|
41
|
+
|
|
42
|
+
server.resource('resource-name', 'example://resource', async (uri) => ({
|
|
43
|
+
contents: [{ uri: uri.href, text: resourceContent }],
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
// Dynamic resource
|
|
47
|
+
server.resource('dynamic-resource', 'dynamic://resource', async (uri) => {
|
|
48
|
+
const data = await fetchSomeData();
|
|
49
|
+
return {
|
|
50
|
+
contents: [{ uri: uri.href, text: data }],
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Building the Server
|
|
56
|
+
|
|
57
|
+
To build the server for use with AI assistants:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
nx run <project-name>:bundle
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This creates a bundled version of your server in `dist/<project-path>/bundle/index.js`.
|
|
64
|
+
|
|
65
|
+
## Using with AI Assistants
|
|
66
|
+
|
|
67
|
+
To use your MCP server with AI assistants, you need to build it first to create the bundle:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
nx run <project-name>:bundle
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Configuration
|
|
74
|
+
|
|
75
|
+
Most AI assistants (Amazon Q Developer CLI, Cline, Cursor, Claude Code, etc.) use a similar configuration approach. You'll need to create or update a configuration file with your MCP server details:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"<%- name %>": {
|
|
81
|
+
"command": "node",
|
|
82
|
+
"args": [
|
|
83
|
+
"/path/to/workspace/dist/<%- dir %>/bundle/index.js"
|
|
84
|
+
],
|
|
85
|
+
"transportType": "stdio"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Replace `/path/to/workspace/dist/<%- dir %>/bundle/index.js` with the actual path to your bundled MCP server.
|
|
92
|
+
|
|
93
|
+
Note that if you receive an error due to `node` missing (eg `ENOENT node`), you might need to specify the full path to `node` which you can obtain by running `which node`.
|
|
94
|
+
|
|
95
|
+
### Development Mode
|
|
96
|
+
|
|
97
|
+
During development, you can use the `dev` target to continuously rebuild the bundle whenever you make changes:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
nx run <project-name>:dev
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This will watch for changes in your project files and automatically rebuild the bundle.
|
|
104
|
+
|
|
105
|
+
Whenever you've made changes, you'll need to restart the MCP server in your AI assistant to test it out. The exact process depends on the assistant, but generally:
|
|
106
|
+
|
|
107
|
+
1. Find your MCP server in the assistant's settings or configuration
|
|
108
|
+
2. Look for a "Restart" or "Reload" option
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
2
|
+
import { createServer } from './server.js';
|
|
3
|
+
|
|
4
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
5
|
+
const transport = new StdioServerTransport();
|
|
6
|
+
await createServer().connect(transport);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import exampleContext from './resources/example-context.md';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create the MCP Server
|
|
7
|
+
*/
|
|
8
|
+
export const createServer = () => {
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: "<%- name %>",
|
|
11
|
+
version: "1.0.0"
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Add an addition tool
|
|
15
|
+
server.tool("add",
|
|
16
|
+
{ a: z.number(), b: z.number() },
|
|
17
|
+
async ({ a, b }) => ({
|
|
18
|
+
content: [{ type: "text", text: String(a + b) }]
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Add a resource which provides context from a markdown file
|
|
23
|
+
server.resource('example-context', 'example://context', async (uri) => ({
|
|
24
|
+
contents: [{ uri: uri.href, text: exampleContext }],
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
return server;
|
|
28
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
6
|
+
import { TsMcpServerGeneratorSchema } from './schema';
|
|
7
|
+
import { NxGeneratorInfo } from '../../utils/nx';
|
|
8
|
+
export declare const TS_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo;
|
|
9
|
+
export declare const tsMcpServerGenerator: (tree: Tree, options: TsMcpServerGeneratorSchema) => Promise<GeneratorCallback>;
|
|
10
|
+
export default tsMcpServerGenerator;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tsMcpServerGenerator = exports.TS_MCP_SERVER_GENERATOR_INFO = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
|
10
|
+
const nx_1 = require("../../utils/nx");
|
|
11
|
+
const metrics_1 = require("../../utils/metrics");
|
|
12
|
+
const format_1 = require("../../utils/format");
|
|
13
|
+
const generator_1 = tslib_1.__importStar(require("../lib/generator"));
|
|
14
|
+
const versions_1 = require("../../utils/versions");
|
|
15
|
+
exports.TS_MCP_SERVER_GENERATOR_INFO = (0, nx_1.getGeneratorInfo)(__filename);
|
|
16
|
+
const tsMcpServerGenerator = (tree, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
// Generate a TypeScript library
|
|
19
|
+
yield (0, generator_1.default)(tree, options);
|
|
20
|
+
const { fullyQualifiedName } = (0, generator_1.getTsLibDetails)(tree, options);
|
|
21
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, fullyQualifiedName);
|
|
22
|
+
// Add dependencies
|
|
23
|
+
const deps = (0, versions_1.withVersions)(['@modelcontextprotocol/sdk', 'zod']);
|
|
24
|
+
const devDeps = (0, versions_1.withVersions)(['tsx', 'esbuild']);
|
|
25
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, deps, devDeps);
|
|
26
|
+
// Generate example server
|
|
27
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), project.root, {
|
|
28
|
+
name: options.name,
|
|
29
|
+
dir: project.root,
|
|
30
|
+
}, { overwriteStrategy: devkit_1.OverwriteStrategy.Overwrite });
|
|
31
|
+
// Add build targets
|
|
32
|
+
(0, devkit_1.updateProjectConfiguration)(tree, fullyQualifiedName, Object.assign(Object.assign({}, project), { targets: Object.assign(Object.assign({}, project === null || project === void 0 ? void 0 : project.targets), {
|
|
33
|
+
// Bundle with esbuild
|
|
34
|
+
bundle: {
|
|
35
|
+
executor: 'nx:run-commands',
|
|
36
|
+
options: {
|
|
37
|
+
commands: [
|
|
38
|
+
`esbuild "${(0, devkit_1.joinPathFragments)(project.sourceRoot, 'index.ts')}" --bundle --platform=node --format=esm --loader:.md=text --outfile=${(0, devkit_1.joinPathFragments)('dist', project.root, 'bundle', 'index.js')}`,
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
// Dev task for bundling whenever changes are made
|
|
43
|
+
dev: {
|
|
44
|
+
executor: 'nx:run-commands',
|
|
45
|
+
options: {
|
|
46
|
+
commands: [
|
|
47
|
+
`nx watch --projects=${fullyQualifiedName} --includeDependentProjects -- nx run ${fullyQualifiedName}:bundle`,
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
// Ensure bundle runs as part of build
|
|
52
|
+
build: Object.assign(Object.assign({}, (_a = project === null || project === void 0 ? void 0 : project.targets) === null || _a === void 0 ? void 0 : _a.build), { dependsOn: [...((_d = (_c = (_b = project === null || project === void 0 ? void 0 : project.targets) === null || _b === void 0 ? void 0 : _b.build) === null || _c === void 0 ? void 0 : _c.dependsOn) !== null && _d !== void 0 ? _d : []), 'bundle'] }) }) }));
|
|
53
|
+
yield (0, metrics_1.addGeneratorMetricsIfApplicable)(tree, [exports.TS_MCP_SERVER_GENERATOR_INFO]);
|
|
54
|
+
yield (0, format_1.formatFilesInSubtree)(tree);
|
|
55
|
+
return () => {
|
|
56
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
exports.tsMcpServerGenerator = tsMcpServerGenerator;
|
|
60
|
+
exports.default = exports.tsMcpServerGenerator;
|
|
61
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/ts/mcp-server/generator.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,uCAUoB;AAEpB,uCAAmE;AACnE,iDAAsE;AACtE,+CAA0D;AAC1D,sEAAmE;AACnE,mDAAoD;AAEvC,QAAA,4BAA4B,GACvC,IAAA,qBAAgB,EAAC,UAAU,CAAC,CAAC;AAExB,MAAM,oBAAoB,GAAG,CAClC,IAAU,EACV,OAAmC,EACP,EAAE;;IAC9B,gCAAgC;IAChC,MAAM,IAAA,mBAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEp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yC,kBAAkB,SAAS;qBAC9G;iBACF;aACF;YACD,sCAAsC;YACtC,KAAK,kCACA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,KAC1B,SAAS,EAAE,CAAC,GAAG,CAAC,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,KAAK,0CAAE,SAAS,mCAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,UAGxE,CAAC;IAEH,MAAM,IAAA,yCAA+B,EAAC,IAAI,EAAE,CAAC,oCAA4B,CAAC,CAAC,CAAC;IAE5E,MAAM,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,EAAE;QACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC,CAAA,CAAC;AAhEW,QAAA,oBAAoB,wBAgE/B;AAEF,kBAAe,4BAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { TsLibGeneratorSchema } from '../lib/schema';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* TypeScript types for options defined in schema.json
|
|
9
|
+
* Update this to match schema.json if you make changes.
|
|
10
|
+
*/
|
|
11
|
+
export type TsMcpServerGeneratorSchema = TsLibGeneratorSchema;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ts#mcp-server",
|
|
4
|
+
"title": "ts#mcp-server",
|
|
5
|
+
"description": "Generate a TypeScript Model Context Protocol (MCP) server for providing context to Large Language Models",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "MCP server project name.",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"directory": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Parent directory where the MCP server is placed.",
|
|
16
|
+
"default": "packages",
|
|
17
|
+
"x-prompt": "Which directory do you want to create the MCP server in?",
|
|
18
|
+
"x-priority": "important"
|
|
19
|
+
},
|
|
20
|
+
"subDirectory": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The sub directory the MCP server is placed in. By default this is the MCP server project name.",
|
|
23
|
+
"x-prompt": "Which sub directory do you want to create the MCP server in? (By default this is the MCP server project name)"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["name"]
|
|
27
|
+
}
|