The MongoDB MCP Server is the official implementation of the Model Context Protocol (MCP) designed to enable AI agents and large language models (LLMs) to interact with MongoDB databases using natural language. It connects various MongoDB deployments (Atlas, Community Edition, Enterprise Advanced) to MCP-supported AI clients such as Cursor, GitHub Copilot, and Claude Desktop. The server provides a rich set of tools for data exploration, database operations (including querying, indexing, and CRUD operations), Atlas management tasks, and performance optimization via integrated Performance Advisor tools. The current stable version is 1.9.0, with a cadence of frequent pre-releases and regular minor version updates. Key differentiators include its seamless integration with MongoDB Atlas, support for local Atlas deployments (requiring Docker), a simplified setup utility (`npx mongodb-mcp-server setup`), and advanced features like automatic vector embedding generation when configured with a Voyage AI API key.
npm install mongodb-mcp-serverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically start the MongoDB MCP Server, configure it with a connection string, and handle graceful shutdowns. It also mentions the easier CLI-based setup.
Review the official V2 release notes and migration guide upon release. Adjust programmatic imports and API calls as specified.
Ensure `MONGODB_URI` environment variable is set, or provide Atlas API credentials (`ATLAS_CLIENT_ID`, `ATLAS_PRIVATE_KEY`). For local Atlas tools, ensure Docker is installed and running.
Set the `readOnly` configuration option to `true` when starting the server (`--read-only` CLI flag or `readOnly: true` in config). Implement strict MongoDB user permissions for the provided connection string to limit AI agent access.
Configure the `maxDocumentsPerQuery` option to limit the number of documents returned by a single query. Utilize the Performance Advisor tools exposed by the MCP server to identify and optimize slow queries and improve indexing.
Verify the `MONGODB_URI` environment variable or connection string provided in the server configuration. Ensure Atlas API credentials (client ID and private key) are correctly set up and have the necessary permissions. Test the connection string independently using `mongosh`.
Ensure Docker Desktop is installed and running on your system. Check Docker installation with `docker info`.
If write operations are intended, ensure the server is not started with the `readOnly: true` option. Verify the MongoDB user associated with the connection string has the required write roles (e.g., `readWrite` on the target database).
No dependency data recorded yet.