Environment:0xK3vin MegaMemory Node JS
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, MCP |
| Last Updated | 2026-10-27 14:00 GMT |
Overview
Node.js >= 18 runtime environment for the MegaMemory MCP server, CLI, and web explorer.
Description
MegaMemory is a Node.js application built with TypeScript (target ES2022, module Node16). It runs as an MCP stdio server, a CLI tool, and an HTTP web explorer. The Node.js runtime is the foundational environment required for every implementation in the project. The package is distributed via npm as `megamemory` and can be installed globally (`npm install -g megamemory`) or run via the local entry point `dist/index.js`. Node 18+ is required for native ES module support, top-level `await`, and the `node:` protocol imports used throughout the codebase.
Usage
Use this environment for any MegaMemory operation:
- Running the MCP stdio server (default invocation by editors)
- CLI commands: `install`, `serve`, `stats`, `merge`, `conflicts`, `resolve`
- Building from source via `tsc`
- Running tests via `vitest`
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Cross-platform; Windows uses `where` instead of `which` for binary detection |
| Hardware | Any CPU | No GPU required; embeddings run on CPU via ONNX |
| Disk | ~50MB | ~23MB for embedding model download on first use |
Dependencies
System Packages
- `node` >= 18
- `npm` (bundled with Node.js)
npm Dependencies
- `@modelcontextprotocol/sdk` >= 1.12.1
- `@xenova/transformers` >= 2.17.2
- `libsql` >= 0.5.22
- `picocolors` >= 1.1.1
- `zod` >= 3.24.2
Dev Dependencies
- `typescript` >= 5.7.3
- `tsx` >= 4.19.2
- `vitest` >= 4.0.18
- `@types/node` >= 20.17.14
Credentials
No environment variables are strictly required for basic operation. The following are optional configuration overrides:
- `MEGAMEMORY_DB_PATH` — Override the default database path (default: `.megamemory/knowledge.db` in cwd)
- `OPENCODE_CONFIG_DIR` — Override the opencode config directory (default: `$XDG_CONFIG_HOME/opencode` or `~/.config/opencode`)
Quick Install
# Install globally from npm
npm install -g megamemory
# Or install from source
git clone https://github.com/0xK3vin/MegaMemory.git
cd MegaMemory
npm install
npm run build
Code Evidence
Engine constraint from `package.json:44-46`:
"engines": {
"node": ">=18"
}
ES module and top-level await usage in `src/index.ts:62-66`:
const cmd = process.argv[2];
switch (cmd) {
case "install": {
const { runInstall } = await import("./install.js");
await runInstall(process.argv.slice(3));
Node16 module resolution from `tsconfig.json:3-5`:
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
Platform-specific binary detection in `src/install.ts:210-218`:
execSync(
process.platform === "win32" ? "where megamemory" : "which megamemory",
{ stdio: "ignore" }
);
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Unknown command 'X'` | Typed an unrecognized CLI command | Run `megamemory --help` for usage; default (no arg) starts MCP server |
| `EACCES` on serve | Port below 1024 without privileges | Use a port above 1024 (default is 4321) |
| `EADDRINUSE` on serve | Port already in use | The installer prompts for an alternative port automatically |
| `Cannot use import statement outside a module` | Node < 18 or missing `"type": "module"` | Ensure Node.js >= 18 is installed |
Compatibility Notes
- Windows: Supported. The installer uses `where` instead of `which` for binary detection. Path separators handled via `path.join`.
- macOS: Fully supported. No special considerations.
- Linux: Fully supported. Primary development and CI platform.
- Node < 18: Not supported. Requires ES modules, top-level await, and `node:` protocol imports.
Related Pages
- Implementation:0xK3vin_MegaMemory_Embeddings_Module
- Implementation:0xK3vin_MegaMemory_MCP_Tools_Core
- Implementation:0xK3vin_MegaMemory_MCP_Tools_Merge
- Implementation:0xK3vin_MegaMemory_MergeEngine_merge
- Implementation:0xK3vin_MegaMemory_Merge_CLI
- Implementation:0xK3vin_MegaMemory_Installer
- Implementation:0xK3vin_MegaMemory_Web_Graph_Explorer_Server