create-mctx-server 0.4.0 → 0.5.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/index.js +16 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -27,17 +27,19 @@ mkdirSync(projectName, { recursive: true });
|
|
|
27
27
|
const packageJson = {
|
|
28
28
|
name: projectName,
|
|
29
29
|
version: "0.0.1",
|
|
30
|
+
description: "An MCP server built with @mctx-ai/mcp-server",
|
|
30
31
|
type: "module",
|
|
32
|
+
main: "dist/index.js",
|
|
31
33
|
scripts: {
|
|
32
34
|
dev: "npx mctx-dev index.js",
|
|
33
|
-
build:
|
|
34
|
-
"node --experimental-sea-config sea-config.json || echo 'Build step placeholder'",
|
|
35
|
+
build: "esbuild index.js --bundle --platform=node --format=esm --outfile=dist/index.js",
|
|
35
36
|
},
|
|
36
37
|
dependencies: {
|
|
37
38
|
"@mctx-ai/mcp-server": `^${version}`,
|
|
38
39
|
},
|
|
39
40
|
devDependencies: {
|
|
40
41
|
"@mctx-ai/mcp-dev": `^${version}`,
|
|
42
|
+
esbuild: "^0.20.0",
|
|
41
43
|
},
|
|
42
44
|
};
|
|
43
45
|
|
|
@@ -49,7 +51,9 @@ writeFileSync(
|
|
|
49
51
|
// Generate index.js
|
|
50
52
|
const indexJs = `import { createServer, T } from '@mctx-ai/mcp-server';
|
|
51
53
|
|
|
52
|
-
const app = createServer(
|
|
54
|
+
const app = createServer({
|
|
55
|
+
instructions: 'This server provides a simple greeting tool. Use the greet tool to say hello to someone by name.',
|
|
56
|
+
});
|
|
53
57
|
|
|
54
58
|
// A simple greeting tool
|
|
55
59
|
function greet({ name }) {
|
|
@@ -68,17 +72,6 @@ export default app;
|
|
|
68
72
|
|
|
69
73
|
writeFileSync(join(projectName, "index.js"), indexJs);
|
|
70
74
|
|
|
71
|
-
// Generate mctx.json
|
|
72
|
-
const mctxJson = {
|
|
73
|
-
name: projectName,
|
|
74
|
-
entrypoint: "index.js",
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
writeFileSync(
|
|
78
|
-
join(projectName, "mctx.json"),
|
|
79
|
-
JSON.stringify(mctxJson, null, 2) + "\n",
|
|
80
|
-
);
|
|
81
|
-
|
|
82
75
|
// Generate .gitignore
|
|
83
76
|
const gitignore = `node_modules/
|
|
84
77
|
dist/
|
|
@@ -111,11 +104,19 @@ myTool.input = {
|
|
|
111
104
|
app.tool('my-tool', myTool);
|
|
112
105
|
\`\`\`
|
|
113
106
|
|
|
107
|
+
## Build
|
|
108
|
+
|
|
109
|
+
\`\`\`bash
|
|
110
|
+
npm run build
|
|
111
|
+
\`\`\`
|
|
112
|
+
|
|
113
|
+
This bundles your server into a single \`dist/index.js\` file ready for deployment.
|
|
114
|
+
|
|
114
115
|
## Deploy
|
|
115
116
|
|
|
116
117
|
1. Push to GitHub
|
|
117
118
|
2. Connect your repo at [mctx.ai](https://mctx.ai)
|
|
118
|
-
3. Deploy — mctx reads \`
|
|
119
|
+
3. Deploy — mctx reads \`package.json\` and runs your server
|
|
119
120
|
|
|
120
121
|
## Learn More
|
|
121
122
|
|