MongoDB MCP Server
MongoDB MCP Server is an MCP server that adds database tools to AI assistants such as Claude Desktop, Claude Code and Cursor. MongoDB Model Context Protocol Server. It has 1,140 GitHub stars, is released under the Apache-2.0 license and runs locally with npx -y mongodb-mcp-server.
github.com/mongodb-js/mongodb-mcp-server (opens in a new tab)
- Needs API key
- Databases
- Apache-2.0
- Actively maintained
Install MongoDB MCP Server
Generated from the server's MCP registry entry. Replace your-value with your own values.
Claude Desktop
{
"mcpServers": {
"mongodb-mcp-server": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server"
],
"env": {
"MDB_MCP_API_CLIENT_ID": "your-value",
"MDB_MCP_API_CLIENT_SECRET": "your-value",
"MDB_MCP_CONNECTION_STRING": "your-value"
}
}
}
}Settings > Developer > Edit Config. macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\. Restart Claude Desktop afterwards.
Claude Code
claude mcp add --env MDB_MCP_API_CLIENT_ID=your-value --env MDB_MCP_API_CLIENT_SECRET=your-value --env MDB_MCP_CONNECTION_STRING=your-value --transport stdio mongodb-mcp-server -- npx -y mongodb-mcp-serverCursor
{
"mcpServers": {
"mongodb-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server"
],
"env": {
"MDB_MCP_API_CLIENT_ID": "your-value",
"MDB_MCP_API_CLIENT_SECRET": "your-value",
"MDB_MCP_CONNECTION_STRING": "your-value"
}
}
}
}Project file; use ~/.cursor/mcp.json to enable it in every project.
VS Code
{
"inputs": [
{
"type": "promptString",
"id": "mdb_mcp_api_client_id",
"description": "MDB_MCP_API_CLIENT_ID",
"password": true
},
{
"type": "promptString",
"id": "mdb_mcp_api_client_secret",
"description": "MDB_MCP_API_CLIENT_SECRET",
"password": true
},
{
"type": "promptString",
"id": "mdb_mcp_connection_string",
"description": "MDB_MCP_CONNECTION_STRING",
"password": true
}
],
"servers": {
"mongodb-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server"
],
"env": {
"MDB_MCP_API_CLIENT_ID": "${input:mdb_mcp_api_client_id}",
"MDB_MCP_API_CLIENT_SECRET": "${input:mdb_mcp_api_client_secret}",
"MDB_MCP_CONNECTION_STRING": "${input:mdb_mcp_connection_string}"
}
}
}
}Config formats checked against the official docs on Oct 7, 2026: modelcontextprotocol.io (opens in a new tab), code.claude.com (opens in a new tab), cursor.com (opens in a new tab), code.visualstudio.com (opens in a new tab).
Environment variables
Variables the server reads at startup.
| Name | Required | Description |
|---|---|---|
MDB_MCP_ALLOW_REQUEST_OVERRIDES | No | When set to true, allows configuration values to be overridden via request headers and query parameters. |
MDB_MCP_API_CLIENT_IDsecret | No | Atlas API client ID for authentication. Required for running Atlas tools. |
MDB_MCP_API_CLIENT_SECRETsecret | No | Atlas API client secret for authentication. Required for running Atlas tools. |
MDB_MCP_ASSISTANT_BASE_URL | No | Base URL for the MongoDB Assistant API. |
MDB_MCP_ATLAS_TEMPORARY_DATABASE_USER_LIFETIME_MS | No | Time in milliseconds that temporary database users created when connecting to MongoDB Atlas clusters will remain active before being automatically deleted. |
MDB_MCP_CONFIRMATION_REQUIRED_TOOLS | No | Comma separated values of tool names that require user confirmation before execution. Requires the client to support elicitation. |
MDB_MCP_CONNECTION_SCOPE | No | Visibility scope for MongoDB connections created at runtime. With 'session' (the default), each MCP session only sees the connections it created (plus the… |
MDB_MCP_CONNECTION_STRINGsecret | No | MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the connect tool before interacting with MongoDB data. |
MDB_MCP_DISABLE_SERVER_SIDE_JS | No | When set to true, disallows the use of server-side JavaScript operators (such as $where, $function, and $accumulator) in query filters and aggregation… |
MDB_MCP_DISABLED_TOOLS | No | Comma separated values of tool names, operation types, and/or categories of tools that will be disabled. |
MDB_MCP_DRY_RUN | No | When true, runs the server in dry mode: dumps configuration and enabled tools, then exits without starting the server. |
MDB_MCP_ELICITATION_TIMEOUT_MS | No | Time in milliseconds the user has to respond to an elicitation request (such as a tool confirmation prompt) before it fails. |
MDB_MCP_EXPORT_CLEANUP_INTERVAL_MS | No | Time in milliseconds between export cleanup cycles that remove expired export files. |
MDB_MCP_EXPORT_TIMEOUT_MS | No | Time in milliseconds after which an export is considered expired and eligible for cleanup. |
MDB_MCP_EXPORTS_PATH | No | Folder to store exported data files. |
MDB_MCP_EXTERNALLY_MANAGED_SESSIONS | No | When true, the HTTP transport allows requests with a session ID supplied externally through the 'mcp-session-id' header. When an external ID is supplied, the… |
MDB_MCP_HEALTH_CHECK_HOST | No | Deprecated. Use monitoringServerHost instead. Host address to bind the healthCheck HTTP server to (only used when transport is 'http'). If provided… |
MDB_MCP_HEALTH_CHECK_PORT | No | Deprecated. Use monitoringServerPort instead. Port number for the healthCheck HTTP server (only used when transport is 'http'). If provided, healthCheckHost… |
MDB_MCP_HTTP_BODY_LIMIT | No | Maximum size of the HTTP request body in bytes (only used when transport is 'http'). This value is passed as the optional limit parameter to the Express.js… |
MDB_MCP_HTTP_HEADERS | No | Header that the HTTP server will validate when making requests (only used when transport is 'http'). |
Tools (40)
Parsed from the Tools section of the README; check the repository for the current list.
aggregateRun an aggregation against a MongoDB collection
aggregate-dbRun an aggregation against a MongoDB database
collection-indexesDescribe the indexes for a collection
collection-schemaDescribe the schema for a collection
collection-storage-sizeGets the size of the collection
connectConnect to a MongoDB instance
countGets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter…
create-collectionCreates a new collection in a database. If the database doesn't exist, it will be created automatically.
create-indexCreate an index for a collection
db-statsReturns statistics that reflect the use state of a single database
delete-manyRemoves all documents that match the filter from a MongoDB collection
disconnectClose a MongoDB connection and revoke its connectionId.
drop-collectionRemoves a collection or view from the database. The method also removes any indexes associated with the dropped…
drop-databaseRemoves the specified database, deleting the associated data files
drop-indexDrop an index for the provided database and collection.
explainReturns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method
exportExport a query or aggregation results in the specified EJSON format.
findRun a find query against a MongoDB collection
insert-manyInsert an array of documents into a MongoDB collection. If the list of documents is above…
list-collectionsList all collections for a given database
list-connectionsList the active MongoDB connections and their connectionIds. Use this to find a connectionId established earlier.
list-databasesList all databases for a MongoDB connection
mongodb-logsReturns the most recent logged mongod events
rename-collectionRenames a collection in a MongoDB database
update-manyUpdates all documents that match the specified filter for a collection.
atlas-connect-clusterConnect to MongoDB Atlas cluster and get back a connectionId to pass to the other MongoDB tools.
atlas-create-access-listAllow Ip/CIDR ranges to access your MongoDB Atlas clusters.
atlas-create-clusterCreate a MongoDB Atlas cluster (M10–M80, replica set or single shard).
atlas-create-db-userCreate an MongoDB Atlas database user
atlas-create-free-clusterCreate a free MongoDB Atlas cluster
atlas-create-projectCreate a MongoDB Atlas project
atlas-get-performance-advisorGet MongoDB Atlas performance advisor recommendations and suggestions, which includes the operations: suggested…
atlas-get-regionsList supported MongoDB Atlas regions for a cloud provider.
atlas-inspect-access-listInspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.
atlas-inspect-clusterInspect metadata of a MongoDB Atlas cluster
atlas-list-alertsList triggered alerts for a MongoDB Atlas project. These are alerts Atlas has raised, not the alert configurations…
atlas-list-clustersList MongoDB Atlas clusters
atlas-list-db-usersList MongoDB Atlas database users
atlas-list-orgsList MongoDB Atlas organizations
atlas-list-projectsList MongoDB Atlas projects.
About MongoDB MCP Server
A Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas. MongoDB MCP Server comes bundled with the official MongoDB plugins for AI agents. The following plugins are available:
- mcp
- mcp-server
- mongodb
- mongodb-atlas
- mongodb-database
Similar MCP servers
More databases MCP servers
Dbx
t8y2/dbx
Query databases from AI agents using connections configured in DBX.
DatabasesRustButterbase AI MCP Server
butterbase-ai/butterbase
Butterbase MCP server — manage your backend: schemas, auth, functions, storage, RAG, deploys.
DatabasesTypeScriptDBHub
bytebase/dbhub
Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite.
DatabasesTypeScriptLINQ to DB
linq2db/linq2db
Inspect database schemas and execute SQL queries across multiple database providers with LINQ to DB.
DatabasesC#Mindwtr
dongdongbh/Mindwtr
Task automation via SQLite, desktop Local API, or Mindwtr Cloud; read-only by default.
DatabasesTypeScriptMCP Memory Service
doobidoo/mcp-memory-service
Open-source persistent memory for AI agent pipelines (LangGraph, CrewAI, AutoGen) and Claude.
DatabasesPython
What is MongoDB MCP Server?
MongoDB MCP Server is an MCP server that adds database tools to AI assistants such as Claude Desktop, Claude Code and Cursor. MongoDB Model Context Protocol Server. It has 1,140 GitHub stars, is released under the Apache-2.0 license and runs locally with npx -y mongodb-mcp-server. The source code is at github.com/mongodb-js/mongodb-mcp-server.
How do I install the MongoDB MCP Server MCP server?
Add the command npx -y mongodb-mcp-server to your MCP client: put it in claude_desktop_config.json for Claude Desktop, run claude mcp add for Claude Code, or add it to .cursor/mcp.json (Cursor) or .vscode/mcp.json (VS Code). The snippets on this page are ready to paste.
Is MongoDB MCP Server free?
The server is open source under the Apache-2.0 license, so running it is free. It needs credentials (MDB_MCP_API_CLIENT_ID, MDB_MCP_API_CLIENT_SECRET and MDB_MCP_CONNECTION_STRING) for the service it connects to, which may require a paid account.
Is MongoDB MCP Server actively maintained?
The most recent commit was on Oct 6, 2026. The latest release is v3.0.5, published Oct 1, 2026. appsgit only lists MCP servers with a commit in the last six months and re-checks every server daily.