MongoDB MCP Server
Official MongoDB server for querying, inserting, aggregating, and managing both local MongoDB instances and Atlas cloud clusters — including creating free clusters from Claude.
Client Compatibility
What It Does
Full MongoDB access from Claude — both local database operations and Atlas cloud management. On the database side: connect, find, insert, update, delete, aggregate, create/drop indexes, inspect collection schemas, and export data. On the Atlas side: create free clusters, create projects, manage database users, configure access lists, and get performance advisor recommendations.
The dual personality is the key differentiator. Most database MCP servers give you query access. This one also manages infrastructure.
What It Does Well
- Atlas cluster creation from Claude is genuinely powerful for onboarding. “Create a free MongoDB cluster for my new project” actually works. The server handles project creation, cluster provisioning, user setup, and access list configuration. For developers spinning up new projects, this collapses a multi-step Atlas dashboard workflow into a conversation.
- Safety features are well thought out. Read-only mode (
--readOnly), configurable disabled tools (--disabledTools), and confirmation-required tools (--confirmationRequiredTools) give you granular control over what Claude can do. Temporary database users with auto-delete and configurable export cleanup prevent credential and data sprawl. - VS Code extension includes MCP with auto-setup. If you’re using VS Code, the MongoDB extension bundles the MCP server with automatic configuration. No separate install needed. This is the smoothest zero-config MCP setup for any database server we’ve reviewed.
What It Doesn’t Do Well
- Local MongoDB is still a prerequisite for local development. The server connects to MongoDB — it doesn’t run MongoDB. If you don’t have a local instance or an Atlas cluster, you need to set one up first. The Atlas free tier is the easy path for evaluation, but local MongoDB requires installing and running the daemon.
- Aggregation pipeline complexity can exceed what’s practical in conversation. MongoDB’s aggregation framework is powerful but verbose. Complex multi-stage pipelines with $lookup, $unwind, and $group stages produce large JSON structures that consume significant context. Simple queries work great, but heavy analytics workflows are better done in a dedicated tool.
- Atlas management tools require separate OAuth credentials. Database operations use MONGODB_URI. Atlas management uses MDB_MCP_ATLAS_CLIENT_ID and MDB_MCP_ATLAS_CLIENT_SECRET. Two different auth mechanisms for two different feature sets. Not confusing once you understand it, but the initial setup isn’t obvious.
Setup Notes
Standard npx install. For local MongoDB, set MONGODB_URI to your connection string. For Atlas, use the Atlas connection string (find it in the Atlas dashboard under Connect).
Atlas management features require API OAuth credentials — create these in the Atlas dashboard under Organization Access Manager > API Keys. These are separate from your database connection.
Logs go to ~/.mongodb/mongodb-mcp/.app-logs on Mac or %LOCALAPPDATA%\mongodb\mongodb-mcp\.app-logs on Windows. Useful for debugging connection issues.
Config
Local MongoDB:
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": ["-y", "@mongodb-js/mongodb-mcp-server"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017"
}
}
}
}
Atlas (with cloud management):
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": ["-y", "@mongodb-js/mongodb-mcp-server"],
"env": {
"MONGODB_URI": "mongodb+srv://user:pass@cluster.mongodb.net/mydb",
"MDB_MCP_ATLAS_CLIENT_ID": "your-atlas-client-id",
"MDB_MCP_ATLAS_CLIENT_SECRET": "your-atlas-client-secret"
}
}
}
}
Read-only mode:
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": ["-y", "@mongodb-js/mongodb-mcp-server", "--readOnly"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017"
}
}
}
}
Tested With
- Claude Desktop on Windows 11
- VS Code (via MongoDB extension auto-setup)
{
"mcpServers": {
"mongodb-mcp": {
"command": "npx",
"args": [
"-y",
"@mongodb-js/mongodb-mcp-server"
],
"env": {
"MONGODB_URI": "mongodb://localhost:27017"
}
}
}
} Environment Variables
MONGODB_URI(required) — MongoDB connection string (local or Atlas)MDB_MCP_ATLAS_CLIENT_ID— Atlas API OAuth client ID (for cloud management features)MDB_MCP_ATLAS_CLIENT_SECRET— Atlas API OAuth client secret
Prerequisites
- Node.js 18+
- MongoDB instance (local) or Atlas connection string
View on GitHub · npx -y @mongodb-js/mongodb-mcp-server
Reviewed by J-Dub · February 22, 2026