MongoDB MCP Server
Queries and aggregations over MCP
Official MongoDB MCP server — connect Claude or Cursor to a local instance or Atlas cluster to explore collections, run queries and aggregations, and inspect schema. Pass the connection string via the MDB_MCP_CONNECTION_STRING env var and start in --readOnly mode so the AI can analyse but not mutate data. Atlas needs your IP allow-listed.
Install MongoDB MCP Server
Paste into claude_desktop_config.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
}Run in your terminal
claude mcp add mongodb -- npx -y mongodb-mcp-server@latest --readOnly Paste into .cursor/mcp.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
]
}
}
} After adding the server, fully restart your MCP client. Replace <placeholders> (tokens, paths) with your own values.
Facts
- Stars
- ★ 3,900
- Maintainer
- MongoDB (official)
Trust score, capability surface (filesystem, shell, network) and risk flags — reviewed in your browser.
Known limitations
Keep --readOnly on unless you explicitly need writes, and never run write-enabled against production. The connection string grants database access — pass it via env, never inline in shared config.