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.
Databases
MongoDB Atlas database operations
Official homepagemcpizy install mongodbnpx -y mongodb-mcp-serverfindRun a find query on a collection
Inputs
databasestringrequiredcollectionstringrequiredfilterobjectoptionalaggregateRun an aggregation pipeline on a collection
Inputs
databasestringrequiredcollectionstringrequiredpipelineobject[]requiredinsert_manyInsert multiple documents into a collection
Inputs
databasestringrequiredcollectionstringrequireddocumentsobject[]requiredupdate_manyUpdate documents that match a filter
Inputs
filterobjectrequiredupdateobjectrequireddelete_manyDelete documents that match a filter
Inputs
filterobjectrequiredlist_databasesList all databases on the cluster
list_collectionsList collections in a database
Inputs
databasestringrequiredWorks identically across clients. Only the config file path differs.
~/.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/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]"
}
}
}
}~/.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]"
}
}
}
}Create a database user with readWrite access
MDB_MCP_CONNECTION_STRINGAdd your IP (or 0.0.0.0/0 for dev) to the Network Access allowlist
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
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.
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.
Honest pros/cons against the closest databases MCP servers.
| Server | Strengths | Trade-offs |
|---|---|---|
| Postgres MCP | Better for relational workloads, stronger schema constraints | No flexible schema, weaker for nested/array-heavy data |
| Firestore MCP (community) | Realtime sync, integrated with Firebase Auth | Smaller MCP community, GCP-locked |
| DynamoDB MCP (community) | Massive scale, predictable cost on AWS | Query model is restrictive — requires schema upfront |
If MongoDB doesn't fit your stack, these Databases MCP servers solve similar problems.
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.
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.
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.
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.
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.