MongoDB
MongoDB MCP Server
Query, aggregate, and manage MongoDB collections and databases from your AI coding assistant.
Last reviewed Mar 2, 2026
Install
claude mcp add mongodb --transport stdio -- npx -y mongodb-mcp-serverEnvironment variables required:
MONGODB_URI=mongodb://localhost:27017/mydbAvailable tools
| Tool | Description |
|---|---|
| find | Query documents in a collection with filters |
| aggregate | Run aggregation pipeline queries |
| insert | Insert documents into a collection |
| update | Update documents matching a filter |
| list_databases | List all databases on the server |
| list_collections | List collections in a database |
What it does
The MongoDB MCP Server connects your AI coding assistant to a MongoDB instance, providing full CRUD and aggregation capabilities. It can query documents, run aggregation pipelines, inspect database schemas, and manage collections -- giving the assistant deep understanding of your NoSQL data layer.
This server is particularly useful when building applications with MongoDB as the data store. The assistant can explore your document structures, write and test complex aggregation queries, and help you design efficient data models based on your actual data.
Use cases
- Explore collection schemas and document structures to inform application development
- Write and test MongoDB aggregation pipelines with real data
- Query documents to debug data-related issues in your application
- List databases and collections to understand your data organization
- Generate Mongoose schemas or MongoDB driver code based on actual document structures
- Insert test data for development and integration testing
Getting started
- Prepare your MongoDB connection string. For local development, this is typically
mongodb://localhost:27017/mydb. For MongoDB Atlas, use the connection string from your cluster's connect dialog. - Set the
MONGODB_URIenvironment variable to your connection string. - For MongoDB Atlas, ensure your IP address is in the cluster's access list and your database user has the appropriate read/write permissions.
- The server has full read and write access, so use a development database or a restricted user account to limit the scope of operations on production data.
Compatibility
Related MCP servers
AWS MCP Server
Interact with AWS services including S3, Lambda, CloudWatch, and ECS from your AI coding assistant.
Context7 MCP Server
Fetch up-to-date library documentation and code examples directly into your AI coding assistant.
Docker MCP Server
Manage Docker containers, images, and builds directly from your AI coding assistant.