openscad-mcp-server 1.0.5 → 1.0.6
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 +9 -1
- package/dist/index.mjs +34 -5
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -59,6 +59,14 @@ The published package is intended to run over stdio. Configure it in your MCP cl
|
|
|
59
59
|
}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
To run it over HTTP instead (e.g. in Docker), pass `--http`:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
MCP_PORT=3000 npx -y openscad-mcp-server --http
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The server exposes `GET /health` and a stateless streamable HTTP MCP endpoint at `POST /mcp`.
|
|
69
|
+
|
|
62
70
|
### Using the Skill
|
|
63
71
|
|
|
64
72
|
[Agents skills](https://github.com/agentskills/agentskills) are a simple, open format for giving agents new capabilities and expertise.
|
|
@@ -73,7 +81,7 @@ npx skills add fboldo/openscad-mcp-server --skill openscad-iterative-modeling
|
|
|
73
81
|
|
|
74
82
|
- Install deps: `bun install`
|
|
75
83
|
- Stdio (matches how clients run it): `bun index.ts --stdio`
|
|
76
|
-
- HTTP (useful for manual testing): `bun index.ts`
|
|
84
|
+
- HTTP (useful for manual testing): `bun index.ts` (or `--http`)
|
|
77
85
|
- Port: `MCP_PORT` (default `3000`)
|
|
78
86
|
- Endpoints: `GET /health`, MCP at `POST /mcp`
|
|
79
87
|
- MCP Inspector: `bun run dev`
|
package/dist/index.mjs
CHANGED
|
@@ -273,8 +273,13 @@ function createServer() {
|
|
|
273
273
|
|
|
274
274
|
//#endregion
|
|
275
275
|
//#region src/entrypoints/http.ts
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Creates the Hono app serving the MCP endpoint in stateless mode.
|
|
278
|
+
*
|
|
279
|
+
* Stateless transports cannot be reused across requests, so a fresh server and
|
|
280
|
+
* transport pair is created for every `/mcp` request and closed once it has responded.
|
|
281
|
+
*/
|
|
282
|
+
const createHttpApp = (createServer) => {
|
|
278
283
|
const app = new Hono();
|
|
279
284
|
app.use("*", cors({
|
|
280
285
|
origin: "*",
|
|
@@ -293,9 +298,24 @@ const createHttpServer = async (createServer) => {
|
|
|
293
298
|
exposeHeaders: ["mcp-session-id", "mcp-protocol-version"]
|
|
294
299
|
}));
|
|
295
300
|
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
296
|
-
app.all("/mcp", (c) =>
|
|
301
|
+
app.all("/mcp", async (c) => {
|
|
302
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
303
|
+
sessionIdGenerator: void 0,
|
|
304
|
+
enableJsonResponse: true
|
|
305
|
+
});
|
|
306
|
+
const server = createServer();
|
|
307
|
+
try {
|
|
308
|
+
await server.connect(transport);
|
|
309
|
+
return await transport.handleRequest(c.req.raw);
|
|
310
|
+
} finally {
|
|
311
|
+
await server.close();
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return app;
|
|
315
|
+
};
|
|
316
|
+
const createHttpServer = async (createServer) => {
|
|
317
|
+
const app = createHttpApp(createServer);
|
|
297
318
|
const PORT = process.env.MCP_PORT ? Number.parseInt(process.env.MCP_PORT, 10) : 3e3;
|
|
298
|
-
await createServer().connect(transport);
|
|
299
319
|
console.log(`Starting Hono MCP server on port ${PORT}`);
|
|
300
320
|
console.log(`Health check: http://localhost:${PORT}/health`);
|
|
301
321
|
console.log(`MCP endpoint: http://localhost:${PORT}/mcp`);
|
|
@@ -330,7 +350,16 @@ const bootstrap = (method, createServer) => {
|
|
|
330
350
|
|
|
331
351
|
//#endregion
|
|
332
352
|
//#region index.ts
|
|
333
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Explicit `--http` / `--stdio` flags win. Without a flag, the published build
|
|
355
|
+
* (NODE_ENV=production) defaults to stdio and local development defaults to HTTP.
|
|
356
|
+
*/
|
|
357
|
+
const resolveBootstrapMethod = (argv) => {
|
|
358
|
+
if (argv.includes("--http")) return "http";
|
|
359
|
+
if (argv.includes("--stdio")) return "stdio";
|
|
360
|
+
return "stdio";
|
|
361
|
+
};
|
|
362
|
+
await bootstrap(resolveBootstrapMethod(process.argv), createServer);
|
|
334
363
|
|
|
335
364
|
//#endregion
|
|
336
365
|
export { };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"module": "./dist/index.mjs",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.6",
|
|
7
7
|
"mcpName": "io.github.fboldo/openscad-mcp-server",
|
|
8
8
|
"description": "An MCP server that renders PNG previews and STL geometry from OpenSCAD (SCAD) source code.",
|
|
9
9
|
"repository": {
|
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"url": "https://github.com/fboldo/openscad-mcp-server",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "1.0.
|
|
11
|
+
"version": "1.0.6",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "openscad-mcp-server",
|
|
17
|
-
"version": "1.0.
|
|
17
|
+
"version": "1.0.6",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
}
|