MongoDB Official
Official MongoDB integration with Atlas and database operations
What is MongoDB Official?
MongoDB Official is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to official mongodb mcp server provides comprehensive database operations including crud, aggregation, and schema inspection. supports both mongodb atlas cloud deployments and self-hosted mongodb instanc...
The official MongoDB MCP server provides comprehensive database operations including CRUD, aggregation, and schema inspection. Supports both MongoDB Atlas cloud deployments and self-hosted MongoDB instances.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- 28 comprehensive database tools
- CRUD operations support
- Schema inspection and validation
- Aggregation pipeline builder
- Atlas cluster management
- Index management
Use Cases
Maintainer
Works with
Installation
NPM
npm install mongodb-mcp-serverManual Installation
npx mongodb-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Security
Authentication
Performance
Response Metrics
Resource Usage
How to Set Up and Use MongoDB Official
The official MongoDB MCP Server, maintained by the MongoDB team, connects AI assistants to your MongoDB databases and MongoDB Atlas clusters with a comprehensive set of 45+ tools. It supports full CRUD operations, index management, schema inspection, aggregation pipelines, and Atlas-specific features such as cluster creation, performance advisor recommendations, and stream processing — enabling you to query, manage, and analyze MongoDB data entirely through natural language.
Prerequisites
- Node.js v22.13.0 or later
- A MongoDB connection string (for local/self-hosted MongoDB) OR MongoDB Atlas API Service Account credentials (for Atlas management features)
- An MCP-compatible client such as Claude Desktop, Claude Code, VS Code, or Cursor
Choose your connection method
For local or self-hosted MongoDB, you need a connection string. For Atlas management operations (cluster creation, performance advisor), you need Atlas API credentials: a Service Account client ID and client secret.
Set credentials as environment variables
Export your connection string or Atlas credentials. Avoid passing secrets as CLI arguments, which may be visible in process listings.
# For local/self-hosted MongoDB
export MDB_MCP_CONNECTION_STRING="mongodb://localhost:27017/myDatabase"
# For MongoDB Atlas (Service Account)
export MDB_MCP_API_CLIENT_ID="your-service-account-client-id"
export MDB_MCP_API_CLIENT_SECRET="your-service-account-client-secret"
# Optional: restrict to read-only operations
export MDB_MCP_READ_ONLY="true"Add the server to your MCP client configuration
Add mongodb-mcp-server to your claude_desktop_config.json. Use --readOnly for production environments to prevent accidental writes.
Restart your MCP client and connect
Restart Claude Desktop. The server will use the connect tool automatically if a connection string is provided, or prompt you to connect on first use.
Verify the connection by listing databases
Ask your AI assistant to list available databases. This confirms the connection is working and shows what data is accessible.
MongoDB Official Examples
Client configuration
claude_desktop_config.json entry for MongoDB MCP Server with a local connection string and read-only mode.
{
"mcpServers": {
"MongoDB": {
"command": "npx",
"args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
}
}
}
}Prompts to try
Sample prompts covering the range of MongoDB MCP Server capabilities.
- "List all databases and collections in my MongoDB instance"
- "Find all users in the users collection where status is active and age is over 30"
- "Show me the schema of the orders collection"
- "Aggregate sales by region and calculate the total and average revenue for last month"
- "Create an index on the email field of the users collection"
- "Get performance advisor recommendations for my Atlas cluster"
- "Create a new M10 cluster in AWS us-east-1 named staging"Troubleshooting MongoDB Official
Connection refused or authentication failed when connecting to MongoDB
Verify MDB_MCP_CONNECTION_STRING includes the correct host, port, and credentials. For Atlas clusters, use the full connection string from the Atlas UI (Connect > Drivers). Ensure your IP is on the Atlas network access list.
Atlas tools return errors about missing credentials
Atlas management tools (cluster creation, performance advisor) require MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET from an Atlas Service Account, not the database connection string. Create a Service Account in your Atlas project under Access Manager.
Destructive operations (drop, delete) are blocked or require confirmation
This is by design — the server requires explicit confirmation before executing destructive operations. If you want to prevent them entirely, run with --readOnly or set MDB_MCP_READ_ONLY=true.
Frequently Asked Questions about MongoDB Official
What is MongoDB Official?
MongoDB Official is a Model Context Protocol (MCP) server that official mongodb integration with atlas and database operations It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MongoDB Official?
Install via npm with the command: npm install mongodb-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with MongoDB Official?
MongoDB Official works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MongoDB Official free to use?
Yes, MongoDB Official is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
MongoDB Official Alternatives — Similar Databases Servers
Looking for alternatives to MongoDB Official? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MongoDB Official in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MongoDB Official?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.