casefile-repository-mcp-server
Version:
Vessel casefile management system with MCP integration for maritime operations
16 lines • 595 B
JavaScript
import { MongoClient } from 'mongodb';
import { logger } from './logger.js';
// Use a map to store multiple client connections by URI
const clientMap = new Map();
export async function getMongoClient(uri) {
// Get existing client for this URI if it exists
let client = clientMap.get(uri);
if (!client) {
logger.info(`Creating new MongoDB connection for URI: ${uri.substring(0, uri.indexOf('@') + 1)}...`);
client = new MongoClient(uri);
await client.connect();
clientMap.set(uri, client);
}
return client;
}
//# sourceMappingURL=mongodb.js.map