@memoraone/mcp 0.1.24 → 0.1.26
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.cjs +14 -52
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var require_package = __commonJS({
|
|
|
30
30
|
"package.json"(exports2, module2) {
|
|
31
31
|
module2.exports = {
|
|
32
32
|
name: "@memoraone/mcp",
|
|
33
|
-
version: "0.1.
|
|
33
|
+
version: "0.1.26",
|
|
34
34
|
type: "module",
|
|
35
35
|
main: "dist/index.cjs",
|
|
36
36
|
bin: {
|
|
@@ -685,44 +685,17 @@ async function cliCleanup(argv) {
|
|
|
685
685
|
return result.exitCode;
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
// src/configUtils.ts
|
|
689
|
-
var PROD_API_URL = "https://api.memoraone.com";
|
|
690
|
-
|
|
691
688
|
// src/setupIdeFiles.ts
|
|
692
689
|
var MANAGED_MARKER = "<!-- MemoraOne managed IDE helper -->";
|
|
693
690
|
var GITIGNORE_MEMORAONE_COMMENT = "# MemoraOne local project binding / API key";
|
|
694
691
|
var GITIGNORE_MEMORAONE_ENTRY = "memoraone.m1";
|
|
695
|
-
var
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
return lower === "production" || lower === "prod";
|
|
701
|
-
}
|
|
702
|
-
async function readMemoraoneM1Environment(repoRoot) {
|
|
703
|
-
const m1Path = path4.join(repoRoot, "memoraone.m1");
|
|
704
|
-
try {
|
|
705
|
-
const content = await fs4.readFile(m1Path, "utf8");
|
|
706
|
-
const parsed = JSON.parse(content);
|
|
707
|
-
if (typeof parsed?.environment === "string") {
|
|
708
|
-
const trimmed = parsed.environment.trim();
|
|
709
|
-
if (trimmed !== "") return trimmed;
|
|
710
|
-
}
|
|
711
|
-
} catch {
|
|
692
|
+
var MEMORAONE_MCP_SERVER = {
|
|
693
|
+
command: "npx",
|
|
694
|
+
args: ["-y", "@memoraone/mcp@latest"],
|
|
695
|
+
env: {
|
|
696
|
+
MEMORAONE_API_URL: "https://api.memoraone.com"
|
|
712
697
|
}
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
async function buildMemoraoneMcpServerEntry(repoRoot) {
|
|
716
|
-
const entry = {
|
|
717
|
-
command: "npx",
|
|
718
|
-
args: ["-y", MCP_PACKAGE_ARG]
|
|
719
|
-
};
|
|
720
|
-
const environment = await readMemoraoneM1Environment(repoRoot);
|
|
721
|
-
if (isProdBoundEnvironment(environment)) {
|
|
722
|
-
entry.env = { MEMORAONE_API_URL: PROD_API_URL };
|
|
723
|
-
}
|
|
724
|
-
return entry;
|
|
725
|
-
}
|
|
698
|
+
};
|
|
726
699
|
function assertUnderRepoRoot(repoRoot, absPath) {
|
|
727
700
|
const normRoot = path4.resolve(repoRoot) + path4.sep;
|
|
728
701
|
const normPath = path4.resolve(absPath);
|
|
@@ -830,21 +803,11 @@ function mcpJsonHeader() {
|
|
|
830
803
|
return `// ${MANAGED_MARKER}
|
|
831
804
|
`;
|
|
832
805
|
}
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
return { ...existing.mcpServers };
|
|
839
|
-
}
|
|
840
|
-
return {};
|
|
841
|
-
}
|
|
842
|
-
function buildMcpJsonBody(existing, memoraoneServer) {
|
|
843
|
-
const base = existing && typeof existing === "object" ? { ...existing } : { [VSCODE_MCP_SERVERS_KEY]: {} };
|
|
844
|
-
const servers = extractExistingMcpServers(base);
|
|
845
|
-
servers.memoraone = memoraoneServer;
|
|
846
|
-
const { mcpServers: _legacy, ...rest } = base;
|
|
847
|
-
const merged = { ...rest, [VSCODE_MCP_SERVERS_KEY]: servers };
|
|
806
|
+
function buildMcpJsonBody(existing) {
|
|
807
|
+
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
808
|
+
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
809
|
+
servers.memoraone = { ...MEMORAONE_MCP_SERVER };
|
|
810
|
+
const merged = { ...base, servers };
|
|
848
811
|
return mcpJsonHeader() + JSON.stringify(merged, null, 2) + "\n";
|
|
849
812
|
}
|
|
850
813
|
async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
@@ -888,9 +851,8 @@ async function writeMcpJson(repoRoot, opts) {
|
|
|
888
851
|
} catch (err) {
|
|
889
852
|
if (err?.code !== "ENOENT") throw err;
|
|
890
853
|
}
|
|
891
|
-
const memoraoneServer = await buildMemoraoneMcpServerEntry(repoRoot);
|
|
892
854
|
if (!existed) {
|
|
893
|
-
const body = buildMcpJsonBody(null
|
|
855
|
+
const body = buildMcpJsonBody(null);
|
|
894
856
|
if (opts.dryRun) return "created";
|
|
895
857
|
await fs4.mkdir(path4.dirname(abs), { recursive: true });
|
|
896
858
|
await fs4.writeFile(abs, body, "utf8");
|
|
@@ -905,7 +867,7 @@ async function writeMcpJson(repoRoot, opts) {
|
|
|
905
867
|
parsed = null;
|
|
906
868
|
}
|
|
907
869
|
if (!parsed && !opts.force) return "skipped-untracked";
|
|
908
|
-
const next = buildMcpJsonBody(parsed
|
|
870
|
+
const next = buildMcpJsonBody(parsed);
|
|
909
871
|
if (managed && next === raw) return "skipped";
|
|
910
872
|
if (opts.dryRun) return "updated";
|
|
911
873
|
await fs4.mkdir(path4.dirname(abs), { recursive: true });
|