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,162 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)
Data as of from the GitHub API and the official MCP registry; description from the project's repository. Report an error
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",
"MDB_MCP_CONNECTION_STRINGS": "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 --env MDB_MCP_CONNECTION_STRINGS=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",
"MDB_MCP_CONNECTION_STRINGS": "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
},
{
"type": "promptString",
"id": "mdb_mcp_connection_strings",
"description": "MDB_MCP_CONNECTION_STRINGS",
"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}",
"MDB_MCP_CONNECTION_STRINGS": "${input:mdb_mcp_connection_strings}"
}
}
}
}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_AGGREGATION_COUNT_MAX_TIME_MS_CAP | No | Deprecated. Use aggregationCountTimeoutMs instead. |
MDB_MCP_AGGREGATION_COUNT_TIMEOUT_MS | No | The maximum time in milliseconds for the count phase of aggregation operations. This is used to limit the time spent counting documents when determining if… |
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_IDLE_TIMEOUT_MS | No | Milliseconds a MongoDB connection may stay unused (no tool call touching it) before it is closed to release the underlying connection pool and its server-side… |
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, exposed under the connectionId "preconfigured". Optional, if not set, you'll need to call the… |
MDB_MCP_CONNECTION_STRINGSsecret | No | MongoDB connection strings keyed by name, as a JSON object (e.g. {"preconfigured": "mongodb://...", "analytics": "mongodb://..."}). Each name becomes a… |
MDB_MCP_DANGEROUS_HOST_BINDING | No | When set to true, allows binding the HTTP server (and monitoring server) to a non-loopback host such as 0.0.0.0, a LAN IP, or an empty host (all interfaces)… |
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_DISABLE_UNTRUSTED_DATA_WARNING | No | When set to true, tool responses include potentially untrusted data (such as documents or query results) as-is, without wrapping it in delimiters and a… |
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_EVICTION_IDLE_GRACE_M_S | No | How long a session must be idle before it becomes eligible for least-recently-used eviction when the HTTP transport is at its maxSessions cap (only used when… |
MDB_MCP_EXPORT_CLEANUP_INTERVAL_MS | No | Time in milliseconds between export cleanup cycles that remove expired export files. |
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.
- mcp
- mcp-server
- mongodb
- mongodb-atlas
- mongodb-database
Similar MCP servers
More databases MCP servers
CloudBase
TencentCloudBase/CloudBase-AI-Toolkit
CloudBase MCP: DB, functions, storage, hosting via @cloudbase/cloudbase-mcp.
Active · last commit Nov 16, 2026
DatabasesTypeScriptMCP Neo4j Cloud Aura API
neo4j-contrib/mcp-neo4j
MCP server for Neo4j Aura Database Instance Manager.
Maintained · last commit Sep 9, 2026
OfficialDatabasesPythonMySQL MCP Server
designcomputer/mysql_mcp_server
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases.
Active · last commit Oct 28, 2026
DatabasesPythonHippo Memory
kitfunso/hippo-memory
Stop re-teaching your agent. Make your agent's memory work like a brain.
Active · last commit Nov 12, 2026
DatabasesTypeScriptErd Editor
dineug/erd-editor
Design database schemas as ERDs in your browser, VS Code, JetBrains IDEs or Obsidian.
Active · last commit Nov 3, 2026
DatabasesTypeScriptNeon
neondatabase/mcp-server-neon
Official Neon MCP server for managing Neon projects and Lakebase Postgres databases.
Maintained · last commit Nov 16, 2026
OfficialDatabasesTypeScript
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, MDB_MCP_CONNECTION_STRING and MDB_MCP_CONNECTION_STRINGS) for the service it connects to, which may require a paid account.
Is MongoDB MCP Server actively maintained?
The most recent commit was on Nov 12, 2026. The latest release is v3.3.0, published Nov 9, 2026. appsgit only lists MCP servers with a commit in the last six months.