memory-mcp-1file 0.2.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.
Files changed (4) hide show
  1. package/README.md +62 -0
  2. package/package.json +37 -0
  3. package/postinstall.js +166 -0
  4. package/run.js +40 -0
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # memory-mcp-1file
2
+
3
+ MCP memory server with semantic search, code indexing, and knowledge graph for AI agents.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Run directly (downloads binary automatically)
9
+ npx memory-mcp-1file
10
+
11
+ # Or with bun
12
+ bunx memory-mcp-1file
13
+ ```
14
+
15
+ ## What is this?
16
+
17
+ `memory-mcp` is a [Model Context Protocol](https://modelcontextprotocol.io/) server that provides AI agents with:
18
+
19
+ - **Semantic memory** — store and search memories with embeddings
20
+ - **Code indexing** — parse and index codebases with tree-sitter
21
+ - **Knowledge graph** — entity extraction and relationship tracking
22
+ - **Temporal awareness** — time-based memory queries
23
+
24
+ ## Configuration
25
+
26
+ Use with Claude Code, Cursor, or any MCP-compatible client:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "memory": {
32
+ "command": "npx",
33
+ "args": ["-y", "memory-mcp-1file"]
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## CLI Options
40
+
41
+ ```bash
42
+ memory-mcp --help # Show all options
43
+ memory-mcp --db-path /data # Custom database path
44
+ ```
45
+
46
+ ## Supported Platforms
47
+
48
+ | Platform | Architecture |
49
+ |---|---|
50
+ | Linux | x86_64 (musl) |
51
+ | macOS | x86_64, ARM64 (Apple Silicon) |
52
+ | Windows | x86_64 |
53
+
54
+ ## Links
55
+
56
+ - [GitHub Repository](https://github.com/pomazanbohdan/memory-mcp-1file)
57
+ - [Releases](https://github.com/pomazanbohdan/memory-mcp-1file/releases)
58
+ - [Architecture](https://github.com/pomazanbohdan/memory-mcp-1file/blob/master/ARCHITECTURE.md)
59
+
60
+ ## License
61
+
62
+ MIT
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "memory-mcp-1file",
3
+ "version": "0.2.3",
4
+ "description": "MCP memory server with semantic search, code indexing, and knowledge graph for AI agents",
5
+ "bin": {
6
+ "memory-mcp": "./run.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node postinstall.js"
10
+ },
11
+ "keywords": [
12
+ "mcp",
13
+ "memory",
14
+ "ai",
15
+ "semantic-search",
16
+ "knowledge-graph",
17
+ "code-indexing",
18
+ "model-context-protocol"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/pomazanbohdan/memory-mcp-1file"
23
+ },
24
+ "homepage": "https://github.com/pomazanbohdan/memory-mcp-1file#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/pomazanbohdan/memory-mcp-1file/issues"
27
+ },
28
+ "license": "MIT",
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "files": [
33
+ "run.js",
34
+ "postinstall.js",
35
+ "README.md"
36
+ ]
37
+ }
package/postinstall.js ADDED
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * postinstall.js — downloads the pre-compiled memory-mcp binary
5
+ * from GitHub Releases for the current platform.
6
+ *
7
+ * Zero external dependencies — uses only Node.js built-ins.
8
+ */
9
+
10
+ const https = require("https");
11
+ const http = require("http");
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const { execSync } = require("child_process");
15
+ const os = require("os");
16
+ const zlib = require("zlib");
17
+
18
+ const REPO = "pomazanbohdan/memory-mcp-1file";
19
+ const BINARY_NAME = "memory-mcp";
20
+
21
+ // Map Node.js platform/arch to Rust target triples
22
+ const PLATFORM_MAP = {
23
+ "linux-x64": "x86_64-unknown-linux-musl",
24
+ "darwin-x64": "x86_64-apple-darwin",
25
+ "darwin-arm64": "aarch64-apple-darwin",
26
+ "win32-x64": "x86_64-pc-windows-msvc",
27
+ };
28
+
29
+ function getPlatformKey() {
30
+ return `${process.platform}-${process.arch}`;
31
+ }
32
+
33
+ function getTarget() {
34
+ const key = getPlatformKey();
35
+ const target = PLATFORM_MAP[key];
36
+ if (!target) {
37
+ console.error(
38
+ `Unsupported platform: ${key}\n` +
39
+ `Supported platforms: ${Object.keys(PLATFORM_MAP).join(", ")}`
40
+ );
41
+ process.exit(1);
42
+ }
43
+ return target;
44
+ }
45
+
46
+ function getVersion() {
47
+ const pkg = JSON.parse(
48
+ fs.readFileSync(path.join(__dirname, "package.json"), "utf8")
49
+ );
50
+ return pkg.version;
51
+ }
52
+
53
+ function getDownloadUrl(version, target) {
54
+ const ext = target.includes("windows") ? ".zip" : ".tar.gz";
55
+ return `https://github.com/${REPO}/releases/download/v${version}/${BINARY_NAME}-${version}-${target}${ext}`;
56
+ }
57
+
58
+ /**
59
+ * Follow redirects (GitHub releases use 302 → S3).
60
+ */
61
+ function download(url) {
62
+ return new Promise((resolve, reject) => {
63
+ const client = url.startsWith("https") ? https : http;
64
+ client
65
+ .get(url, { headers: { "User-Agent": "memory-mcp-npm" } }, (res) => {
66
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
67
+ return download(res.headers.location).then(resolve, reject);
68
+ }
69
+ if (res.statusCode !== 200) {
70
+ return reject(
71
+ new Error(`Download failed: HTTP ${res.statusCode} for ${url}`)
72
+ );
73
+ }
74
+ const chunks = [];
75
+ res.on("data", (chunk) => chunks.push(chunk));
76
+ res.on("end", () => resolve(Buffer.concat(chunks)));
77
+ res.on("error", reject);
78
+ })
79
+ .on("error", reject);
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Extract .tar.gz using Node.js built-in zlib + tar command.
85
+ */
86
+ async function extractTarGz(buffer, destDir) {
87
+ fs.mkdirSync(destDir, { recursive: true });
88
+ const tmpFile = path.join(os.tmpdir(), `memory-mcp-${Date.now()}.tar.gz`);
89
+ fs.writeFileSync(tmpFile, buffer);
90
+ try {
91
+ execSync(`tar -xzf "${tmpFile}" -C "${destDir}"`, { stdio: "pipe" });
92
+ } finally {
93
+ fs.unlinkSync(tmpFile);
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Extract .zip using unzip command (available on Windows via PowerShell).
99
+ */
100
+ async function extractZip(buffer, destDir) {
101
+ fs.mkdirSync(destDir, { recursive: true });
102
+ const tmpFile = path.join(os.tmpdir(), `memory-mcp-${Date.now()}.zip`);
103
+ fs.writeFileSync(tmpFile, buffer);
104
+ try {
105
+ if (process.platform === "win32") {
106
+ execSync(
107
+ `powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${destDir}' -Force"`,
108
+ { stdio: "pipe" }
109
+ );
110
+ } else {
111
+ execSync(`unzip -o "${tmpFile}" -d "${destDir}"`, { stdio: "pipe" });
112
+ }
113
+ } finally {
114
+ fs.unlinkSync(tmpFile);
115
+ }
116
+ }
117
+
118
+ async function main() {
119
+ const target = getTarget();
120
+ const version = getVersion();
121
+ const url = getDownloadUrl(version, target);
122
+ const binDir = path.join(__dirname, "bin");
123
+ const isWindows = target.includes("windows");
124
+ const binaryPath = path.join(
125
+ binDir,
126
+ isWindows ? `${BINARY_NAME}.exe` : BINARY_NAME
127
+ );
128
+
129
+ // Skip if binary already exists
130
+ if (fs.existsSync(binaryPath)) {
131
+ console.log(`memory-mcp binary already exists at ${binaryPath}`);
132
+ return;
133
+ }
134
+
135
+ console.log(`Downloading memory-mcp v${version} for ${target}...`);
136
+ console.log(` URL: ${url}`);
137
+
138
+ try {
139
+ const buffer = await download(url);
140
+
141
+ if (isWindows) {
142
+ await extractZip(buffer, binDir);
143
+ } else {
144
+ await extractTarGz(buffer, binDir);
145
+ }
146
+
147
+ // Make binary executable on Unix
148
+ if (!isWindows) {
149
+ fs.chmodSync(binaryPath, 0o755);
150
+ }
151
+
152
+ console.log(`✅ memory-mcp installed successfully at ${binaryPath}`);
153
+ } catch (err) {
154
+ console.error(`\n❌ Failed to install memory-mcp binary:`);
155
+ console.error(` ${err.message}`);
156
+ console.error(
157
+ `\nYou can manually download the binary from:`
158
+ );
159
+ console.error(
160
+ ` https://github.com/${REPO}/releases/tag/v${version}`
161
+ );
162
+ process.exit(1);
163
+ }
164
+ }
165
+
166
+ main();
package/run.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * run.js — entry point for `npx memory-mcp` / `bunx memory-mcp`.
5
+ * Finds and executes the pre-compiled binary, proxying stdio and args.
6
+ */
7
+
8
+ const { spawn } = require("child_process");
9
+ const path = require("path");
10
+ const fs = require("fs");
11
+
12
+ const isWindows = process.platform === "win32";
13
+ const binaryName = isWindows ? "memory-mcp.exe" : "memory-mcp";
14
+ const binaryPath = path.join(__dirname, "bin", binaryName);
15
+
16
+ if (!fs.existsSync(binaryPath)) {
17
+ console.error(
18
+ `❌ memory-mcp binary not found at ${binaryPath}\n` +
19
+ ` Run "node postinstall.js" to download it, or reinstall the package.`
20
+ );
21
+ process.exit(1);
22
+ }
23
+
24
+ const child = spawn(binaryPath, process.argv.slice(2), {
25
+ stdio: "inherit",
26
+ env: process.env,
27
+ });
28
+
29
+ child.on("error", (err) => {
30
+ console.error(`Failed to start memory-mcp: ${err.message}`);
31
+ process.exit(1);
32
+ });
33
+
34
+ child.on("exit", (code, signal) => {
35
+ if (signal) {
36
+ process.kill(process.pid, signal);
37
+ } else {
38
+ process.exit(code ?? 1);
39
+ }
40
+ });