create-start-app 0.4.2 → 0.4.3
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/dist/cli.js +3 -2
- package/dist/mcp.js +24 -3
- package/package.json +3 -1
- package/src/cli.ts +3 -2
- package/src/mcp.ts +27 -3
- package/src/types.ts +1 -0
- package/templates/react/add-on/start/info.json +1 -2
package/dist/cli.js
CHANGED
|
@@ -43,12 +43,13 @@ export function cli() {
|
|
|
43
43
|
})
|
|
44
44
|
.option('--list-add-ons', 'list all available add-ons', false)
|
|
45
45
|
.option('--mcp', 'run the MCP server', false)
|
|
46
|
+
.option('--mcp-sse', 'run the MCP server in SSE mode', false)
|
|
46
47
|
.action(async (projectName, options) => {
|
|
47
48
|
if (options.listAddOns) {
|
|
48
49
|
await listAddOns(options);
|
|
49
50
|
}
|
|
50
|
-
else if (options.mcp) {
|
|
51
|
-
await runServer();
|
|
51
|
+
else if (options.mcp || options.mcpSse) {
|
|
52
|
+
await runServer(!!options.mcpSse);
|
|
52
53
|
}
|
|
53
54
|
else {
|
|
54
55
|
try {
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
2
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import express from 'express';
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
import { createApp } from './create-app.js';
|
|
5
7
|
import { finalizeAddOns } from './add-ons.js';
|
|
@@ -163,7 +165,26 @@ server.tool('createTanStackSolidApplication', {
|
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
});
|
|
166
|
-
export default async function runServer() {
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
export default async function runServer(sse) {
|
|
169
|
+
if (sse) {
|
|
170
|
+
const app = express();
|
|
171
|
+
let transport = null;
|
|
172
|
+
app.get('/sse', (req, res) => {
|
|
173
|
+
transport = new SSEServerTransport('/messages', res);
|
|
174
|
+
server.connect(transport);
|
|
175
|
+
});
|
|
176
|
+
app.post('/messages', (req, res) => {
|
|
177
|
+
if (transport) {
|
|
178
|
+
transport.handlePostMessage(req, res);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const port = process.env.PORT || 8080;
|
|
182
|
+
app.listen(port, () => {
|
|
183
|
+
console.log(`Server is running on port http://localhost:${port}`);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
const transport = new StdioServerTransport();
|
|
188
|
+
await server.connect(transport);
|
|
189
|
+
}
|
|
169
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-start-app",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Tanstack Application Builder",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,12 +37,14 @@
|
|
|
37
37
|
"commander": "^13.1.0",
|
|
38
38
|
"ejs": "^3.1.10",
|
|
39
39
|
"execa": "^9.5.2",
|
|
40
|
+
"express": "^4.21.2",
|
|
40
41
|
"prettier": "^3.5.0",
|
|
41
42
|
"zod": "^3.24.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@tanstack/config": "^0.16.2",
|
|
45
46
|
"@types/ejs": "^3.1.5",
|
|
47
|
+
"@types/express": "^5.0.0",
|
|
46
48
|
"@types/node": "^22.13.4",
|
|
47
49
|
"eslint": "^9.20.0",
|
|
48
50
|
"eslint-plugin-react-hooks": "^5.1.0",
|
package/src/cli.ts
CHANGED
|
@@ -79,11 +79,12 @@ export function cli() {
|
|
|
79
79
|
)
|
|
80
80
|
.option('--list-add-ons', 'list all available add-ons', false)
|
|
81
81
|
.option('--mcp', 'run the MCP server', false)
|
|
82
|
+
.option('--mcp-sse', 'run the MCP server in SSE mode', false)
|
|
82
83
|
.action(async (projectName: string, options: CliOptions) => {
|
|
83
84
|
if (options.listAddOns) {
|
|
84
85
|
await listAddOns(options)
|
|
85
|
-
} else if (options.mcp) {
|
|
86
|
-
await runServer()
|
|
86
|
+
} else if (options.mcp || options.mcpSse) {
|
|
87
|
+
await runServer(!!options.mcpSse)
|
|
87
88
|
} else {
|
|
88
89
|
try {
|
|
89
90
|
const cliOptions = {
|
package/src/mcp.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'
|
|
2
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
4
|
+
import express from 'express'
|
|
3
5
|
import { z } from 'zod'
|
|
4
6
|
|
|
5
7
|
import { createApp } from './create-app.js'
|
|
@@ -199,7 +201,29 @@ server.tool(
|
|
|
199
201
|
},
|
|
200
202
|
)
|
|
201
203
|
|
|
202
|
-
export default async function runServer() {
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
export default async function runServer(sse: boolean) {
|
|
205
|
+
if (sse) {
|
|
206
|
+
const app = express()
|
|
207
|
+
|
|
208
|
+
let transport: SSEServerTransport | null = null
|
|
209
|
+
|
|
210
|
+
app.get('/sse', (req, res) => {
|
|
211
|
+
transport = new SSEServerTransport('/messages', res)
|
|
212
|
+
server.connect(transport)
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
app.post('/messages', (req, res) => {
|
|
216
|
+
if (transport) {
|
|
217
|
+
transport.handlePostMessage(req, res)
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
const port = process.env.PORT || 8080
|
|
222
|
+
app.listen(port, () => {
|
|
223
|
+
console.log(`Server is running on port http://localhost:${port}`)
|
|
224
|
+
})
|
|
225
|
+
} else {
|
|
226
|
+
const transport = new StdioServerTransport()
|
|
227
|
+
await server.connect(transport)
|
|
228
|
+
}
|
|
205
229
|
}
|
package/src/types.ts
CHANGED