Getting started
This page runs the engine from Node, builds a first model and shows how an agent authors models through the MCP server. Prerequisites: Node 22 and pnpm. Rust is needed only to rebuild the kernel; the compiled wasm is committed.
Install
git clone https://github.com/huukhanhnguyen/parashape.git
cd parashape
pnpm install
pnpm --filter @parashape/model exec tsc -p tsconfig.build.jsonThe last command builds the TypeScript client in packages/model/dist. Re-run it when packages/model/src changes.
Run the engine from Node
EngineClient.inProcess loads the wasm in the current process. load takes a model document and returns a Changes value: the node states, diagnostics and render data of the first evaluation.
import { readFileSync } from "node:fs"
import { EngineClient } from "@parashape/model"
const client = await EngineClient.inProcess({
wasmBytes: new Uint8Array(readFileSync("packages/model/wasm/model_bg.wasm"))
})
const changes = await client.load(document) // document: a ModelJson object
console.log(changes.diagnostics) // findings of the first evaluation
const takeoff = await client.takeoff() // lengths, areas, volumes, bounds per objectIn the browser, EngineClient.create() runs the same wasm in a worker. The full door list is on the Engine API page.
A first model
A plate 100 x 60 mm with a 10 x 10 x 50 mm post on top, driven by one parameter, plateThickness. Each object is one chain: a rectangle, then an extrusion. The post is placed by the translateX/Y/Z instance properties, and translateZ reads the parameter so the post follows the plate.
{
"title": "Plate with post",
"parameters": [
{ "key": "plateThickness", "method": "length", "args": [{ "key": "value", "input": "20" }] }
],
"objects": [
{ "key": "plate", "method": "createObject", "steps": [
{ "method": "rectangle", "args": [{ "key": "point1", "input": "[0,0,0]" }, { "key": "point2", "input": "[100,60,0]" }] },
{ "method": "curveExtrude", "args": [{ "key": "thickness", "input": "plateThickness" }] }
] },
{ "key": "post", "method": "createObject",
"steps": [
{ "method": "rectangle", "args": [{ "key": "point1", "input": "[0,0,0]" }, { "key": "point2", "input": "[10,10,0]" }] },
{ "method": "curveExtrude", "args": [{ "key": "thickness", "input": "50" }] }
],
"properties": [
{ "method": "translateX", "args": [{ "key": "value", "input": "45" }] },
{ "method": "translateY", "args": [{ "key": "value", "input": "25" }] },
{ "method": "translateZ", "args": [{ "key": "value", "input": "plateThickness" }] }
] }
]
}Measured by takeoff at the defaults: plate volume 120000 mm3 (100 x 60 x 20) and post volume 5000 mm3 (10 x 10 x 50). After setArg sets plateThickness to 30, the plate is 180000 mm3 and the post is unchanged. Arguments are matched by key, never by position; the method and argument names come from the catalog.
Connect an agent: the MCP server
packages/mcp is a stdio MCP server. An agent loads a model document into one in-process engine, edits it, measures it and renders it. It is the authoring path for agents: it runs the real engine, so a result is what the product will show.
Register it with an MCP host from the repository root. The launcher builds the client and the server from the current source, then starts the server.
{
"mcpServers": {
"parashape": { "command": "node", "args": ["packages/mcp/scripts/start.mjs"] }
}
}| Tool | Purpose |
|---|---|
catalog | The engine catalog, optionally filtered by name. |
search_models | Search the public library for a published model to place instead of drawing a part. |
check | Load a document (inline or by file path), return the engine's diagnostics and the blocking audit findings. |
set_arg | Change one argument of the loaded document and re-evaluate. |
takeoff | Measure the loaded document: length, area, volume and world bounds per object. |
verify | Compare measured quantities with expected values derived from a closed form, with a tolerance. |
export_glb | Write the visible mesh scene to a GLB file. |
render | Render PNG views of the loaded document through a render service (needs THUMBNAIL_RENDER_URL and THUMBNAIL_RENDER_SECRET). |
review | Render the six faces and two sections of a scratch copy in one call. |
motion | Click through every click action of the document and render the poses. |
The authoring loop
- Search the library for a published model to place before drawing a part.
checkthe document until the engine reports no error. A cleancheckproves the document is well formed and passes the audit, not that the geometry is right.- State each requirement with
verify: the expected value comes from a closed form (a box isx*y*z), never from the engine's own output. - Change a parameter with
set_arg, measure again and compare the change with the formula's derivative. A quantity that does not move means the parameter is not wired to the geometry. renderand look at the images.
The agent's manual is packages/mcp/skill/SKILL.md and the measurement method is packages/mcp/docs/verify.md.