MCP server · Databases
MongoDB MCP server
Lets an assistant query and manage MongoDB databases and, with Atlas credentials, manage Atlas projects, clusters and users.
- Maintainer
- MongoDB (official)
- Licence
- Apache-2.0
- Runs
- Locally (npx)
- Sign-in
- A token or API key
- Registry version
- 2.1.0 (updated 2026-08-10)
- Last activity
- 2026-10-13
Overview
What it does
MongoDB’s MCP server runs locally through npx and connects to any MongoDB deployment from a connection string, whether that is a local instance, a self-managed cluster or Atlas. With an Atlas service account it also exposes tools for the Atlas platform itself. Every configuration example in the README adds the --readOnly flag, which stops create, update and delete tools from being registered.
Pick it when an assistant needs to explore collections, infer a schema, run find or aggregation queries, or check indexes and query plans. Atlas users can list and create clusters, manage database users and IP access lists, read Performance Advisor suggestions and work with Atlas Stream Processing. For Atlas, MongoDB also offers a hosted server through its “mongodb-atlas” plugins, which sign in with OAuth. The local CLI has no built-in authentication and is meant for single-user use on your own machine.
Tools
What the assistant can do
- find, aggregate, count and explain queries
- Collection schema, index and storage statistics
- Insert, update, delete and drop tools (blocked by --readOnly)
- Export of query results in EJSON
- Atlas projects, clusters, database users and access lists
- Atlas Performance Advisor, alerts and Stream Processing
- Atlas Local deployments and MongoDB knowledge-base search
Install
Install MongoDB MCP server in your app
You need:
- Node.js 22.13 or newer (20.19 still works but is deprecated)
- A MongoDB connection string, or Atlas service account credentials for the Atlas tools
Run in your project. --scope local keeps the servers private to you in this project; use user for every project.
claude mcp add --env MDB_MCP_CONNECTION_STRING="${MDB_MCP_CONNECTION_STRING}" --scope local mongodb -- npx -y mongodb-mcp-server@latest --readOnly
claude mcp add --env MDB_MCP_CONNECTION_STRING="$env:MDB_MCP_CONNECTION_STRING" --scope local mongodb -- cmd /c npx -y 'mongodb-mcp-server@latest' --readOnly
- Set MDB_MCP_CONNECTION_STRING first, e.g. export MDB_MCP_CONNECTION_STRING=… in your shell. The command saves the value, not the variable.
Project root. Commit it to share the servers with your team; each person sets the variables in their own shell.
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "${MDB_MCP_CONNECTION_STRING}"
}
}
}
}
- On native Windows (not WSL), the reference servers’ READMEs start npx through `cmd /c`: if a server won’t start, use "command": "cmd" with "args": ["/c", "npx", …].
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json · Windows: %APPDATA%\Claude\claude_desktop_config.json (Settings → Developer → Edit Config). Restart Claude after saving.
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "<MDB_MCP_CONNECTION_STRING>"
}
}
}
}
- Claude Desktop doesn’t read variables in this file: replace <MDB_MCP_CONNECTION_STRING> with the real values.
- This file contains your keys once filled in. It lives in your user folder; never commit or share it.
In your project, or ~/.cursor/mcp.json for every project.
{
"mcpServers": {
"mongodb": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "${env:MDB_MCP_CONNECTION_STRING}"
}
}
}
}
In your workspace. VS Code asks for each secret the first time a server starts and stores it securely.
{
"inputs": [
{
"type": "promptString",
"id": "mdb-mcp-connection-string",
"description": "MDB_MCP_CONNECTION_STRING",
"password": true
}
],
"servers": {
"mongodb": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "${input:mdb-mcp-connection-string}"
}
}
}
}
macOS/Linux: ~/.config/devin/mcp_config.json · Windows: %APPDATA%\devin\mcp_config.json. Read by the default Devin Local agent and by the legacy Cascade agent.
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "${env:MDB_MCP_CONNECTION_STRING}"
}
}
}
}
- Devin’s docs confirm ${env:…} references for the legacy Cascade agent; for the default Devin Local agent they only document them in OAuth settings. If a server can’t authenticate, check Devin’s MCP docs.
Want it alongside other servers? Open MongoDB MCP Server in the MCP config generator and add the rest; it writes one file per app. The snippets follow the setup in the server’s README, checked on 2026-10-14.
Before you install
- Without --readOnly (or MDB_MCP_READ_ONLY=true) the assistant can drop collections and databases and delete documents.
- Pass connection strings and Atlas credentials as environment variables, not command-line arguments, which can show up in process lists.
- The CLI has no authentication; never bind it to a non-loopback host or share it between users.
- A local MCP server runs with your user account’s permissions. Install it only from the source linked above. See how to choose a safe server.
Why it’s listed
Why we list it
Official, frequently released and covers both raw MongoDB data and the Atlas platform.
Related
More MCP servers
- Neon MCP ServerLets an assistant manage Neon Postgres projects and branches, run SQL, and test schema migrations on a temporary branch first.
- Prisma MCP serverLets an assistant create and query Prisma Postgres databases, restore backups, and manage Prisma Compute apps and Object Storage.
- Redis MCP ServerLets an assistant read and write Redis data types, streams and JSON documents, and run vector search on a Redis database.
- ClickHouse MCP ServerLets an assistant list ClickHouse databases and tables and run SQL queries, read-only by default, plus optional embedded chDB queries.
- DuckDB / MotherDuck Local MCP ServerLets an assistant run DuckDB SQL on local files, in-memory databases, S3-hosted databases or MotherDuck, read-only unless you allow writes.
- mcp-server-qdrantGives an assistant a semantic memory: it stores notes in a Qdrant collection and finds them later by meaning rather than exact words.
All MCP serversMCP config generatorGuide: MCP servers in Claude CodeGuide: what is MCP?