← Files LuciaARCHIVED FILE

scripts/method_mcp.cjs

1.1 KB · Nov 11, 2026 · 18:09 UTC

↓ Download file

See the change to this file →

"use strict";
// Reuse the installed, user-scoped Python runtime; never install at invocation.
const fs = require("node:fs");
const os = require("node:os");
const path = require("node:path");
const { spawn } = require("node:child_process");
const root = path.resolve(__dirname, "..");
const runtime = process.env.MPARANZA_RUNTIME_ROOT || (process.platform === "win32"
  ? path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData/Local"), "mpr")
  : path.join(os.homedir(), ".local/share/mparanza/runtime"));
const managed = path.join(runtime, "venv", process.platform === "win32" ? "Scripts/python.exe" : "bin/python");
const python = process.env.LUCIA_METHOD_PYTHON || (fs.existsSync(managed) ? managed : (process.platform === "win32" ? "python" : "python3"));
const child = spawn(python, [path.join(__dirname, "method_mcp.py")], {cwd: root, stdio: "inherit"});
child.on("error", () => { process.stderr.write("Lucia: run the documented shared Python setup, then retry.\n"); process.exit(1); });
child.on("exit", (code, signal) => { if (signal) process.kill(process.pid, signal); else process.exit(code ?? 1); });

SHA-256: 106b945789879fcbdb2f91813ff854b70893d14a6f21e3303366acc78b660d09