@lightupai/polaris 0.0.20 → 0.0.22
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/package.json +1 -1
- package/src/cli/cli.ts +30 -38
package/package.json
CHANGED
package/src/cli/cli.ts
CHANGED
|
@@ -109,48 +109,40 @@ function appToApi(appUrl: string): string {
|
|
|
109
109
|
async function install(participantId?: string) {
|
|
110
110
|
await mkdir(CLAUDE_DIR, { recursive: true });
|
|
111
111
|
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
// Install package to ~/.polaris/mcp/ (user-local, no sudo needed, persistent)
|
|
113
|
+
const mcpDir = join(POLARIS_DIR, "mcp");
|
|
114
|
+
await mkdir(mcpDir, { recursive: true });
|
|
115
|
+
|
|
116
|
+
console.log(" Installing MCP server to ~/.polaris/mcp/...");
|
|
117
|
+
const npmInstall = Bun.spawnSync(
|
|
118
|
+
["npm", "install", "--prefix", mcpDir, "@lightupai/polaris@latest"],
|
|
119
|
+
{ stdout: "ignore", stderr: "pipe" }
|
|
120
|
+
);
|
|
118
121
|
if (npmInstall.exitCode !== 0) {
|
|
119
|
-
console.error(" Warning:
|
|
120
|
-
console.error("
|
|
122
|
+
console.error(" Warning: MCP server install failed.");
|
|
123
|
+
console.error(" " + npmInstall.stderr.toString().trim());
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
//
|
|
124
|
-
const
|
|
125
|
-
const mcpBin = whichResult.stdout.toString().trim() || "polaris-mcp";
|
|
126
|
-
|
|
127
|
-
const mcpConfig = {
|
|
128
|
-
mcpServers: {
|
|
129
|
-
polaris: {
|
|
130
|
-
command: mcpBin,
|
|
131
|
-
args: [],
|
|
132
|
-
env: {
|
|
133
|
-
POLARIS_DAEMON_URL: "http://127.0.0.1:4322",
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
};
|
|
126
|
+
// The binary is at ~/.polaris/mcp/node_modules/.bin/polaris-mcp
|
|
127
|
+
const mcpBin = join(mcpDir, "node_modules", ".bin", "polaris-mcp");
|
|
138
128
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
129
|
+
// Register MCP server with Claude Code via `claude mcp add`
|
|
130
|
+
// This writes to the correct config location that Claude Code reads
|
|
131
|
+
// Remove first to avoid duplicates, then add with user scope
|
|
132
|
+
Bun.spawnSync(["claude", "mcp", "remove", "polaris", "-s", "user"], {
|
|
133
|
+
stdout: "ignore", stderr: "ignore",
|
|
134
|
+
});
|
|
135
|
+
const mcpAdd = Bun.spawnSync(
|
|
136
|
+
["claude", "mcp", "add", "polaris", "-s", "user", "-e", "POLARIS_DAEMON_URL=http://127.0.0.1:4322", "--", mcpBin],
|
|
137
|
+
{ stdout: "pipe", stderr: "pipe" }
|
|
138
|
+
);
|
|
139
|
+
if (mcpAdd.exitCode === 0) {
|
|
140
|
+
console.log(" ✓ MCP server registered with Claude Code");
|
|
141
|
+
} else {
|
|
142
|
+
console.error(" Warning: could not register MCP server with Claude Code.");
|
|
143
|
+
console.error(" " + mcpAdd.stderr.toString().trim());
|
|
144
|
+
console.error(` Run manually: claude mcp add -s user -e POLARIS_DAEMON_URL=http://127.0.0.1:4322 polaris -- ${mcpBin}`);
|
|
145
|
+
}
|
|
154
146
|
|
|
155
147
|
// Hooks
|
|
156
148
|
const captureShPath = join(import.meta.dir, "..", "..", "hooks", "capture.sh");
|