MongoDB Lens logo

MongoDB Lens

by furey

MongoDB Lens is a local Model Context Protocol (MCP) server that provides full-featured access to MongoDB databases using natural language via LLMs. It allows users to perform queries, run aggregations, optimize performance, and more.

View on GitHub

Last updated: N/A

What is MongoDB Lens?

MongoDB Lens is a local server that acts as an interface between natural language queries (via LLMs) and MongoDB databases. It utilizes the Model Context Protocol (MCP) to enable interaction with MongoDB using natural language, allowing users to perform various database operations without writing complex code.

How to use MongoDB Lens?

To use MongoDB Lens, you need to install it via NPX, Docker, or Node.js from source. Configure it with your MongoDB connection string and set up an MCP client (e.g., Claude Desktop, Cursor). Then, you can use natural language queries to interact with your MongoDB databases through the client.

Key features of MongoDB Lens

  • Natural language querying of MongoDB databases

  • Execution of aggregation pipelines

  • Performance optimization tools

  • Schema analysis and comparison

  • Data export in JSON or CSV format

  • Support for multiple MongoDB connections

  • Confirmation system for destructive operations

  • Extensive customization via JSON configuration file

Use cases of MongoDB Lens

  • Exploring MongoDB data with natural language queries

  • Generating MongoDB queries and aggregations using LLMs

  • Analyzing and optimizing MongoDB schema and query performance

  • Automating database management tasks with natural language commands

  • Integrating MongoDB with LLM-powered applications

  • Rapid prototyping and experimentation with MongoDB queries

FAQ from MongoDB Lens

What is MCP?

Model Context Protocol (MCP) is a protocol that enables communication between language models and external tools or services.

How do I install MongoDB Lens?

You can install MongoDB Lens using NPX, Docker, or Node.js from source. Refer to the Installation section in the README for detailed instructions.

How do I configure MongoDB Lens?

You can configure MongoDB Lens using a JSON configuration file or environment variables. Refer to the Configuration section in the README for details.

What MCP clients are supported?

MongoDB Lens should be usable with any MCP-compatible client. The README provides specific instructions for Claude Desktop and MCP Inspector.

How can I protect my data while using MongoDB Lens?

Consider using read-only user accounts, working with database backups, and being mindful of data flow considerations. MongoDB Lens also includes a confirmation system for destructive operations and allows disabling specific tools.