Environment:0xranx OpenContext Node js
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, CLI |
| Last Updated | 2026-10-24 10:00 GMT |
Overview
Node.js >= 18 runtime environment for the CLI entry point, MCP server, and agent artifact synchronization.
Description
This environment provides the Node.js runtime for OpenContext's CLI tool (`oc`), MCP server, and core JavaScript modules that handle agent integration, configuration management, and search formatting. It uses CommonJS modules and requires Node.js 18 or higher. The agent sync module reads/writes AGENTS.md, commands, and MCP config files to the user's knowledge base directories.
Usage
Use this environment for CLI operations, MCP server execution, and agent artifact synchronization. It is the prerequisite for `SyncAgentsArtifacts` and `UpsertMcpConfig` implementations that manage agent integration files.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Cross-platform | Linux, macOS, Windows |
| Hardware | Any modern CPU | Minimal resources required |
| Disk | 200MB for node_modules | Plus knowledge base storage |
Dependencies
System Packages
- Node.js >= 18
npm Packages
- `commander` >= 14.0.2 (CLI framework)
- `@modelcontextprotocol/sdk` >= 1.24.3 (MCP server)
- `fs-extra` >= 11.3.2 (file operations)
- `express` >= 5.0.1 (API server)
- `cors` >= 2.8.5
- `zod` >= 4.1.13 (validation)
Credentials
- `OPENCONTEXT_ROOT` — Optional; overrides the base root directory (default: `~/.opencontext`)
Quick Install
# Install Node.js 18+
# Using nvm:
nvm install 18
nvm use 18
# Install dependencies
npm install
Code Evidence
Node.js engine constraint from `package.json:48-50`:
"engines": {
"node": ">=18"
}
CommonJS module type from `package.json:5`:
"type": "commonjs"
CLI entry point from `package.json:7-9`:
"bin": {
"oc": "./bin/oc.js"
}
MCP server script from `package.json:20`:
"mcp": "node src/mcp/server.js"
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ERR_MODULE_NOT_FOUND` | Missing dependency | Run `npm install` |
| `Unknown config key` | Invalid config key passed to `oc config set` | Run `oc config list` to see valid keys |
Compatibility Notes
- CommonJS: All core modules use `require()`/`module.exports` — ES module imports are not supported in core.
- Node.js 18+ minimum: Uses features like `structuredClone` and native fetch.