MCP Directory

How to add MongoDB MCP Server to Cursor

Let LLMs query, inspect, and manage MongoDB databases through natural language. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 14, 2026 · 173 · stdio · no auth

Cursor 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 Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the MongoDB MCP Server config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of MongoDB MCP Server's tools to confirm it's connected.

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 Cursor

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 + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the MongoDB MCP Server config there under the "mcpServers" key and restart the client.

Is MongoDB MCP Server safe to use with Cursor?

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