openclaw-navigator 4.3.2 → 4.3.3
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 +0 -49
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -733,55 +733,6 @@ ${BOLD}How it works:${RESET}
|
|
|
733
733
|
// mcporter not installed — skip silently
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
-
// ── Auto-register with OpenClaw agent config (~/.openclaw/openclaw.json) ──
|
|
737
|
-
// The OC agent reads MCP servers from this file, not mcporter.
|
|
738
|
-
// This ensures the 15 Navigator tools show up in the agent's tool schema.
|
|
739
|
-
try {
|
|
740
|
-
const { readFileSync, writeFileSync, mkdirSync } = await import("node:fs");
|
|
741
|
-
const { homedir } = await import("node:os");
|
|
742
|
-
const ocDir = join(homedir(), ".openclaw");
|
|
743
|
-
const ocConfigPath = join(ocDir, "openclaw.json");
|
|
744
|
-
|
|
745
|
-
let ocConfig = {};
|
|
746
|
-
try {
|
|
747
|
-
ocConfig = JSON.parse(readFileSync(ocConfigPath, "utf8"));
|
|
748
|
-
} catch {
|
|
749
|
-
// File doesn't exist or invalid — start fresh
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// Ensure the nested structure exists
|
|
753
|
-
if (!ocConfig.agents) ocConfig.agents = {};
|
|
754
|
-
if (!ocConfig.agents.defaults) ocConfig.agents.defaults = {};
|
|
755
|
-
if (!ocConfig.agents.defaults.mcp) ocConfig.agents.defaults.mcp = {};
|
|
756
|
-
if (!ocConfig.agents.defaults.mcp.servers) ocConfig.agents.defaults.mcp.servers = {};
|
|
757
|
-
|
|
758
|
-
// Check if navigator is already configured correctly
|
|
759
|
-
const existing = ocConfig.agents.defaults.mcp.servers.navigator;
|
|
760
|
-
const desired = {
|
|
761
|
-
command: process.execPath,
|
|
762
|
-
args: [mcpPath],
|
|
763
|
-
env: { NAVIGATOR_BRIDGE_URL: `http://localhost:${port}` },
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
const needsUpdate =
|
|
767
|
-
!existing ||
|
|
768
|
-
existing.command !== desired.command ||
|
|
769
|
-
JSON.stringify(existing.args) !== JSON.stringify(desired.args);
|
|
770
|
-
|
|
771
|
-
if (needsUpdate) {
|
|
772
|
-
ocConfig.agents.defaults.mcp.servers.navigator = desired;
|
|
773
|
-
mkdirSync(ocDir, { recursive: true });
|
|
774
|
-
writeFileSync(ocConfigPath, JSON.stringify(ocConfig, null, 2) + "\n", "utf8");
|
|
775
|
-
ok("Registered Navigator MCP in ~/.openclaw/openclaw.json (15 tools → OC agent)");
|
|
776
|
-
info(" Restart the OC gateway to pick up the new tools");
|
|
777
|
-
} else {
|
|
778
|
-
info(" Navigator already registered in ~/.openclaw/openclaw.json");
|
|
779
|
-
}
|
|
780
|
-
} catch (err) {
|
|
781
|
-
warn(`Could not auto-register with OpenClaw config: ${err.message}`);
|
|
782
|
-
info(" Manually add to ~/.openclaw/openclaw.json → agents.defaults.mcp.servers.navigator");
|
|
783
|
-
}
|
|
784
|
-
|
|
785
736
|
console.log("");
|
|
786
737
|
}
|
|
787
738
|
|