MCP server · MongoDB
MongoDB MCP Server
Pick it for MongoDB or Atlas queries; enable the documented read-only mode for exploration.
Tools: 27, ~14,069 tokens of tool definitions loaded into the model's context (default config, dummy connection string; measured 2026-10-27, v3.1.0). Compare all servers →
All 27 tools, by token cost
- export2,860
- explain2,846
- aggregate2,386
- create-index2,085
- find411
- search-knowledge273
- aggregate-db249
- update-many245
- insert-many204
- drop-index200
- connect194
- collection-schema190
- count184
- mongodb-logs178
- rename-collection173
- delete-many172
- drop-collection140
- create-collection138
- collection-indexes125
- collection-storage-size125
- db-stats116
- drop-database116
- list-collections112
- list-databases101
- disconnect98
- list-knowledge-sources76
- list-connections72
Same server, other documented flags (measured 2026-10-27):
--readOnly(read-only): 18 tools, ~10,596 tokens (25% less than the default)
Install
`npx -y mongodb-mcp-server` with env vars from README (supports --readOnly). Official install docs ↗
Credentials: MongoDB connection string, or Atlas API client ID/secret.
What it can access
Runs queries/admin ops on a MongoDB database or Atlas; read-only mode documented.
Minimal safe setup
- Run with
--readOnly(only read, connect and metadata tools are registered) and disable whole categories with--disabledTools, e.g.atlas. Pass the connection string via MDB_MCP_CONNECTION_STRING, not a CLI argument, which shows up in process lists. source ↗ - For Atlas, prefer project-level roles: Project Read Only to view clusters/databases; avoid Organization Owner. Destructive tools (drop-database, delete-many, ...) ask for confirmation by default if your client supports elicitation. source ↗
Common setup errors
- Server fails on older Node.
- Requires Node.js 22.13.0 or later; Node 20 support is deprecated. source ↗
- Atlas tools are missing.
- Atlas tools need Service Account credentials (MDB_MCP_API_CLIENT_ID / MDB_MCP_API_CLIENT_SECRET) and your IP on the API access list; a connection string alone only enables database tools. source ↗
- A static API key is rejected by the remote Atlas MCP server.
- The remote server needs OAuth; with static Service Account credentials use the
mongodb-atlas-mcp-remotestdio package. source ↗
How it differs from alternatives
- MongoDB Atlas-managed remote MCP server: Hosted by MongoDB with OAuth (recommended via the mongodb-atlas plugin), so nothing to run locally; the local package also works with self-managed MongoDB via a connection string. source ↗
Notes written from the official sources linked above, checked 2026-10-27.
Details
- Type
- MCP server
- Tasks
- Databases & SQL
- Compatible agents
- Cursor, VS Code, Codex, GitHub Copilot (source: clients with a setup heading or install/config instructions in the official README)
- Maintenance
- Release v3.1.0 on 2026-10-15; last commit 2026-10-23
- License
- Apache-2.0
- Source
- https://github.com/mongodb-js/mongodb-mcp-server
- Verified on
- 2026-10-26
No independent security audit: entries summarize official sources only. Review permissions and code before installing.
Compared in: Best MCP servers for Databases & SQL in Cursor · Best MCP servers for Databases & SQL in VS Code · Best MCP servers for Databases & SQL
Badge for your README (maintainers)
The badge only says it's listed; it is not a security review or an endorsement.