MongoDB Lens

MongoDB Lens

Full Featured MCP Server for MongoDB Databases.

192
Stars
25
Forks
20
Releases

Overview

MongoDB Lens is a local MCP server that exposes full-featured access to MongoDB databases via natural language, enabling LLMs to perform queries, run aggregations, optimize performance, and more. It ships with an extensive MCP toolset covering common database tasks (creating connections, querying, inserting, updating, deleting, aggregating, indexing, and more), along with resources and prompts to guide interactions. The server supports multiple MongoDB URIs with aliases in a config file, and can be run via NPX, Docker Hub, or from source. Configuration is flexible: a JSON/JSONC config file (with nested settings for connection options, caching, memory, and security), environment variable overrides, and a config:create script to generate config files. MongoDB Lens creates a per-database metadata collection recording origin, lens version, and startup context. It includes a token-based confirmation workflow for destructive operations, with an option to bypass in controlled environments. The project emphasizes data protection, data-flow considerations, and compatibility with MCP clients like Claude Desktop and MCP Inspector.

Details

Owner
furey
Language
JavaScript
License
MIT License
Updated
2025-12-07

Features

Configurable via JSON/JSONC config file

Extensive customization with optional config, supporting defaults, path overrides, and environment variable overrides.

Multiple MongoDB connections with aliases

Supports multiple URIs defined in config; switch connections via natural language; list-connections shows available aliases.

Extensive MCP toolset for MongoDB operations

A comprehensive library of MCP tools (add-connection-alias, aggregate-data, find-documents, etc.) to manage MongoDB tasks.

New database metadata collection

Inserts a metadata collection into each new database to record origin, lens version, and startup context.

Token-based destructive operation confirmations

Requires a two-step confirmation for potentially destructive actions with expiring tokens.

Memory management and smart caching

Auto GC, memory thresholds, and caching for stats, schemas, indexes, and other data.

Flexible deployment options

Runs via NPX, Docker Hub image, local Node.js installation, or Docker from source.

Data protection and security considerations

Guidance on read-only credentials, backups, data flow, and avoiding transmitting sensitive data to remote LLMs.

Audience

DBAsManage MongoDB access and optimize performance using natural language MCP.
DevelopersIntegrate MCP-powered MongoDB access into applications using natural language prompts.
Data scientistsExplore and analyze MongoDB data with NLP prompts and aggregations.

Tags

mongodblensmcp-servernlpllmdatabasemongodb-lenstoolspromptsresourcessecurityconfig