This guide documents the daily development, testing, and build processes for the N2N Memory MCP Server.
- Runtime: Node.js v20+ (LTS recommended)
- Language: TypeScript
- Package Manager: npm
npm installThis project uses mocha + ts-node/tsx for unit testing.
npm testNote: On Windows, the test script is configured to handle ESM path compatibility correctly.
npm run devCompiles TypeScript into native JavaScript (outputs to build/ directory).
npm run buildnpm startindex.ts: MCP protocol layer. Handles JSON-RPC, resources, and uses Zod for input validation.memory-manager.ts: Service layer. Responsible for file I/O, data sorting, entity merging, and core algorithms.types.ts: Types and Schema definitions. Contains Zod validation rules and serves as the project's type baseline.
Whenever a write operation (Update/Create) is performed, MemoryManager.save is triggered:
- It recursively sorts arrays.
- This ensures that even if fragments are generated out of order, the Git file diff remains stable and readable.
- All logic changes must be accompanied by corresponding unit tests.
- Update
docs/DESIGN.mdbefore making changes to the storage structure.