@peppermint-mcp/wizard 0.1.1 → 0.1.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/dist/cli.js +40 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -352,7 +352,7 @@ async function authenticateWithBrowser(serverBase2) {
|
|
|
352
352
|
import { execFile as execFile3 } from "child_process";
|
|
353
353
|
import { promisify as promisify3 } from "util";
|
|
354
354
|
var exec3 = promisify3(execFile3);
|
|
355
|
-
async function installClaudeCode(serverUrl, dryRun) {
|
|
355
|
+
async function installClaudeCode(serverUrl, apiKey, dryRun) {
|
|
356
356
|
const args = [
|
|
357
357
|
"mcp",
|
|
358
358
|
"add",
|
|
@@ -363,6 +363,9 @@ async function installClaudeCode(serverUrl, dryRun) {
|
|
|
363
363
|
"peppermint-memory",
|
|
364
364
|
serverUrl
|
|
365
365
|
];
|
|
366
|
+
if (apiKey) {
|
|
367
|
+
args.push("--header", `Authorization: Bearer ${apiKey}`);
|
|
368
|
+
}
|
|
366
369
|
if (dryRun) {
|
|
367
370
|
return {
|
|
368
371
|
success: true,
|
|
@@ -587,10 +590,30 @@ async function removeCursor(dryRun) {
|
|
|
587
590
|
|
|
588
591
|
// src/hosts/codex.ts
|
|
589
592
|
import { execFile as execFile4 } from "child_process";
|
|
593
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
594
|
+
import { homedir as homedir6 } from "os";
|
|
595
|
+
import { join as join6 } from "path";
|
|
590
596
|
import { promisify as promisify4 } from "util";
|
|
591
597
|
var exec4 = promisify4(execFile4);
|
|
592
|
-
|
|
598
|
+
function persistCodexEnvVar(apiKey) {
|
|
599
|
+
const codexDir = join6(homedir6(), ".codex");
|
|
600
|
+
const envPath = join6(codexDir, ".env");
|
|
601
|
+
if (!existsSync5(codexDir)) {
|
|
602
|
+
mkdirSync3(codexDir, { recursive: true });
|
|
603
|
+
}
|
|
604
|
+
let content = "";
|
|
605
|
+
if (existsSync5(envPath)) {
|
|
606
|
+
content = readFileSync5(envPath, "utf-8");
|
|
607
|
+
}
|
|
608
|
+
const lines = content.split("\n").filter((l) => !l.startsWith("PEPPERMINT_TOKEN="));
|
|
609
|
+
lines.push(`PEPPERMINT_TOKEN=${apiKey}`);
|
|
610
|
+
writeFileSync3(envPath, lines.filter(Boolean).join("\n") + "\n", { mode: 384 });
|
|
611
|
+
}
|
|
612
|
+
async function installCodex(serverUrl, apiKey, dryRun) {
|
|
593
613
|
const addArgs = ["mcp", "add", "peppermint-memory", "--url", serverUrl];
|
|
614
|
+
if (apiKey) {
|
|
615
|
+
addArgs.push("--bearer-token-env-var", "PEPPERMINT_TOKEN");
|
|
616
|
+
}
|
|
594
617
|
if (dryRun) {
|
|
595
618
|
return {
|
|
596
619
|
success: true,
|
|
@@ -599,7 +622,14 @@ async function installCodex(serverUrl, dryRun) {
|
|
|
599
622
|
};
|
|
600
623
|
}
|
|
601
624
|
try {
|
|
602
|
-
|
|
625
|
+
if (apiKey) {
|
|
626
|
+
persistCodexEnvVar(apiKey);
|
|
627
|
+
}
|
|
628
|
+
const env = { ...process.env };
|
|
629
|
+
if (apiKey) {
|
|
630
|
+
env.PEPPERMINT_TOKEN = apiKey;
|
|
631
|
+
}
|
|
632
|
+
await exec4("codex", addArgs, { timeout: 15e3, env });
|
|
603
633
|
return {
|
|
604
634
|
success: true,
|
|
605
635
|
message: "Added peppermint-memory via codex mcp add",
|
|
@@ -650,7 +680,7 @@ async function checkServerReachable(serverUrl) {
|
|
|
650
680
|
}
|
|
651
681
|
|
|
652
682
|
// src/verify/host.ts
|
|
653
|
-
import { existsSync as
|
|
683
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
654
684
|
import * as jsonc4 from "jsonc-parser";
|
|
655
685
|
function checkHostConfig(hostId, configPath) {
|
|
656
686
|
if (!configPath) {
|
|
@@ -660,7 +690,7 @@ function checkHostConfig(hostId, configPath) {
|
|
|
660
690
|
message: "Installed via CLI"
|
|
661
691
|
};
|
|
662
692
|
}
|
|
663
|
-
if (!
|
|
693
|
+
if (!existsSync6(configPath)) {
|
|
664
694
|
return {
|
|
665
695
|
hostId,
|
|
666
696
|
status: "fail",
|
|
@@ -668,7 +698,7 @@ function checkHostConfig(hostId, configPath) {
|
|
|
668
698
|
};
|
|
669
699
|
}
|
|
670
700
|
try {
|
|
671
|
-
const content =
|
|
701
|
+
const content = readFileSync6(configPath, "utf-8");
|
|
672
702
|
const parsed = jsonc4.parse(content);
|
|
673
703
|
const hasPeppermint = !!parsed?.mcpServers?.peppermint;
|
|
674
704
|
if (!hasPeppermint) {
|
|
@@ -697,15 +727,13 @@ var DEFAULT_SERVER = "https://api.peppermint.com/mcp/";
|
|
|
697
727
|
function serverBase(serverUrl) {
|
|
698
728
|
return serverUrl.replace(/\/mcp\/?$/, "");
|
|
699
729
|
}
|
|
700
|
-
function needsAuth(
|
|
701
|
-
return
|
|
702
|
-
(h) => h.installMethod === "file-native-http" || h.installMethod === "file-stdio-shim"
|
|
703
|
-
);
|
|
730
|
+
function needsAuth(_hosts) {
|
|
731
|
+
return true;
|
|
704
732
|
}
|
|
705
733
|
async function installHost(host, serverUrl, apiKey, dryRun) {
|
|
706
734
|
switch (host.id) {
|
|
707
735
|
case "claude-code":
|
|
708
|
-
return installClaudeCode(serverUrl, dryRun);
|
|
736
|
+
return installClaudeCode(serverUrl, apiKey, dryRun);
|
|
709
737
|
case "claude-desktop":
|
|
710
738
|
if (!apiKey) throw new Error("API key required for Claude Desktop");
|
|
711
739
|
return installClaudeDesktop(serverUrl, apiKey, dryRun);
|
|
@@ -713,7 +741,7 @@ async function installHost(host, serverUrl, apiKey, dryRun) {
|
|
|
713
741
|
if (!apiKey) throw new Error("API key required for Cursor");
|
|
714
742
|
return installCursor(serverUrl, apiKey, dryRun);
|
|
715
743
|
case "codex":
|
|
716
|
-
return installCodex(serverUrl, dryRun);
|
|
744
|
+
return installCodex(serverUrl, apiKey, dryRun);
|
|
717
745
|
}
|
|
718
746
|
}
|
|
719
747
|
async function removeHost(host, dryRun) {
|