UNPKG

memory-engineering-mcp

Version:

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

73 lines (56 loc) • 2.71 kB
#!/usr/bin/env node /** * Create Atlas Collections for Memory Engineering MCP * This script creates the required collections in MongoDB Atlas */ import { MongoClient } from 'mongodb'; import 'dotenv/config'; const MONGODB_URI = process.env.MONGODB_URI || 'mongodb+srv://rom:05101994@mongovibe.mmzhvvr.mongodb.net/memory_engineering?retryWrites=true&w=majority&appName=mongovibe'; async function createCollections() { const client = new MongoClient(MONGODB_URI); try { console.log('šŸ”— Connecting to MongoDB Atlas...'); await client.connect(); console.log('āœ… Connected to Atlas!'); const db = client.db(); const collections = await db.listCollections().toArray(); const collectionNames = collections.map(c => c.name); // Create memory_engineering_documents if (!collectionNames.includes('memory_engineering_documents')) { await db.createCollection('memory_engineering_documents'); console.log('āœ… Created collection: memory_engineering_documents'); } else { console.log('āœ“ Collection already exists: memory_engineering_documents'); } // Create memory_engineering_code if (!collectionNames.includes('memory_engineering_code')) { await db.createCollection('memory_engineering_code'); console.log('āœ… Created collection: memory_engineering_code'); } else { console.log('āœ“ Collection already exists: memory_engineering_code'); } // Create basic indexes console.log('\nšŸ“Š Creating indexes...'); const docsCollection = db.collection('memory_engineering_documents'); await docsCollection.createIndex({ projectId: 1, memoryName: 1 }, { unique: true }); await docsCollection.createIndex({ projectId: 1 }); await docsCollection.createIndex({ updatedAt: -1 }); console.log('āœ… Created indexes for memory_engineering_documents'); const codeCollection = db.collection('memory_engineering_code'); await codeCollection.createIndex({ projectId: 1, filePath: 1, startLine: 1 }); await codeCollection.createIndex({ projectId: 1 }); console.log('āœ… Created indexes for memory_engineering_code'); console.log('\nšŸŽ‰ All collections and indexes created successfully!'); console.log('\nšŸ“‹ Next steps:'); console.log(' 1. Run memory_engineering_init to initialize the project'); console.log(' 2. Run memory_engineering_sync to index your code'); console.log(' 3. Start using vector search!'); } catch (error) { console.error('āŒ Error:', error.message); process.exit(1); } finally { await client.close(); console.log('\nšŸ”Œ Disconnected from Atlas'); } } createCollections();