add-connection-aliasLABSCO SUMMARY
Wide enough to administer with, with the destructive half behind a second step.
Two-step confirmation on drops and deletes is what makes a surface this broad usable against something real, and disabling components lets you cut the tool list down to the shape you trust. Worth knowing: every database it creates gets a metadata collection recording its origin, which you can drop once you have added your own.
What it is
A local server with broad coverage of MongoDB: not just find and aggregate, but schema inference, query plans, index management, users, GridFS, transactions, change streams and sharding status.
What you get
- Queries with filters, projections and sorting, counts, distinct values, text search, geospatial queries and collation-aware queries
- Aggregation pipelines, execution plan analysis, and live query-pattern analysis that suggests optimisations
- Inferred collection schemas, schema comparison between two collections, and generated JSON Schema validators
- Writes: insert, update, delete, bulk operations, and multi-operation ACID transactions
- Administration: databases and collections, indexes, users, time-series collections, GridFS buckets, validation and sharding status
- Named connection aliases so you can switch between clusters and come back to the original
- Change streams for watching a collection live, and data export as JSON or CSV
Requirements
Node.js for the npx route, or the published Docker image; source builds are documented too. A MongoDB connection string, supplied at startup or as a named alias. Configuration lives in ~/.mongodb-lens.json and can be overridden by environment variables. Destructive operations - dropping a database, collection, index or user, and deleting documents - require a second confirming call, and individual tools, prompts or resources can be disabled outright.
Setup effort
One command — npx -y mongodb-lens
USE CASES
Understanding a collection nobody documented
Infer the schema from a sample, then compare it against a related collection to see where the two have drifted apart.
Working out why a query is slow
Read the execution plan, analyse the live query patterns for what is actually being asked, then create the index and re-check the plan.
Answering a question the UI makes tedious
Write the aggregation pipeline against the collection and export the result as CSV when it needs to leave the database.
Making several writes that must not half-apply
Run them inside a single transaction rather than as separate calls, so a failure leaves nothing behind.
Moving between environments in one session
Add an alias per cluster, switch to the one you need, and connect back to the original when you are done.
42 tools
Listed in project docs. Your client may show a different list.
aggregate-dataanalyze-query-patternsanalyze-schemabulk-operationsclear-cachecollation-querycompare-schemasconnect-mongodbconnect-originalcount-documentscreate-collectioncreate-databasecreate-indexcreate-timeseriescreate-usercurrent-databasedelete-documentdistinct-valuesdrop-collectiondrop-databasedrop-indexdrop-userexplain-queryexport-datafind-documentsgenerate-schema-validatorgeo-queryget-statsgridfs-operationinsert-documentlist-collectionslist-connectionslist-databasesrename-collectionshard-statustext-searchtransactionupdate-documentuse-databasevalidate-collectionwatch-changesBEFORE YOU INSTALL
What to know first
Tools you get
42 tools named in the project's documentation.
Requires
npx on PATH
INSTALLATION
Connect your client
Server setup
npx -y mongodb-lensMCP Clients
Claude Desktop — npx
{
"mcpServers": {
"mongodb-lens": {
"command": "<YOUR_PATH_TO_NPX>",
"args": [
"-y",
"mongodb-lens@latest",
"mongodb://<YOUR_CONNECTION_STRING>"
]
}
}
}<YOUR_PATH_TO_NPX> is the full path to your npx binary, and mongodb://<YOUR_CONNECTION_STRING> is your MongoDB connection string (or drop it to use mongodb://localhost:27017).
Claude Desktop — Docker Hub
{
"mcpServers": {
"mongodb-lens": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"--pull=always",
"furey/mongodb-lens",
"mongodb://<YOUR_CONNECTION_STRING>"
]
}
}
}mongodb://<YOUR_CONNECTION_STRING> is your MongoDB connection string, or drop it to use mongodb://localhost:27017.
Claude Desktop — Node.js
git clone https://github.com/furey/mongodb-lens.git
cd mongodb-lens
npm ciAdd this block to your Claude Desktop configuration:
{
"mcpServers": {
"mongodb-lens": {
"command": "<YOUR_PATH_TO_NODE>",
"args": [
"<YOUR_PATH_TO_MONGODB_LENS>",
"mongodb://<YOUR_CONNECTION_STRING>"
]
}
}
}<YOUR_PATH_TO_NODE> is the full path to your node binary, and <YOUR_PATH_TO_MONGODB_LENS> is that file in your clone, and mongodb://<YOUR_CONNECTION_STRING> is your connection string (or drop it for mongodb://localhost:27017).
Claude Desktop — local Docker
git clone https://github.com/furey/mongodb-lens.git
cd mongodb-lens
docker build -t mongodb-lens .Add this block to your Claude Desktop configuration:
{
"mcpServers": {
"mongodb-lens": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"mongodb-lens",
"mongodb://<YOUR_CONNECTION_STRING>"
]
}
}
}mongodb://<YOUR_CONNECTION_STRING> is your MongoDB connection string, or drop it to use mongodb://localhost:27017.
MCP Inspector
npx -y @modelcontextprotocol/inspector npx -y mongodb-lens@latest