Skip to main content
Glama

MCP Database Server

index.ts682 B
import { MongoClient, Db } from "mongodb"; export class MongoDBConnection { private client: MongoClient | null = null; private db: Db | null = null; async connect(databaseUrl: string) { try { this.client = new MongoClient(databaseUrl); await this.client.connect(); this.db = this.client.db(); return this.db; } catch (error) { console.error("MongoDB connection error:", error); throw error; } } async close() { await this.client?.close(); } getClient(): MongoClient | null { return this.client; } getDb(): Db | null { return this.db; } } export const mongodbConnection = new MongoDBConnection();

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/manpreet2000/mcp-database-server'

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