Zanny's Persistent Memory Manager

by zannyonear1h1
Verified
import { config, ensureDirectories } from './config'; import logger from './logger'; import { MCPServer } from './mcpServer'; // Ensure all required directories exist ensureDirectories(); // Log startup information logger.info(`Starting ${config.name}`); logger.info(`Memories directory: ${config.memoriesDir}`); try { // Create and start the MCP server const server = new MCPServer(); server.start(); // Handle graceful shutdown process.on('SIGINT', () => { logger.info('Received SIGINT signal. Shutting down gracefully...'); process.exit(0); }); process.on('SIGTERM', () => { logger.info('Received SIGTERM signal. Shutting down gracefully...'); process.exit(0); }); // Handle uncaught exceptions process.on('uncaughtException', (error) => { logger.error(`Uncaught Exception: ${error.message}`); logger.error(error.stack); process.exit(1); }); process.on('unhandledRejection', (reason, promise) => { logger.error('Unhandled Promise Rejection:'); logger.error(`Promise: ${promise}`); logger.error(`Reason: ${reason}`); }); } catch (error) { logger.error(`Failed to start server: ${error}`); process.exit(1); }