MCP Directory

How to add MongoDB MCP Server to Claude Desktop

Let LLMs query, inspect, and manage MongoDB databases through natural language. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.

Last updated June 14, 2026 ยท 173โ˜… ยท stdio ยท no auth

Claude Desktop config for MongoDB MCP Server

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

Setup steps

  1. 1Open Claude Desktop โ†’ Settings โ†’ Developer โ†’ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
  2. 2Paste the MongoDB MCP Server config below under the top-level "mcpServers" key.
  3. 3Fill in any placeholder secrets (API keys, paths) in the snippet.
  4. 4Save the file, then fully quit and reopen Claude Desktop.
  5. 5Open a chat and confirm MongoDB MCP Server's tools appear under the ๐Ÿ”Œ tools menu.

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

What MongoDB MCP Server can do in Claude Desktop

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.

Security

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 + Claude Desktop FAQ

Where is the Claude Desktop config file?

Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the MongoDB MCP Server config there under the "mcpServers" key and restart the client.

Is MongoDB MCP Server safe to use with Claude Desktop?

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.

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.

View repo Full MongoDB MCP Server page