@ferscloud/fers-mcp 0.0.0-stage → 2.1.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/LICENSE +65 -0
- package/README.md +92 -3
- package/dist/fers-mcp.cjs +86806 -0
- package/dist/solver-worker.cjs +46 -0
- package/package.json +35 -6
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Worker-thread host for the synchronous WASM solver.
|
|
2
|
+
//
|
|
3
|
+
// The engine's exports block for the entire duration of a solve — they are
|
|
4
|
+
// synchronous by design (see src/lib/solver.ts). On the main thread that
|
|
5
|
+
// freezes every other request in the process, /api/health included, because
|
|
6
|
+
// production runs a single Node process behind PM2. Here it blocks only this
|
|
7
|
+
// thread, so the site stays responsive while a large model is solving.
|
|
8
|
+
//
|
|
9
|
+
// Deliberately thin. It calls the named export and hands back the raw string;
|
|
10
|
+
// the `include_report_html` rewrite and the response-envelope unwrapping stay
|
|
11
|
+
// in src/lib/wasmSolver.ts so there is exactly one implementation of each and
|
|
12
|
+
// no chance of the two drifting apart.
|
|
13
|
+
//
|
|
14
|
+
// Plain CommonJS on purpose: it is loaded by path at runtime, not bundled by
|
|
15
|
+
// Next, so it must run as-is from the release directory.
|
|
16
|
+
const { parentPort } = require("node:worker_threads");
|
|
17
|
+
|
|
18
|
+
// Self-initialises the WASM binary at require() time — this is the expensive
|
|
19
|
+
// part, which is why the pool reuses workers rather than spawning per solve.
|
|
20
|
+
const wasm = require("@ferscloud/fers-calculation");
|
|
21
|
+
|
|
22
|
+
parentPort.on("message", (msg) => {
|
|
23
|
+
const { id, fn, args } = msg;
|
|
24
|
+
try {
|
|
25
|
+
if (typeof wasm[fn] !== "function") {
|
|
26
|
+
parentPort.postMessage({
|
|
27
|
+
id,
|
|
28
|
+
ok: false,
|
|
29
|
+
code: "unsupported",
|
|
30
|
+
message: `This solver build does not export ${fn}().`,
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
parentPort.postMessage({ id, ok: true, raw: wasm[fn](...args) });
|
|
35
|
+
} catch (err) {
|
|
36
|
+
parentPort.postMessage({
|
|
37
|
+
id,
|
|
38
|
+
ok: false,
|
|
39
|
+
code: "solver_threw",
|
|
40
|
+
message: err && err.message ? err.message : String(err),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Tells the pool the WASM binary finished initialising.
|
|
46
|
+
parentPort.postMessage({ ready: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ferscloud/fers-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ferscloud/fers-mcp",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "FERS structural finite-element tools for MCP clients (Claude Desktop, Claude Code, Cursor, VS Code, Codex, ChatGPT desktop), solving on your own machine.",
|
|
5
|
+
"mcpName": "com.ferscloud/fers",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"homepage": "https://ferscloud.com/mcp#local",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Jeroen124/FERS_core"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"model-context-protocol",
|
|
15
|
+
"structural-engineering",
|
|
16
|
+
"finite-element",
|
|
17
|
+
"eurocode",
|
|
18
|
+
"fem"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"fers-mcp": "dist/fers-mcp.cjs"
|
|
22
|
+
},
|
|
23
|
+
"main": "dist/fers-mcp.cjs",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@ferscloud/fers-calculation": "0.2.73"
|
|
34
|
+
}
|
|
35
|
+
}
|