Back
Marketplace/MongoDB

TL;DR

MongoDB is a Databases MCP server that lets Claude Code, Cursor, Windsurf and any MCP-compatible AI agent mongoDB Atlas database operations. Install in 1 minute with mcpizy install mongodb.

🍃

MongoDB

Verified 7 tools

Databases

Last updated May 30, 2026 · By MCPizy team

MongoDB Atlas database operations

Official homepage

Install MongoDB

Via MCPizy CLI (recommended):
mcpizy install mongodb
Or run directly:
npx -y mongodb-mcp-server
View on GitHub

Tools exposed

7 tools available
find

Run a find query on a collection

Inputs

  • databasestringrequired
  • collectionstringrequired
  • filterobjectoptional
aggregate

Run an aggregation pipeline on a collection

Inputs

  • databasestringrequired
  • collectionstringrequired
  • pipelineobject[]required
insert_many

Insert multiple documents into a collection

Inputs

  • databasestringrequired
  • collectionstringrequired
  • documentsobject[]required
update_many

Update documents that match a filter

Inputs

  • filterobjectrequired
  • updateobjectrequired
delete_many

Delete documents that match a filter

Inputs

  • filterobjectrequired
list_databases

List all databases on the cluster

list_collections

List collections in a database

Inputs

  • databasestringrequired

Configuration

Works identically across clients. Only the config file path differs.

Claude Code~/.claude.json
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "${MDB_MCP_CONNECTION_STRING}"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb+srv://user:[email protected]"
      }
    }
  }
}
Cursor.cursor/mcp.json
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "${MDB_MCP_CONNECTION_STRING}"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb+srv://user:[email protected]"
      }
    }
  }
}
Windsurf~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server",
        "--connectionString",
        "${MDB_MCP_CONNECTION_STRING}"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb+srv://user:[email protected]"
      }
    }
  }
}

Authentication setup

  1. 1

    Create a database user with readWrite access

    Get it MDB_MCP_CONNECTION_STRING
  2. 2

    Add your IP (or 0.0.0.0/0 for dev) to the Network Access allowlist

    Get it

What you can do with MongoDB MCP

Paste any of these prompts into Claude Code, Cursor or another MCP-compatible client.

“Show me the 10 most recent documents in the `users` collection”

Uses: find

“How many orders were placed this month, grouped by status?”

Uses: aggregate

“Delete all test documents where `env = 'staging'`”

Uses: delete_many

“List every collection in the `production` database”

Uses: list_collections

Why MongoDB MCP matters

