{"name":"MongoDB MCP Server: Connect to MongoDB and Atlas with Model Context Protocol","description":"The MongoDB MCP Server is a Model Context Protocol server designed to facilitate interaction with MongoDB databases and MongoDB Atlas clusters. It provides a standardized way for clients to access and manage MongoDB data and Atlas resources, supporting a wide range of database and Atlas-specific tools.","github":"https://github.com/mongodb-js/mongodb-mcp-server","url":"https://osrepos.com/repo/mongodb-js-mongodb-mcp-server","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/mongodb-js-mongodb-mcp-server","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/mongodb-js-mongodb-mcp-server.md","json":"https://osrepos.com/repo/mongodb-js-mongodb-mcp-server.json","topics":["mcp","mcp-server","mongodb","mongodb-atlas","typescript","database","cloud","developer-tools"],"keywords":["mcp","mcp-server","mongodb","mongodb-atlas","typescript","database","cloud","developer-tools"],"stars":null,"summary":"The MongoDB MCP Server is a Model Context Protocol server designed to facilitate interaction with MongoDB databases and MongoDB Atlas clusters. It provides a standardized way for clients to access and manage MongoDB data and Atlas resources, supporting a wide range of database and Atlas-specific tools.","content":"## Introduction\n\nThe `mongodb-mcp-server` is an essential tool for developers looking to integrate MongoDB and MongoDB Atlas with Model Context Protocol (MCP) compatible clients. This server acts as a bridge, enabling various developer tools and AI assistants to interact seamlessly with your MongoDB databases and Atlas clusters. By adhering to the MCP standard, it provides a unified and efficient way to perform database operations, manage Atlas resources, and leverage MongoDB Assistant's knowledge base.\n\n## Installation\n\nGetting started with the MongoDB MCP Server is straightforward, requiring Node.js (version 20.19.0+, 22.12.0+, or 23+) and either a MongoDB connection string or Atlas API credentials. For enhanced security, it is highly recommended to use environment variables for sensitive information.\n\n### Prerequisites\n\n*   **Node.js**: Version 20.19.0 or higher, or 22.12.0 or higher if using Node.js v22, otherwise any version 23+.\n*   **Credentials**: A MongoDB connection string or Atlas API credentials. Service Account Atlas API credentials are required for Atlas tools.\n\n### Quick Start with `npx`\n\nThe simplest way to run the server is using `npx`.\n\nbash\nnpx -y mongodb-mcp-server@latest --readOnly\n\n\nThis command starts the server in read-only mode, which is recommended for initial setup and security. You will need to configure your connection string or Atlas API credentials via environment variables or a configuration file.\n\n### Docker Installation\n\nFor an isolated environment without a local Node.js installation, you can run the server using Docker.\n\nbash\ndocker run --rm -i \\\n  -e MDB_MCP_CONNECTION_STRING=\"mongodb+srv://username:password@cluster.mongodb.net/myDatabase\" \\\n  -e MDB_MCP_READ_ONLY=\"true\" \\\n  mongodb/mongodb-mcp-server:latest\n\n\n### Client-Specific Configuration\n\nThe MongoDB MCP Server integrates with various clients. Refer to their respective documentation for specific configuration details:\n\n*   **VSCode**: [https://code.visualstudio.com/docs/copilot/chat/mcp-servers](https://code.visualstudio.com/docs/copilot/chat/mcp-servers){:target=\"_blank\"}\n*   **Cursor**: [https://docs.cursor.com/context/model-context-protocol](https://docs.cursor.com/context/model-context-protocol){:target=\"_blank\"}\n*   **Copilot CLI**: [https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli){:target=\"_blank\"}\n*   **OpenCode**: [https://opencode.ai/docs/mcp-servers/](https://opencode.ai/docs/mcp-servers/){:target=\"_blank\"}\n\n## Examples\n\nHere are common configuration examples for integrating the MongoDB MCP Server with MCP clients, typically within a client's `mcpServers` configuration.\n\n### Using a MongoDB Connection String (via Environment Variable)\n\n\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongodb-mcp-server@latest\", \"--readOnly\"],\n      \"env\": {\n        \"MDB_MCP_CONNECTION_STRING\": \"mongodb://localhost:27017/myDatabase\"\n      }\n    }\n  }\n}\n\n\n### Using Atlas API Credentials (via Environment Variables)\n\n\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongodb-mcp-server@latest\", \"--readOnly\"],\n      \"env\": {\n        \"MDB_MCP_API_CLIENT_ID\": \"your-atlas-service-accounts-client-id\",\n        \"MDB_MCP_API_CLIENT_SECRET\": \"your-atlas-service-accounts-client-secret\"\n      }\n    }\n  }\n}\n\n\n## Why Use It\n\nThe MongoDB MCP Server offers significant advantages for developers working with MongoDB and Atlas:\n\n*   **Unified Access**: Provides a single, standardized Model Context Protocol interface for interacting with both MongoDB databases and MongoDB Atlas clusters, simplifying integration with various developer tools.\n*   **Rich Toolset**: Access a comprehensive suite of tools for database operations (e.g., `find`, `aggregate`, `insert-many`), Atlas management (e.g., `atlas-list-clusters`, `atlas-create-db-user`, `atlas-streams-build`), and MongoDB Assistant knowledge base searches.\n*   **Enhanced Security**: Supports read-only mode to prevent unintended modifications, index check to enforce query optimization, and confirmation for destructive operations. It strongly recommends using environment variables for sensitive credentials, improving security posture.\n*   **Flexible Deployment**: Can be run locally via `npx`, in Docker containers, or deployed on public clouds like Azure, offering adaptability to different development and production environments.\n*   **Developer Productivity**: Streamlines workflows by allowing developers to manage and query MongoDB resources directly from their preferred MCP-compatible IDEs or CLIs, reducing context switching and accelerating development.\n\n## Links\n\n*   **GitHub Repository**: [https://github.com/mongodb-js/mongodb-mcp-server](https://github.com/mongodb-js/mongodb-mcp-server){:target=\"_blank\"}\n*   **Model Context Protocol**: [https://modelcontextprotocol.io/](https://modelcontextprotocol.io/){:target=\"_blank\"}\n*   **MongoDB Atlas Documentation**: [https://www.mongodb.com/docs/atlas/](https://www.mongodb.com/docs/atlas/){:target=\"_blank\"}","metrics":{"detailViews":2,"githubClicks":4},"dates":{"published":null,"modified":"2026-05-05T11:07:38.000Z"}}