MCP Catalogs
Homemcp-mongo-server screenshot

mcp-mongo-server

by kiliczsh·278·Score 50

An MCP server for MongoDB interaction with schema inference, query capabilities, and configurable read-only mode.

databasedeveloper-toolsai-llm
54
Forks
3
Open issues
3 mo ago
Last commit
2d ago
Indexed

Overview

The MCP MongoDB Server provides a standardized interface for LLMs to interact with MongoDB databases. It offers smart ObjectId handling, read-only mode protection, automatic collection schema detection, and full MongoDB query and aggregation pipeline support. The server allows both read and write operations (when not in read-only mode) and provides collection completions for better LLM integration.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:Enabling AI assistants to query and analyze MongoDB databases
you:Automating database management operations through natural language
you:Allowing LLM applications to access and manipulate data in MongoDB collections
you:Is write operation support available?
you:How does the schema inference work?

When to choose this

Choose this when you need an MCP interface for MongoDB and want fine-grained control over read/write access, especially with its unique ObjectId handling capabilities.

When NOT to choose this

Avoid if you need authentication beyond basic URI connection or require support for non-MongoDB databases.

Tools this server exposes

12 tools extracted from the README
  • query

    Execute MongoDB queries against collections

  • aggregate

    Run MongoDB aggregation pipelines

  • insert

    Insert documents into MongoDB collections

  • update

    Update documents in MongoDB collections

  • list_collections

    List all collections in the database

  • schema_inference

    Infer collection schema from sample documents

  • create_index

    Create indexes on collection fields

  • explain_plan

    Get query execution plan for MongoDB queries

  • count_documents

    Count documents matching a query filter

  • distinct

    Get distinct values from a field in a collection

  • drop_collection

    Remove a collection from the database

  • list_databases

    List all available databases

Comparable tools

mcp-postgres-servermongomcpshell-mcp

Installation

Installation

npx -y mcp-mongo-server mongodb://localhost:27017/database

Usage

# Start server with MongoDB URI
npx -y mcp-mongo-server mongodb://user:password@localhost:27017/database

# Connect in read-only mode
npx -y mcp-mongo-server mongodb://user:password@localhost:27017/database --read-only

Claude Desktop Integration

Add to Claude Desktop config:

{
  "mcpServers": {
    "mongo": {
      "command": "npx",
      "args": ["-y", "mcp-mongo-server", "mongodb://localhost:27017/database"]
    }
  }
}

FAQ

Is write operation support available?
Yes, the server supports insert, update, and index creation operations unless it's running in read-only mode.
How does the schema inference work?
The server automatically detects collection schemas by analyzing document samples in the collection.

On Hacker News

Recent discussion from the developer community.

Compare mcp-mongo-server with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.