Skip to main content
Glama

Facebook Ads Management Control Panel

by codprocess
database.js1.11 kB
/** * MongoDB Atlas connection configuration */ const mongoose = require('mongoose'); const config = require('./index'); const logger = require('../utils/logger'); /** * Connect to MongoDB Atlas * Uses connection string from environment variables * Implements retry logic for connection failures */ const connectDB = async () => { try { const conn = await mongoose.connect(config.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true, // These options are no longer needed in newer Mongoose versions but kept for compatibility useCreateIndex: true, useFindAndModify: false, // Connection pool size poolSize: 10, // Retry connection on failure serverSelectionTimeoutMS: 5000, socketTimeoutMS: 45000, }); logger.info(`MongoDB Connected: ${conn.connection.host}`); return conn; } catch (err) { logger.error(`Error connecting to MongoDB: ${err.message}`); // Retry connection after delay logger.info('Retrying connection in 5 seconds...'); setTimeout(connectDB, 5000); } }; module.exports = connectDB;

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/codprocess/facebook-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server