MongoDB Database Tools
๐ ๐ - MongoDB Lens: Full Featured MCP Server for MongoDB Databases
What is MongoDB Database Tools?
MongoDB Database Tools is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ ๐ - mongodb lens: full featured mcp server for mongodb databases
๐ ๐ - MongoDB Lens: Full Featured MCP Server for MongoDB Databases
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- ๐ ๐ - MongoDB Lens: Full Featured MCP Server for MongoDB Dat
Use Cases
Maintainer
Works with
Installation
NPM
npx -y mongodb-lensManual Installation
npx -y mongodb-lensConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MongoDB Database Tools
MongoDB Lens is a full-featured MCP server that gives AI assistants direct, natural-language access to MongoDB databases through more than 60 tools covering queries, aggregations, index management, schema analysis, user administration, and data export. It connects to any MongoDB instance โ local, Atlas, or remote โ via a standard connection string, and includes safety features like two-step confirmation tokens for destructive operations so you can safely let an AI agent explore and manipulate your data. It also exposes 12 read-only resources (schemas, stats, validation rules) and 14 guided prompts for query building and security audits.
Prerequisites
- Node.js 18 or higher installed (for npx usage)
- A running MongoDB instance (local on port 27017, MongoDB Atlas, or any remote host)
- The MongoDB connection string for your target database
- An MCP-compatible client (Claude Desktop, Claude Code, or similar)
Test the server with npx
Run MongoDB Lens directly with npx to verify it connects to your MongoDB instance before adding it to your client config. Pass your connection string as the first argument.
npx -y mongodb-lens mongodb://localhost:27017Add the server to your MCP client configuration
Open your Claude Desktop config file and add the mongodb-lens entry. Pass your MongoDB connection string as the argument. For authenticated connections, include credentials in the URI.
{
"mcpServers": {
"mongodb-lens": {
"command": "npx",
"args": ["-y", "mongodb-lens", "mongodb://localhost:27017"]
}
}
}Configure for authenticated MongoDB instances
For MongoDB Atlas or password-protected instances, include your credentials in the connection string. Use the CONFIG_MONGO_URI environment variable as an alternative to keep credentials out of args.
{
"mcpServers": {
"mongodb-lens": {
"command": "npx",
"args": ["-y", "mongodb-lens"],
"env": {
"CONFIG_MONGO_URI": "mongodb+srv://username:[email protected]/mydb"
}
}
}
}Restart your MCP client and verify tools
Restart Claude Desktop. The 60+ MongoDB tools should appear, including find-documents, aggregate-data, create-index, and schema analysis tools. Try listing databases to confirm connectivity.
Understand destructive operation safety
Operations like drop-database or delete-document require two-step confirmation. The server returns a 4-digit token that expires in 5 minutes โ resubmit the command with the token to execute. To disable this for automation, set CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS=true.
MongoDB Database Tools Examples
Client configuration
Claude Desktop configuration for MongoDB Lens connecting to a local MongoDB instance.
{
"mcpServers": {
"mongodb-lens": {
"command": "npx",
"args": ["-y", "mongodb-lens", "mongodb://localhost:27017"],
"env": {
"CONFIG_LOG_LEVEL": "info"
}
}
}
}Prompts to try
Example prompts that use MongoDB Lens tools for querying, analysis, and database management.
- "Show me all databases and their collection counts"
- "Find the top 5 documents in the orders collection sorted by total_amount descending"
- "What indexes exist on the users collection and are any of them unused?"
- "Run an aggregation to count orders per customer in the last 30 days"
- "Show me the schema of the products collection with field types and sample values"
- "Explain the query plan for: find users where email contains '@gmail.com'"Troubleshooting MongoDB Database Tools
Connection refused when connecting to local MongoDB
Verify MongoDB is running with `mongosh --eval 'db.runCommand({ping:1})'`. The default port is 27017. If using Docker, ensure the container port is mapped to the host and use `host.docker.internal` instead of `localhost` in the connection string.
Authentication failed for Atlas or remote connections
URL-encode special characters in passwords within the connection string. Ensure the database user has appropriate roles. For Atlas, verify your IP address is whitelisted in the Network Access settings.
Destructive operations never execute even after confirming
The confirmation token expires after 5 minutes. Re-request the operation to get a fresh token. If you need to disable the two-step flow entirely, set CONFIG_DISABLE_DESTRUCTIVE_OPERATION_TOKENS=true in your env block.
Frequently Asked Questions about MongoDB Database Tools
What is MongoDB Database Tools?
MongoDB Database Tools is a Model Context Protocol (MCP) server that ๐ ๐ - mongodb lens: full featured mcp server for mongodb databases It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MongoDB Database Tools?
Install via npm with the command: npx -y mongodb-lens. 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 Database Tools?
MongoDB Database Tools works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MongoDB Database Tools free to use?
Yes, MongoDB Database Tools is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MongoDB Database Tools Alternatives โ Similar Databases Servers
Looking for alternatives to MongoDB Database Tools? 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 Database Tools 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 Database Tools?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.