dotsagent.io
Language:English
Data · MongoDB

Set up MongoDB

Query and administer MongoDB databases and Atlas clusters, using a connection string or an Atlas service account.

Publisher
MongoDB Official
Run locally
npx -y mongodb-mcp-server@latest --readOnly
Transports
stdio, streamable-http
Authentication
A connection string, an Atlas service account with client ID and secret, or both.
Environment
MDB_MCP_CONNECTION_STRINGMDB_MCP_API_CLIENT_IDMDB_MCP_API_CLIENT_SECRET
What it can touch
Read and write; --readOnly limits it to reads.
Licence
Apache-2.0
Source
github.com/mongodb-js/mongodb-mcp-server
Status
Active

Install

This server runs on your machine as a child process of the client. You need the runtime its command uses, such as Node.js for npx, uv for uvx or Docker, plus any variables listed under Environment.

Claude Code

shell
claude mcp add --scope project --env MDB_MCP_CONNECTION_STRING='<MDB_MCP_CONNECTION_STRING>' --env MDB_MCP_API_CLIENT_ID='<MDB_MCP_API_CLIENT_ID>' --env MDB_MCP_API_CLIENT_SECRET='<MDB_MCP_API_CLIENT_SECRET>' mongodb -- npx -y mongodb-mcp-server@latest --readOnly

Cursor

.cursor/mcp.json
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "${env:MDB_MCP_CONNECTION_STRING}",
        "MDB_MCP_API_CLIENT_ID": "${env:MDB_MCP_API_CLIENT_ID}",
        "MDB_MCP_API_CLIENT_SECRET": "${env:MDB_MCP_API_CLIENT_SECRET}"
      }
    }
  }
}

Codex

~/.codex/config.toml
[mcp_servers.mongodb]
command = "npx"
args = ["-y", "mongodb-mcp-server@latest", "--readOnly"]
env_vars = ["MDB_MCP_CONNECTION_STRING", "MDB_MCP_API_CLIENT_ID", "MDB_MCP_API_CLIENT_SECRET"]

Config for other clients →

The generated command keeps --readOnly; drop it only if the agent should write.

Other servers in data

Sources

  1. github.com/mongodb-js/mongodb-mcp-server

Independent reference for people who build AI agents. Not affiliated with any vendor named here.

© 2026 DotsAgent · Facts checked October 1, 2026