MCP Directory

How to add MongoDB MCP Server to Windsurf

Let LLMs query, inspect, and manage MongoDB databases through natural language. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.

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

Windsurf 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 Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
  2. 2Paste the MongoDB MCP Server config below.
  3. 3Fill in placeholder secrets, then save.
  4. 4Click Refresh in the MCP panel.
  5. 5MongoDB MCP Server's tools become available to Cascade.

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 Windsurf

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

Where is the Windsurf config file?

Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_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 Windsurf?

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