openclaw-navigator 4.3.0 → 4.3.1
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/cli.mjs +37 -2
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -659,7 +659,7 @@ ${BOLD}How it works:${RESET}
|
|
|
659
659
|
console.log(`${BOLD}${GREEN}Bridge is running.${RESET} Waiting for Navigator to connect...`);
|
|
660
660
|
console.log(`${DIM}Press Ctrl+C to stop.${RESET}\n`);
|
|
661
661
|
|
|
662
|
-
// ── Step 6 (optional): Start MCP server
|
|
662
|
+
// ── Step 6 (optional): Start MCP server + register with mcporter ────
|
|
663
663
|
let mcpProcess = null;
|
|
664
664
|
if (withMcp) {
|
|
665
665
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -682,7 +682,42 @@ ${BOLD}How it works:${RESET}
|
|
|
682
682
|
});
|
|
683
683
|
|
|
684
684
|
ok(`MCP server started (PID ${mcpProcess.pid}) — bridge: http://localhost:${port}`);
|
|
685
|
-
|
|
685
|
+
|
|
686
|
+
// ── Auto-register MCP server with mcporter (if available) ─────────
|
|
687
|
+
// This makes the 15 navigator tools discoverable by the OC agent.
|
|
688
|
+
// Uses --scope home so it persists in ~/.mcporter/mcporter.json.
|
|
689
|
+
try {
|
|
690
|
+
const reg = spawn("mcporter", [
|
|
691
|
+
"config", "add", "navigator",
|
|
692
|
+
"--command", process.execPath,
|
|
693
|
+
"--arg", mcpPath,
|
|
694
|
+
"--env", `NAVIGATOR_BRIDGE_URL=http://localhost:${port}`,
|
|
695
|
+
"--description", "Navigator browser control (15 tools: navigate, click, fill, read, etc.)",
|
|
696
|
+
"--scope", "home",
|
|
697
|
+
], { stdio: ["ignore", "pipe", "pipe"] });
|
|
698
|
+
|
|
699
|
+
let regOut = "";
|
|
700
|
+
reg.stdout?.on("data", (d) => { regOut += d.toString(); });
|
|
701
|
+
reg.stderr?.on("data", (d) => { regOut += d.toString(); });
|
|
702
|
+
|
|
703
|
+
reg.on("close", (code) => {
|
|
704
|
+
if (code === 0) {
|
|
705
|
+
ok("Registered MCP server with mcporter (15 browser tools available to OC agent)");
|
|
706
|
+
} else if (regOut.includes("already exists")) {
|
|
707
|
+
info(" mcporter: navigator server already registered");
|
|
708
|
+
} else {
|
|
709
|
+
// mcporter not installed or failed — that's fine, not required
|
|
710
|
+
info(" mcporter not found — OC agent can still use the MCP server directly");
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
reg.on("error", () => {
|
|
715
|
+
info(" mcporter not found — OC agent can still use the MCP server directly");
|
|
716
|
+
});
|
|
717
|
+
} catch {
|
|
718
|
+
// mcporter not installed — skip silently
|
|
719
|
+
}
|
|
720
|
+
|
|
686
721
|
console.log("");
|
|
687
722
|
}
|
|
688
723
|
|