MongoDB Database & Atlas
mongodb-js
Query MongoDB collections and administer Atlas clusters — find, aggregate, schema inference, and cluster operations — via the official MongoDB MCP server.
- Installs
- 1.1k
- Namespace
- mongodb
- Version
- >=1.0.0 <2.0.0
- Last attach
- reviewed1 months ago
Add to your mcp.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server"
]
}
}
}Attach in a FrootAI play (fai-manifest)
mcp_scope:
attached:
- mongodbAuthentication
set MDB_MCP_CONNECTION_STRING to connect to a database (or call the `connect` tool), and/or set MDB_MCP_API_CLIENT_ID + MDB_MCP_API_CLIENT_SECRET (an Atlas service account) to enable the Atlas tools; prefer a least-privilege user/key.
No credentials required.
Environment variables
| Variable | Required | Auth mode | Description |
|---|---|---|---|
| MDB_MCP_CONNECTION_STRING | no | connection-string | MongoDB connection string for a direct database connection (local or Atlas). Optional — if unset, call the `connect` tool first. Pass via env, never inline in args (doctrine #6). |
| MDB_MCP_API_CLIENT_ID | no | atlas-service-account | Atlas service-account client ID. Required only to enable the Atlas administration tools (`atlas-*`). |
| MDB_MCP_API_CLIENT_SECRET | no | atlas-service-account | Atlas service-account client secret. Required only to enable the Atlas administration tools; pass via env, never inline in args (doctrine #6). |
| MDB_MCP_READ_ONLY | no | any | Set to `true` to restrict the server to read/connect/metadata tools (equivalent to the `--readOnly` flag); disables all create/update/delete tools. |
Sample tools
mongodb.findRun a find query against a MongoDB collection.
mongodb.aggregateRun an aggregation pipeline against a collection.
mongodb.countCount documents in a collection matching a filter.
mongodb.list-databasesList all databases for the active connection.
mongodb.list-collectionsList all collections in a database.
mongodb.collection-schemaInfer and describe a collection's schema.
mongodb.atlas-list-clustersList MongoDB Atlas clusters in a project.
Used in recipes
FAI cookbook recipes that attach mongodb.
Destructive-action audit
4 destructive tools — confirm per call
Each runs only when the trust policy allows it; under allowDestructive: false they prompt per call.
- mongodb.delete-many
- mongodb.drop-collection
- mongodb.drop-database
- mongodb.drop-index
Destructive-action audit (X2.18): delete-many, drop-collection, drop-database, and drop-index are flagged in `destructive_tools` and are blocked when the trust policy sets `allowDestructive: false` (MongoDB also gates them behind elicitation confirmation).
Known limitations
- Without MDB_MCP_CONNECTION_STRING (or Atlas credentials) the server starts but exposes no data until you call the `connect` tool with a connection string.
- The Atlas administration tools (`atlas-*`) only register when Atlas service-account credentials (MDB_MCP_API_CLIENT_ID / MDB_MCP_API_CLIENT_SECRET) are set.
- Write and admin tools operate against real data — pass `--readOnly` (or MDB_MCP_READ_ONLY=true) to attach in safe read-only mode for analysis.
Spec contributors
Maintainers who landed commits onmcp-specs/mongodb.json.
- pspsbali
Freshness
When this spec was last reviewed by a maintainer and last machine-validated against the live server.
- Spec last reviewed
- 1 months ago(2026-06-25)
- Auto-validated
- never