mcpField
πŸ—„
πŸ—„οΈ MongoDB MCP Server for LLMS

πŸ—„οΈ MongoDB MCP Server for LLMS

Local
github.com/QuantGeekDevDatabases176Updated 85w ago

About πŸ—„οΈ MongoDB MCP Server for LLMS

MongoDB MCP Server for LLMS is an MCP server that lets LLMs work directly with MongoDB databases. It supports querying collections, inspecting schemas and managing data through natural language, aimed at developers who want AI-driven MongoDB access.

Key features

  1. 01Collection schema inspection
  2. 02Document querying and filtering
  3. 03Index management
  4. 04Insert, update and delete operations

Use cases

  1. 01Ask an AI assistant to inspect collection structures
  2. 02Try MongoDB operations in a local sandbox
  3. 03Create or drop indexes on collections

MCP support

This project is an MCP server that exposes tools such as find, listCollections, insertOne, updateOne, deleteOne, createIndex, dropIndex and indexes to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json Β· Universal config
{
"mcpServers": {
"mongo": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
Run commandnpx -y @smithery/cli

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@smithery/cli

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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

https://github.com/user-attachments/assets/2389bf23-a10d-49f9-bca9-2b39a1ebe654

πŸš€ 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 [email protected]"
"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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.