MongoDB's official server for querying and managing MongoDB databases and MongoDB Atlas, with an optional read-only mode.
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add mongodb -- npx -y mongodb-mcp-server@latest --readOnly~/.codex/config.toml
[mcp_servers.mongodb]
command = "npx"
args = ["-y", "mongodb-mcp-server@latest", "--readOnly"]
# codex mcp add mongodb -- npx -y mongodb-mcp-server@latest --readOnly~/.cursor/mcp.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}.vscode/mcp.json
{
"servers": {
"mongodb": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}claude_desktop_config.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}.trae/mcp.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}