UNPKG

memory-engineering-mcp

Version:

🧠 AI Memory System powered by MongoDB Atlas & Voyage AI - Autonomous memory management with zero manual work

63 lines 2.34 kB
#!/usr/bin/env node import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { setupToolsConsolidated } from './tools/index-v6-consolidated.js'; import { setupResources } from './tools/resources.js'; import { connectToMongoDB, closeMongoDBConnection } from './db/connection.js'; import { logger } from './utils/logger.js'; import { config } from 'dotenv'; import { existsSync } from 'fs'; import { join } from 'path'; // Load environment variables const envPaths = ['.env.local', '.env']; for (const envPath of envPaths) { const fullPath = join(process.cwd(), envPath); if (existsSync(fullPath)) { config({ path: fullPath }); break; } } async function main() { logger.info('🚀 CONSOLIDATED MODE: Memory Engineering MCP Server Starting...'); logger.info('📦 Using 6 consolidated tools instead of 10'); const server = new Server({ name: 'memory-engineering-mcp', version: '13.0.1', }, { capabilities: { tools: {}, resources: {}, }, }); // Setup consolidated tools (6 instead of 10) setupToolsConsolidated(server); // Setup resources (keep the same) setupResources(server); // Error handling server.onerror = (error) => { logger.error('🔴 Server error:', error); }; process.on('SIGINT', async () => { logger.info('🛑 Shutting down Memory Engineering MCP Server (Consolidated)...'); await closeMongoDBConnection(); process.exit(0); }); // Connect to MongoDB try { await connectToMongoDB(); logger.info('✅ MongoDB connected in consolidated mode'); } catch (error) { logger.error('❌ MongoDB connection failed:', error); // Continue anyway - some tools might work without DB } const transport = new StdioServerTransport(); await server.connect(transport); logger.info('✅ Memory Engineering MCP Server (Consolidated) running with 6 tools'); logger.info('🎯 Tools: init, memory, search, sync, system (replaces 10 tools)'); } main().catch((error) => { logger.error('💀 Failed to start server (consolidated):', error); process.exit(1); }); //# sourceMappingURL=index-consolidated.js.map