mongo-mcp

MCP.Pizza Chef: QuantGeekDev

Eight tools handle the basics: list the collections, search documents with a filter, add one document, change one document, remove one document, and create, list or drop an index. The advertised structure-inspection feature never made it in โ€” that code exists but no tool uses it, so asking to see a collection's shape will not work. Your database username and password go straight into the config file, and there is no read-only setting.

Unmaintained ยท no code changes since March 2025
Data

Use This MCP server To

Find every customer record in a given city See which collections exist in my database Look up a single order by its ID Add one new record without opening a database tool Check which indexes a collection already has

README

๐Ÿ—„๏ธ MongoDB MCP Server for LLMS

Node.js 18+ License: MIT smithery badge

A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.

โœจ Features

  • ๐Ÿ” Collection schema inspection
  • ๐Ÿ“Š Document querying and filtering
  • ๐Ÿ“ˆ Index management
  • ๐Ÿ“ Document operations (insert, update, delete)

Demo Video

mongo-mcp-demo-gh.mp4

๐Ÿš€ Quick Start

To get started, find your mongodb connection url and add this configuration to your Claude Desktop config file:

MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "mongo-mcp",
        "mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
      ]
    }
  }
}

Installing via Smithery

To install MongoDB MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mongo-mcp --client claude

Prerequisites

  • Node.js 18+
  • npx
  • Docker and Docker Compose (for local sandbox testing only)
  • MCP Client (Claude Desktop App for example)

Test Sandbox Setup

If you don't have a mongo db server to connect to and want to create a sample sandbox, follow these steps

  1. Start MongoDB using Docker Compose:
docker-compose up -d
  1. Seed the database with test data:
npm run seed

Configure Claude Desktop

Add this configuration to your Claude Desktop config file:

MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

Local Development Mode:
{
  "mcpServers": {
    "mongodb": {
      "command": "node",
      "args": [
        "dist/index.js",
        "mongodb://root:example@localhost:27017/test?authSource=admin"
      ]
    }
  }
}

Test Sandbox Data Structure

The seed script creates three collections with sample data:

Users
  • Personal info (name, email, age)
  • Nested address with coordinates
  • Arrays of interests
  • Membership dates
Products
  • Product details (name, SKU, category)
  • Nested specifications
  • Price and inventory info
  • Tags and ratings
Orders
  • Order details with items
  • User references
  • Shipping and payment info
  • Status tracking

๐ŸŽฏ Example Prompts

Try these prompts with Claude to explore the functionality:

Basic Operations

"What collections are available in the database?"
"Show me the schema for the users collection"
"Find all users in San Francisco"

Advanced Queries

"Find all electronics products that are in stock and cost less than $1000"
"Show me all orders from the user john@example.com"
"List the products with ratings above 4.5"

Index Management

"What indexes exist on the users collection?"
"Create an index on the products collection for the 'category' field"
"List all indexes across all collections"

Document Operations

"Insert a new product with name 'Gaming Laptop' in the products collection"
"Update the status of order with ID X to 'shipped'"
"Find and delete all products that are out of stock"

๐Ÿ“ Available Tools

The server provides these tools for database interaction:

Query Tools

  • find: Query documents with filtering and projection
  • listCollections: List available collections
  • insertOne: Insert a single document
  • updateOne: Update a single document
  • deleteOne: Delete a single document

Index Tools

  • createIndex: Create a new index
  • dropIndex: Remove an index
  • indexes: List indexes for a collection

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

mongo-mcp FAQ

Do I need a key or a paid account?
Neither, but you do paste your database username and password into the config as part of the connection address. Treat that file as sensitive.
Can it wipe out a lot of my data at once?
Not in one call, since the delete tool removes a single record at a time. There is still no confirmation and no read-only mode, so a sloppy filter deletes the wrong record.
Can it show me how a collection is structured?
No, despite that being listed as a feature. The listing tool returns collection names only, and the structure-detection code is never connected to a tool.
Can it update or delete many records in one go?
No. Adding, changing and removing each act on exactly one record per call, so a request like 'delete everything out of stock' will not do what you expect.
How hard is setup?
A short config block in Claude Desktop containing your connection address, or a single Smithery install command. You need Node installed first.
Which apps does it work in?
Claude Desktop is the documented one, and any app that accepts a local server config works the same way.
Is it still maintained?
There is no sign of it. The code has not changed since March 2025, roughly seventeen months ago.