@nolto/cli 0.3.0 → 0.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/dist/index.js +35 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -581,9 +581,43 @@ async function injectCursor(opts) {
|
|
|
581
581
|
`);
|
|
582
582
|
}
|
|
583
583
|
async function injectClaude(opts) {
|
|
584
|
+
const mcpUrl = `${opts.baseUrl.replace(/\/+$/, "")}/mcp`;
|
|
585
|
+
const claudePath = await findOnPath("claude");
|
|
586
|
+
if (claudePath) {
|
|
587
|
+
const execFileAsync2 = getExecFileAsync();
|
|
588
|
+
await execFileAsync2(claudePath, ["mcp", "remove", "nolto", "--scope", "user"]).catch(
|
|
589
|
+
() => void 0
|
|
590
|
+
);
|
|
591
|
+
try {
|
|
592
|
+
const { stderr } = await execFileAsync2(claudePath, [
|
|
593
|
+
"mcp",
|
|
594
|
+
"add",
|
|
595
|
+
"nolto",
|
|
596
|
+
mcpUrl,
|
|
597
|
+
"--transport",
|
|
598
|
+
"http",
|
|
599
|
+
"--scope",
|
|
600
|
+
"user",
|
|
601
|
+
"--header",
|
|
602
|
+
`Authorization: Bearer ${opts.token}`
|
|
603
|
+
]);
|
|
604
|
+
if (stderr) {
|
|
605
|
+
process.stderr.write(`[claude mcp add] ${stderr}
|
|
606
|
+
`);
|
|
607
|
+
}
|
|
608
|
+
process.stdout.write("Registered nolto MCP server in Claude Code (user scope).\n");
|
|
609
|
+
process.stdout.write("Reconnect or restart Claude Code to use it.\n");
|
|
610
|
+
return;
|
|
611
|
+
} catch (err) {
|
|
612
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
613
|
+
process.stderr.write(
|
|
614
|
+
`Warning: claude mcp add failed (${msg}); writing project .mcp.json instead.
|
|
615
|
+
`
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
584
619
|
const cwd = opts.claudeCwd ?? process.cwd();
|
|
585
620
|
const configPath = path3.join(cwd, ".mcp.json");
|
|
586
|
-
const mcpUrl = `${opts.baseUrl.replace(/\/+$/, "")}/mcp`;
|
|
587
621
|
const result = await readJsonConfig(configPath);
|
|
588
622
|
const existing = result?.parsed ?? {};
|
|
589
623
|
const updatedServers = {
|