mongodb-mcp-server
- Type
- MCP server
- Scanned
- Oct 29, 2026
- Version
- 7e4d9ed40990
- Files read
- 802
This official MongoDB server allows AI agents to query and manage MongoDB databases, MongoDB Atlas cloud resources, local Docker deployments, and the MongoDB Assistant knowledge base. The biggest risk is that write and destructive actions are enabled by default—even if you choose read-only mode in the setup wizard due to a bug—allowing a tricked AI agent to modify databases, alter cloud settings, or leak credentials to outside servers without confirmation.
What it can reach
- Network
- Connects to MongoDB databases, MongoDB Atlas and Assistant APIs, Voyage AI, authentication providers, and telemetry servers, and can optionally listen on local or network HTTP ports.
- Files
- Reads configuration files and TLS certificates, and writes application logs, exported database data (under ~/.mongodb/mongodb-mcp or %LOCALAPPDATA%\\mongodb\\mongodb-mcp), and AI editor config files.
- Secrets
- Reads database connection strings and passwords, MongoDB Atlas API credentials, cloud provider keys (AWS, Azure, GCP), TLS keys, and Voyage AI API keys from environment variables, CLI arguments, or config files.
- Shell commands
- Runs npx commands to install agent skills and opens editor configuration files during the interactive setup wizard.
- System
- Creates, lists, and deletes local Docker containers for local Atlas deployments, and reads OS metadata and the computer's machine ID for telemetry.
- Browser
- Can open your local web browser to complete single sign-on (OIDC) authentication.
Findings
-
HighSetup wizard ignores read-only selection and configures server in read-write mode
packages/setup/src/aiTool.ts:215
When a user runs the interactive setup wizard (
npx mongodb-mcp-server@latest setup) and answers Yes to "Install MCP server as Read-only?",AITool.buildMcpConfigEntryappends"--readOnly"to a localargsvariable but then returns a hardcodedargs: ["-y", "mongodb-mcp-server@latest"]array that omits--readOnly. BecauseCursor,VSCode,Windsurf,ClaudeDesktop, andClaudeCodeall inherit this base method (onlyOpenCodeoverrides it), users who explicitly request a read-only installation for those clients silently receive a full read-write server configuration.Fix: Return
argsinstead of the hardcoded["-y", "mongodb-mcp-server@latest"]array inAITool.buildMcpConfigEntry. -
HighRuntime connect tool can connect to arbitrary hosts and leak global driver credentials
packages/tools-mongodb/src/common/connectionManager.ts:446
The
connecttool is enabled by default (even when--readOnlyis set) and accepts anyconnectionStringchosen by the AI agent without user confirmation. WhenMCPConnectionManager.connectdials a connection without explicitdriverOptions, it callsgenerateConnectionInfoFromCliArgswiththis.driverConfig(the server'sUserConfig) merged into the tool-suppliedconnectionString. If the user configured global credentials (such asusername,password, or AWS IAM credentials) via environment variables or CLI flags, a prompt injection can pass an attacker-controlled MongoDB URI (mongodb://attacker.example.com:27017) to trigger an outbound connection (SSRF) that authenticates to the attacker's server using the user's configured credentials, or in read-write mode copy data from the user's database to the attacker's database.Fix: Do not merge global
driverConfigcredentials into runtimeconnecttool calls, and addconnecttoconfirmationRequiredToolsby default so the user must approve connecting to new hosts. -
Mediumatlas-connect-cluster mutates project IP access list and creates database users in read-only mode
packages/tools-atlas/src/tools/connect/connectCluster.ts:62
ConnectClusterTool(atlas-connect-cluster) is classified withoperationType: "connect", so it remains enabled when--readOnlyis active and is not inconfirmationRequiredToolsby default. When called, it automatically adds the server's current public IPv4 address to the Atlas project's IP access list (which is never removed on disconnect) and creates a temporary database user in the Atlas project. A prompt injection can invoke this tool to modify Atlas network access settings and create database users even when the user enabled--readOnlyto prevent infrastructure modifications.Fix: Require user confirmation before modifying the project IP access list or creating temporary database users, or skip automatic IP access list and user creation when
readOnlyis enabled. -
Mediumatlas-streams-build can exfiltrate cluster data to external HTTPS endpoints and start processors without confirmation
packages/tools-atlas/src/tools/streams/build.ts:939
While
atlas-streams-manageandatlas-streams-teardownrequire user confirmation by default (confirmationRequiredTools),atlas-streams-builddoes not. When Atlas credentials are configured and the server is not in read-only mode, a prompt-injected agent can callatlas-streams-buildto create aClusterconnection (defaulting toreadWriteAnyDatabase), create anHttpsconnection pointing to an attacker-controlled webhook URL, and deploy a stream processor withautoStart: truethat reads from the cluster and POSTs documents to the external URL—bypassing the confirmation prompt thatatlas-streams-manageenforces onstart-processor.Fix: Add
atlas-streams-buildto the defaultconfirmationRequiredToolslist, or require confirmation before creating connections or starting a processor viaautoStart: true. -
MediumWrite operations are enabled by default and execute without confirmation if the client lacks elicitation support
By default, readOnly mode is false, which registers tools that modify or delete database data (insert-many, update-many, delete-many, drop-collection, drop-database), provision or tear down Atlas cloud infrastructure (atlas-create-cluster, atlas-create-db-user, atlas-create-access-list, atlas-streams-teardown), and manage local Docker containers. Furthermore, if the user's MCP client does not support MCP elicitation, tools in confirmationRequiredTools proceed without any confirmation prompt, allowing a prompt injection in untrusted data to trigger destructive actions.
Fix: Run the server with --readOnly (or MDB_MCP_READ_ONLY=true) unless write access is required, disable unneeded tool categories with --disabledTools, and use an MCP client that supports elicitation.
-
MediumDestructive tools execute without confirmation when client lacks elicitation support
By default, read-only mode is disabled (readOnly defaults to false) and destructive tools such as drop-database, drop-collection, delete-many, atlas-create-db-user, and atlas-create-access-list rely on MCP elicitation for user confirmation. However, if the user's MCP client does not support elicitation, the server falls back to executing these destructive operations without any confirmation, allowing a prompt injection attack to modify or delete data and cloud access controls.
Fix: Start the server with --readOnly (or MDB_MCP_READ_ONLY=true) when write access is not needed, or explicitly disable destructive tools via --disabledTools when using an MCP client that does not support elicitation.
-
MediumWrite operations are enabled by default and confirmation-required tools execute without confirmation when client lacks elicitation
By default, readOnly mode is false (and several MCP configuration examples in the README omit --readOnly), enabling destructive database and cloud tools such as drop-database, drop-collection, delete-many, atlas-create-db-user, and atlas-create-access-list. In addition, when the connected MCP client does not support MCP elicitation, tools in confirmationRequiredTools silently bypass the confirmation prompt and execute immediately, allowing prompt injection from untrusted documents to trigger destructive actions without user approval.
Fix: Enable readOnly mode by default unless the user explicitly opts into write access, and fail closed (refuse to run confirmationRequiredTools) when the MCP client does not support elicitation.
-
MediumAWS Dockerfile binds unauthenticated HTTP server to 0.0.0.0 with dangerousHostBinding enabled
packages/mongodb-mcp-server/deploy/aws/Dockerfile:24
The AWS deployment Dockerfile configures MDB_MCP_TRANSPORT=http, MDB_MCP_HTTP_HOST=0.0.0.0, MDB_MCP_DANGEROUS_HOST_BINDING=true, and MDB_MCP_EXTERNALLY_MANAGED_SESSIONS=true. Because the server has no built-in authentication, deploying this image to any network-reachable AWS environment (such as ECS, EKS, Fargate, or EC2) without an external authenticating gateway exposes all MongoDB and Atlas tools to unauthenticated network callers.
Fix: Remove MDB_MCP_DANGEROUS_HOST_BINDING=true and MDB_MCP_HTTP_HOST=0.0.0.0 from the Dockerfile defaults so operators must explicitly set them at runtime after placing an authenticating reverse proxy or runtime in front of the container.
-
MediumAWS deployment Dockerfile binds unauthenticated HTTP server to 0.0.0.0
packages/mongodb-mcp-server/deploy/aws/Dockerfile:24
The AWS Dockerfile configures the MCP server to listen on 0.0.0.0:8000 over HTTP and sets MDB_MCP_DANGEROUS_HOST_BINDING=true and MDB_MCP_EXTERNALLY_MANAGED_SESSIONS=true. Because the server has no built-in authentication and defaults to read-write mode, deploying this image in any environment where port 8000 is reachable without an authenticating reverse proxy exposes full database and Atlas access to the network.
Fix: Ensure the container is only deployed behind an authenticated runtime or proxy (such as Bedrock AgentCore with strict network isolation), and consider setting MDB_MCP_READ_ONLY=true by default in the image.
-
Lowexport tool bypasses indexCheck enforcement
packages/tools-mongodb/src/tools/read/export.ts:71
When
--indexCheck(MDB_MCP_INDEX_CHECK=true) is enabled, tools such asfind,aggregate,count,delete-many, andupdate-manyruncheckIndexUsageto reject queries that perform a collection scan (COLLSCAN). However,ExportToolexecutesfindandaggregatecursors and streams the entire result set to disk without checkingthis.server.config.indexCheck, allowing the agent to trigger unbounded collection scans despiteindexCheckbeing enabled.Fix: Check
this.server.config.indexCheckand callcheckIndexUsageinExportTool.executebefore opening the export cursor. -
LowHTTP request overrides can disable untrusted data prompt-injection warnings
packages/cli/src/config/userConfig.ts:68
Other security-related boolean options in
UserConfigSchema(readOnly,indexCheck,disableServerSideJs) useoneWayOverride(true)so that per-request HTTP headers or query parameters (whenallowRequestOverridesis enabled) can only make the configuration stricter. In contrast,disableUntrustedDataWarningis registered withoverrideBehavior: "override", allowing a request to setdisableUntrustedDataWarningtotrueand strip the<untrusted-user-data>prompt-injection delimiters and warning from tool responses.Fix: Change
overrideBehaviorfordisableUntrustedDataWarningtooneWayOverride(false)or"not-allowed". -
LowAtlas IP lookup and telemetry requests bypass configured HTTP proxy
packages/atlas-api-client/src/apiClient.ts:207
ApiClientreceives a proxy-awareoptions.httpClient.fetchand passes it to the OpenAPI client, butgetIpInfo(),sendAuthEvents(), andsendUnauthEvents()call the globalfetchfunction directly. When a user configuresHTTPS_PROXYorALL_PROXY, these calls bypass the proxy and connect directly tocloud.mongodb.com, exposing the machine's real IP address.Fix: Use the injected
options.httpClient.fetchinstead of the globalfetchingetIpInfo(),sendAuthEvents(), andsendUnauthEvents(). -
LowAWS deployment Dockerfile binds unauthenticated HTTP server to 0.0.0.0 and installs unpinned latest package
packages/mongodb-mcp-server/deploy/aws/Dockerfile:24
The AWS Dockerfile sets MDB_MCP_HTTP_HOST=0.0.0.0, MDB_MCP_DANGEROUS_HOST_BINDING=true, and MDB_MCP_EXTERNALLY_MANAGED_SESSIONS=true, and installs mongodb-mcp-server@latest (ignoring the VERSION build argument). While intended to sit behind AWS Bedrock AgentCore, running this container image in any environment without an authenticating reverse proxy exposes an unauthenticated MCP server to the network.
Fix: Pin the npm package installation to ${VERSION} in the Dockerfile and ensure the container is only deployed behind an authenticating gateway that strips or validates session headers.
-
LowUsage telemetry is enabled by default
Telemetry collection is enabled by default (MDB_MCP_TELEMETRY=enabled), which sends tool execution metadata, client information, and a device identifier to MongoDB servers.
Fix: Set MDB_MCP_TELEMETRY=disabled, pass --telemetry disabled, or set DO_NOT_TRACK=1 in the environment to prevent telemetry data from leaving the machine.
-
LowAWS deployment Dockerfile binds HTTP server to 0.0.0.0 with dangerousHostBinding enabled and unpinned package version
packages/mongodb-mcp-server/deploy/aws/Dockerfile:24
The AWS deployment Dockerfile configures the server to listen on 0.0.0.0:8000 and sets MDB_MCP_DANGEROUS_HOST_BINDING=true, MDB_MCP_EXTERNALLY_MANAGED_SESSIONS=true, and installs mongodb-mcp-server@latest ignoring the VERSION build argument. If this container image is run outside of an authenticated gateway or with misconfigured network security groups, it exposes an unauthenticated MCP server with write capabilities to the network.
Fix: Ensure the container is strictly isolated behind an authenticated runtime such as Bedrock AgentCore, pin the npm install command to mongodb-mcp-server@${VERSION}, and consider enabling MDB_MCP_READ_ONLY=true by default.
-
LowAzure Bicep template defaults to NOAUTH with external ingress and allows all tenant client apps when authAllowedClientApps is empty
packages/mongodb-mcp-server/deploy/azure/bicep/main.bicep:50
The Azure Container Apps Bicep template sets ingress.external to true and defaults authMode to NOAUTH. Additionally, when MicrosoftMIBasedAuth is enabled, authAllowedClientApps defaults to an empty array, which permits any client application in the Azure AD tenant to access the MCP server unless explicitly restricted.
Fix: Default authMode to MicrosoftMIBasedAuth, require a non-empty authAllowedClientApps list, and restrict ingress or enable read-only mode unless write access is explicitly required.
-
LowAWS Dockerfile ignores VERSION build argument and installs unpinned @latest package
packages/mongodb-mcp-server/deploy/aws/Dockerfile:11
Although ARG VERSION=latest is declared at the top of the Dockerfile and used in the image label, the npm install command hardcodes mongodb-mcp-server@latest instead of using ${VERSION}. Builds that pass --build-arg VERSION=x.y.z will still pull whatever version is currently tagged latest on npm, breaking version pinning.
Fix: Change the install command to RUN npm install -g mongodb-mcp-server@${VERSION} and pin ARG VERSION to a specific release version.
-
LowTelemetry is enabled by default and sends usage data to MongoDB
Telemetry (MDB_MCP_TELEMETRY) defaults to "enabled", causing the server to collect device/machine identifiers and tool usage events and transmit them to MongoDB servers unless the user explicitly disables it via --telemetry disabled, MDB_MCP_TELEMETRY=disabled, or DO_NOT_TRACK=1.
Fix: Make telemetry opt-in (disabled by default) or prompt the user for consent during setup before sending telemetry data.
-
LowRequest overrides allow HTTP callers to disable prompt-injection untrusted data warnings
packages/cli/src/config/configOverrides.test.ts:160
When allowRequestOverrides is enabled on the HTTP server, disableUntrustedDataWarning uses unrestricted override behavior rather than a one-way stricter-only guard (unlike readOnly, indexCheck, and disableServerSideJs). An HTTP caller can send the x-mongodb-mcp-disable-untrusted-data-warning: true header to strip the <untrusted-user-data> prompt-injection warning wrappers from tool responses even when the server was configured with warnings enabled.
Fix: Restrict disableUntrustedDataWarning so that request overrides cannot change it from false to true, or mark it as not-allowed for request overrides.
-
LowAWS deployment Dockerfile enables 0.0.0.0 binding and unpinned package installation
packages/mongodb-mcp-server/deploy/aws/Dockerfile:24
The AWS deployment Dockerfile sets MDB_MCP_HTTP_HOST=0.0.0.0, MDB_MCP_DANGEROUS_HOST_BINDING=true, and MDB_MCP_EXTERNALLY_MANAGED_SESSIONS=true, and installs an unpinned mongodb-mcp-server@latest (ignoring the VERSION build argument). If this image is deployed outside of an authenticated wrapper like AWS Bedrock AgentCore, it exposes an unauthenticated MCP HTTP endpoint on all network interfaces.
Fix: Pin the npm install command to the ${VERSION} build argument and ensure network-level authentication is enforced before setting MDB_MCP_DANGEROUS_HOST_BINDING=true.
-
LowWrite and destructive operations are enabled by default and bypass confirmation if elicitation is unsupported
The server defaults to MDB_MCP_READ_ONLY=false, exposing database and Atlas write/delete tools unless the user passes --readOnly. Furthermore, while certain destructive tools request user confirmation via MCP elicitation, they execute without confirmation if the MCP client does not support elicitation, and tools such as update-many and rename-collection (with dropTarget: true) are not in confirmationRequiredTools by default.
Fix: Run the server with --readOnly (or MDB_MCP_READ_ONLY=true) unless write access is explicitly needed, and add rename-collection and update-many to MDB_MCP_CONFIRMATION_REQUIRED_TOOLS when write access is enabled.
-
LowUnpinned npm package installation in AWS Dockerfile ignores VERSION build argument
packages/mongodb-mcp-server/deploy/aws/Dockerfile:11
Although the Dockerfile declares ARG VERSION=latest, the npm install command hardcodes mongodb-mcp-server@latest instead of using ${VERSION} or a pinned version/digest, making builds non-reproducible.
Fix: Pin the package version and reference the build argument: RUN npm install -g mongodb-mcp-server@${VERSION}.
-
InfoTelemetry is enabled by default
The server enables telemetry collection by default (MDB_MCP_TELEMETRY="enabled"), periodically sending usage events, tool execution metadata, and hashed device/environment identifiers to MongoDB servers.
Fix: Set MDB_MCP_TELEMETRY=disabled, pass --telemetry disabled, or set DO_NOT_TRACK=1 in the environment if you do not want usage telemetry sent to MongoDB.