MongoDB MCP exposes the MongoDB driver as agent tools: `list_databases`, `list_collections`, `find`, `aggregate`, `insert_one`, `update_one`, `delete_one`, `get_schema`. The official MCP ships with Atlas (MongoDB's managed offering) integration too, which adds tools like `list_clusters` and `get_metrics`. Authentication is a connection string; for Atlas, an API key + private key pair.

We use MongoDB MCP for three things. First, document-shape exploration: when joining a project with an unfamiliar MongoDB, `get_schema` (which samples documents to infer shape) is faster than the dashboard's schema viewer. Second, ad-hoc analytics: `aggregate` with a multi-stage pipeline ("group by status, count, sort desc") works the same as the shell and the agent reasons about pipeline stages naturally. Third, data fixes: a customer reports a corrupted document, the agent finds it via `find` with a precise filter, runs `update_one` with explicit fields. Token cost: schema inference on a collection with mixed shapes runs ~3-5k tokens; aggregation results are bounded by your `$limit` stage.

Compared to Postgres MCP, MongoDB wins for document-first workloads (event streams, flexible-schema product data) and loses for relational queries. The aggregation pipeline is more powerful than SQL for some patterns (window-like operations, array unwinding) and harder for LLMs to write correctly than SQL. The honest trade-off: MongoDB's flexible schema is a double-edged sword for AI agents — `find` returns documents with arbitrary shape, and the agent often can't predict which fields will be present.

Common pitfalls

Connection strings with `+srv` prefix (Atlas standard) require DNS resolution that some MCP runtimes (especially containerised) can't do by default. If the connection hangs for 10+ seconds before failing, swap to a non-SRV connection string explicitly listing the hosts.

`find` without a projection returns the full document, which on collections with large embedded arrays can blow past the model's context. Always pass a projection or pair `find` with `$limit` + `$project` via `aggregate`.

`update_one` with `$set` versus full-document replace is a common LLM mistake — the agent will sometimes write the entire new document into `update_one` instead of using `$set`, which silently overwrites all unspecified fields. Pin this in the system prompt.

Atlas cluster connection limits are per-tier — an M10 has ~1,500 max connections; an agent that doesn't close idle connections will saturate. Use a connection pool wrapper and explicit timeouts.

How MongoDB MCP compares

Honest pros/cons against the closest databases MCP servers.

ServerStrengthsTrade-offs
Postgres MCPBetter for relational workloads, stronger schema constraintsNo flexible schema, weaker for nested/array-heavy data
Firestore MCP (community)Realtime sync, integrated with Firebase AuthSmaller MCP community, GCP-locked
DynamoDB MCP (community)Massive scale, predictable cost on AWSQuery model is restrictive — requires schema upfront

Works with

Claude Code
Claude Desktop
Cursor
Windsurf
VS Code + Copilot
Any MCP Client

More Databases MCPs

⚡

DynamoDB

AWS DynamoDB NoSQL database operations

🐬

MariaDB

MariaDB relational database server

🪳

CockroachDB

Distributed SQL database for cloud apps

🗃️

SQLite

Local SQLite database access and management

Alternatives to MongoDB

If MongoDB doesn't fit your stack, these Databases MCP servers solve similar problems.

🔵

Neo4j

Graph database queries

🔍

Elasticsearch

Full-text search and analytics engine

🎯

Qdrant

Vector similarity search engine

Key Takeaways

  • MongoDB exposes 7 tools for databases workflows in Claude Code, Cursor and Windsurf.
  • Authentication: 2 steps (MDB_MCP_CONNECTION_STRING).
  • Install in 1 command: mcpizy install mongodb — config written to your client automatically.
  • Free and open source (GitHub source linked above) — verified compatible with every MCP client (Claude Code, Claude Desktop, Cursor, Windsurf, VS Code + Copilot).
  • Best use case: "Show me the 10 most recent documents in the `users` collection".

Frequently asked questions

What is the MongoDB MCP server?

The MongoDB MCP server is an Databases Model Context Protocol server that lets Claude Code, Cursor, Windsurf, VS Code with Copilot, and other MCP-compatible AI agents mongoDB Atlas database operations. It exposes MongoDB's capabilities as tools the AI can call directly from your editor or CLI.

How do I install MongoDB MCP with Claude Code?

The fastest way is the MCPizy CLI: run `mcpizy install mongodb` and MCPizy will add the server to your `.claude.json` automatically. You can also install it manually by adding an entry under `mcpServers` in `.claude.json` with the command `npx -y mongodb-mcp-server` and restarting Claude Code.

Is MongoDB MCP free?

Yes. The MongoDB MCP server is free and open source (see the GitHub repository linked on this page). You may still need a MongoDB account or API key to connect the server to the underlying service, but the MCP layer itself has no MCPizy subscription cost.

Does MongoDB MCP work with Cursor and Windsurf?

Yes. Any MCP-compatible client works — including Claude Code, Claude Desktop, Cursor (via `.cursor/mcp.json`), Windsurf, VS Code with Copilot Chat, and custom agents built on the MCP SDK. The same install command targets all of them; only the config file path differs.

What can I do with MongoDB MCP?

Once installed, your AI agent can mongoDB Atlas database operations directly inside your conversation. Typical use cases include asking Claude Code or Cursor to run MongoDB operations, inspect results, chain MongoDB with other MCP servers (see our Workflow Recipes), and automate repetitive databases tasks without leaving your editor.

Manage all your MCPs in one place

Monitor usage, track costs, and discover new MCPs.

Get Started Free