MongoDB MCP Server
MongoDB's official MCP server for querying databases and managing Atlas clusters from AI agents.
Sources and review
Checked against public documentation on . Suitability guidance is our editorial judgment; this is not a performance benchmark or an endorsement.
Exploring collections, writing queries and managing Atlas from an AI coding assistant.
About MongoDB MCP Server
MongoDB's official MCP server connects AI agents to MongoDB databases and MongoDB Atlas. It runs locally against any self-managed deployment, optionally in read-only mode, and ships in official MongoDB plugins for Cursor, VS Code, Claude, Codex and GitHub Copilot CLI; MongoDB recommends its hosted Atlas MCP server over OAuth for Atlas users.
MongoDB MCP Server is listed in this index written primarily in TypeScript, with 1.2k stars on GitHub. Its latest recorded repository push was in November 2026; that is not an ASE editorial review date.
Before connecting: access and data
This record's specific permissions have not been reviewed by ASE. Read the publisher's documentation before copying setup or connecting.
- List the accounts, files and services the enabled tools can read, change or execute. Check your actual credentials and discovered tools.
- Use narrowly scoped credentials and read-only mode where supported. Review proposed writes before approving them; a generated configuration does not apply these limits for you.
- Local launch is not local-only data processing. External services receive requests, and your client may pass tool results to its model provider. Check both destinations before sharing private data.
- Keep keys and browser session files out of shared config, repositories and screenshots. Know how to disconnect the server and separately revoke its credentials or account sessions.
Add MongoDB MCP Server to your MCP client
Generated from the launch command in the project's README. Your client starts the server on demand.
Claude Code
claude mcp add mongodb-mcp-server -e MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnlyCursor
{
"mcpServers": {
"mongodb-mcp-server": {
"command": "npx",
"args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
}
}
}
}VS Code
{
"servers": {
"mongodb-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
}
}
}
}Claude Desktop
{
"mcpServers": {
"mongodb-mcp-server": {
"command": "npx",
"args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
}
}
}
}Codex
[mcp_servers.mongodb-mcp-server]
command = "npx"
args = ["-y", "mongodb-mcp-server@latest", "--readOnly"]
env = { MDB_MCP_CONNECTION_STRING = "mongodb://localhost:27017/myDatabase" }