memgit-mcp 0.1.2

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.
Files changed (2) hide show
  1. package/bin/memgit-mcp.js +45 -0
  2. package/package.json +23 -0
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * memgit-mcp — npm wrapper for the memgit MCP server.
4
+ * Usage: npx memgit-mcp [--store /path/to/store]
5
+ *
6
+ * On first run, installs memgit into an isolated venv under ~/.memgit-npm-venv
7
+ * and then runs `memgit serve` (stdio MCP transport).
8
+ */
9
+
10
+ import { execFileSync, spawn } from "node:child_process";
11
+ import { existsSync, mkdirSync } from "node:fs";
12
+ import { homedir } from "node:os";
13
+ import { join } from "node:path";
14
+
15
+ const VENV = join(homedir(), ".memgit-npm-venv");
16
+ const PIP = join(VENV, process.platform === "win32" ? "Scripts/pip" : "bin/pip");
17
+ const MEMGIT = join(VENV, process.platform === "win32" ? "Scripts/memgit" : "bin/memgit");
18
+
19
+ function findPython() {
20
+ for (const cmd of ["python3", "python"]) {
21
+ try {
22
+ const ver = execFileSync(cmd, ["--version"], { encoding: "utf8" }).trim();
23
+ const match = ver.match(/Python (\d+)\.(\d+)/);
24
+ if (match && (parseInt(match[1]) > 3 || (parseInt(match[1]) === 3 && parseInt(match[2]) >= 11))) {
25
+ return cmd;
26
+ }
27
+ } catch {}
28
+ }
29
+ throw new Error("Python 3.11+ not found. Install from https://python.org/downloads");
30
+ }
31
+
32
+ if (!existsSync(MEMGIT)) {
33
+ process.stderr.write("[memgit-mcp] First run: installing memgit...\n");
34
+ const python = findPython();
35
+ if (!existsSync(VENV)) {
36
+ execFileSync(python, ["-m", "venv", VENV], { stdio: "inherit" });
37
+ }
38
+ execFileSync(PIP, ["install", "--upgrade", "memgit"], { stdio: "inherit" });
39
+ process.stderr.write("[memgit-mcp] memgit installed.\n");
40
+ }
41
+
42
+ // Pass all CLI args through to memgit serve
43
+ const args = ["serve", ...process.argv.slice(2)];
44
+ const child = spawn(MEMGIT, args, { stdio: "inherit" });
45
+ child.on("exit", (code) => process.exit(code ?? 0));
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "memgit-mcp",
3
+ "version": "0.1.2",
4
+ "type": "module",
5
+ "description": "memgit MCP server — run as npx memgit-mcp. Git for AI memory.",
6
+ "keywords": ["mcp", "ai", "memory", "claude", "cursor", "llm", "context"],
7
+ "homepage": "https://memgit.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/code4161/memgit.git",
11
+ "directory": "npm-wrapper"
12
+ },
13
+ "license": "MIT",
14
+ "bin": {
15
+ "memgit-mcp": "bin/memgit-mcp.js"
16
+ },
17
+ "engines": {
18
+ "node": ">=18.0.0"
19
+ },
20
+ "files": [
21
+ "bin/"
22
+ ]
23
+ }