Skip to main content
Glama

MongoDB MCP Server

mongoClient.test.tsβ€’804 B
import { MongoMemoryServer } from "mongodb-memory-server"; import { MongoConnection } from "@mongo/mongoClient.js"; describe("MongoConnection", () => { let mongod: MongoMemoryServer; let uri: string; beforeAll(async () => { mongod = await MongoMemoryServer.create(); uri = mongod.getUri(); }); afterAll(async () => { await mongod.stop(); }); it("should connect and disconnect without errors", async () => { const connection = new MongoConnection(uri); await expect(connection.connect()).resolves.toBeUndefined(); await expect(connection.disconnect()).resolves.toBeUndefined(); }); it("should throw if getClient is called before connect", () => { const connection = new MongoConnection(uri); expect(() => connection.getClient()).toThrow(); }); });

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/franciscorojas27/McpServerMongodb'

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