MongoDB Lens is an MCP server that provides AI assistants with direct access to MongoDB databases for exploration and analysis. Built with Node.js and the Model Context Protocol SDK, it enables browsing databases and collections, executing queries with filters and projections, running aggregation pipelines, analyzing schemas, managing indexes, and optimizing query performance. The implementation includes specialized tools for inferring collection schemas, explaining query execution plans, and generating recommendations for database optimization, making it valuable for database exploration, performance tuning, and schema design assistance within AI workflows.
No reviews yet. Be the first to review!
Sign in to join the conversation
Add a new MongoDB connection alias.
Execute aggregation pipelines.
Analyze live queries and suggest optimizations.
Automatically infer collection schemas.
Perform multiple operations efficiently (requires confirmation for destructive operations).
Clear memory caches to ensure fresh data.
Find documents with language-specific collation rules.
Compare schemas between two collections.
Connect to a different MongoDB URI.
Connect back to the original MongoDB URI used at startup.
Count documents matching specified criteria.
Create new collections with custom options.
Create a new database with option to switch to it.
Create new indexes for performance optimization.
Create time series collections for temporal data.
Create new database users with specific roles.
Show the current database context.
Delete documents matching specified criteria (requires confirmation).
Extract unique values for any field.
Remove collections from the database (requires confirmation).
Drop a database (requires confirmation).
Remove indexes from collections (requires confirmation).
Remove database users (requires confirmation).
Analyze query execution plans.
Export query results in JSON or CSV format.
Run queries with filters, projections, and sorting.
Generate JSON Schema validators.
Perform geospatial queries with various operators.
Retrieve database or collection statistics.
Manage large files with GridFS buckets.
Insert one or more documents into collections.
Explore collections in the current database.
View all available MongoDB connection aliases.
View all accessible databases.
Rename existing collections (requires confirmation when dropping targets).
View sharding configuration for databases and collections.
Perform full-text search across text-indexed fields.
Execute multiple operations in a single ACID transaction.
Update documents matching specified criteria.
Switch to a specific database context.
Check for data inconsistencies.
Monitor real-time changes to collections.