MCP Directory

MongoDB MCP Server

Let LLMs query, inspect, and manage MongoDB databases through natural language.

Unverified
stdio (local)
No auth
Stale
TypeScript

Add to your client

Copy the config for your MCP client and paste it into its config file.

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

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

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

Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf

Before you start

  • Node.js 18+
  • npx
  • A MongoDB connection URI (or Docker and Docker Compose for the local sandbox)
  • An MCP client such as the Claude Desktop app

About MongoDB MCP Server

MongoDB MCP Server lets LLMs interact directly with MongoDB databases over the Model Context Protocol. It supports collection schema inspection, document querying and filtering, index management, and document operations (insert, update, delete). The connection URI is supplied as a command argument, and the server runs over stdio for use with Claude Desktop and similar MCP clients. A Docker Compose sandbox plus a seed script provide sample Users, Products, and Orders collections for local experimentation.

Tools & capabilities (8)

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.

createIndex

Create a new index.

dropIndex

Remove an index.

indexes

List indexes for a collection.

When to use it

  • Explore available collections and inspect a collection's schema in natural language
  • Run filtered queries such as finding all in-stock electronics under a price threshold
  • Insert, update, or delete individual documents conversationally
  • Inspect, create, and drop indexes to tune query performance

Security notes

The MongoDB connection URI — including username and password — is passed as a plaintext command-line argument in the client config. Store credentials carefully and prefer a least-privilege database user. The server can insert, update, and delete documents and modify indexes, so connecting with write-capable credentials grants the LLM full mutation access to the database.

MongoDB MCP Server FAQ

How do I connect to my MongoDB database?

Add the mongoServers config to your Claude Desktop config file with the command 'npx', and pass 'mongo-mcp' plus your MongoDB connection URI (e.g. mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin) as args.

Can I try it without my own MongoDB server?

Yes. The repo includes a Docker Compose sandbox. Run 'docker-compose up -d' to start MongoDB, then 'npm run seed' to load sample Users, Products, and Orders collections, and point the config at mongodb://root:example@localhost:27017/test?authSource=admin.

What operations can the LLM perform?

It can query and list collections, inspect and manage indexes, and perform single-document insert, update, and delete operations.

Is there an automated install option?

Yes. You can install it for Claude Desktop via Smithery using 'npx -y @smithery/cli install mongo-mcp --client claude'.

Alternatives to MongoDB MCP Server

Compare all alternatives →

Google's official MCP server with prebuilt BigQuery tools, querying datasets via Application Default Credentials.

Verified
stdio (local)
OAuth
Go
10 tools
Updated 15 days agoRepo

Read/write Postgres access plus index tuning, EXPLAIN plans, and database health analysis for AI agents.

Verified
stdio (local)
API key
Python
9 tools
Updated 3 months agoRepo

Official Supabase server: manage tables, run SQL, branches, configs and edge functions from your AI client.

Verified
HTTP (remote)
OAuth
TypeScript
12 tools
Updated 1 month agoRepo