MongoDB MCP server security: permissions, read-only mode and risky tools

Whether the official MongoDB MCP server can be locked to read-only access, which tools can change data, and which controls live in the server, in Atlas or in the database.

On this page

Can MongoDB MCP server security be locked down before an AI client connects?

A security reviewer deciding whether AI clients may query and change MongoDB data can lock the official server down before any client connects, but the controls differ by deployment. The strongest limit is a read-only database user, not a server setting. On the Atlas-hosted server, the Organization Owner can set AI clients to Read, Read and write, or Disabled, and tools outside that mode are not registered with the client session. The server is also not a sandbox for the host machine, so the database role and the access mode are the controls to rely on.

For the local server, read-only mode is off by default, so writes are allowed until someone enables it with --readOnly or MDB_MCP_READ_ONLY=true. Read-only mode limits the server to read, connect and metadata tools. The disabledTools option accepts tool names or categories such as create, update, delete, read, metadata, atlas and mongodb, so --disabledTools create,update,delete,atlas blocks writes and all Atlas operations. Server-side JavaScript operators ($where, $function, $accumulator) are disabled by default through disableServerSideJs. Each tool also carries readOnlyHint and destructiveHint annotations, which help AI clients decide when to ask for approval, but those hints are advisory and do not enforce anything.

The database user is the control a reviewer should insist on. MongoDB recommends a dedicated user with the read role for MCP connections and says never to give the server write credentials. Confirm that the connection string in use belongs to that user, that the Atlas Service Account used for Atlas tools carries only the access the team has approved, and that the chosen mode and disabled tools are recorded in the configuration the client loads. Check the MongoDB MCP Server security best practices before sign-off, since the tool lists differ between the Atlas and local servers.

Which permission controls apply to the local and Atlas-hosted servers

This table compares each permission control across the local server (mongodb plugin) and the Atlas-hosted server (mongodb-atlas plugin), with its status. Read the local column first, because writes are allowed by default on the local server until you turn read-only mode on. The main takeaway is that the local server needs deliberate configuration, while the Atlas-hosted server limits clients through an access mode set by the Organization Owner.

ControlLocal server (mongodb plugin)Atlas-hosted server (mongodb-atlas plugin)Status
Read-only modeOff by default, so cluster writes are allowed. Enable with --readOnly or MDB_MCP_READ_ONLY=trueNot a setting. Access is set to Read, Read and write, or DisabledLocal: built in, off by default. Atlas: admin setting
Access mode (Read, Read and write, Disabled)Not applicableSet by the Organization Owner. Tools outside the mode are not registered with the client sessionAdmin setting
disabledTools categories (create, update, delete, read, metadata, atlas, mongodb)Accepts tool names or categories. For example, --disabledTools create,update,delete,atlas blocks writes and all Atlas operationsNot supplied as a local option. Confirm which categories apply in the hosted setupBuilt in (local). Confirm for Atlas
disableServerSideJsServer-side JavaScript functions ($where, $function, $accumulator) are disabled by default through disableServerSideJs set to trueNot supplied. Confirm whether the hosted server exposes these operatorsBuilt in (local). Confirm for Atlas
Tool annotations (readOnlyHint, destructiveHint)Each tool carries annotations derived from its operation type, so clients can decide when to ask before running itSame annotation model is documented for remote MCP. Confirm the client honors the hintsBuilt in, client dependent
Read-only database user with the read roleRecommended for MCP connections. Never use write credentials with the serverDatabase user is chosen in the Atlas account. Confirm which Atlas roles can connectNeeds outside component (database user and Atlas roles)
Host sandboxing (OS account, container, network)Not supplied. The server runs with the permissions of the host account, so restrict that account and its network accessNot applicable to the hosted server. Confirm how Atlas isolates the sessionNot supplied to confirm

How the server enforces read-only and disabled tools

Lockdown for the MongoDB MCP server works at three separate points, and a reviewer should check each one. The first is the mongodb-mcp-server package running on the user's machine against self-managed deployments. Its controls are server flags and environment variables, such as --readOnly or MDB_MCP_READ_ONLY=true for read-only mode and --disabledTools for blocking tool names or categories. These settings are only as strong as the configuration that reaches each developer's machine, so confirm who sets them and whether users can override them. By default, the local server allows cluster write operations, so read-only mode is an opt-in setting that must be applied deliberately.

The second point is the Atlas-hosted server, which the client reaches over OAuth. There, the access mode set by the Organization Owner (Read, Read and write, or Disabled) decides which tools are registered with the client session at all. A tool outside the mode is not offered to the AI client, so the restriction does not depend on the model choosing to avoid it. The third point is the database itself. A dedicated user with the read role limits what any connection can do, whatever the tool settings say. MongoDB recommends this user for MCP connections and warns against giving the server database write credentials. Confirm that the role is applied to the exact connection string the server uses.

Each tool also carries readOnlyHint and destructiveHint annotations derived from its operation type, which help an AI client decide when to ask for approval. These annotations are hints for the client, not an enforcement point. A client or a user can ignore them, and a server that trusts them alone is not locked down. Treat them as a convenience for approval prompts and rely on the server flags, the Atlas access mode and the database role for the actual limits. Ask MongoDB to confirm which tools are available on each deployment type, since the tool categories differ between the Atlas and local servers, and test the restrictions against your own environment before approving use.

How local and Atlas-hosted deployments differ on who sets the limits

The local server runs as a process on the developer's machine through the mongodb plugin and connects to self-managed deployments. The developer who starts it, or whoever writes its launch configuration, sets the limits, so the organization's control depends on how that configuration is distributed and whether staff can override it. By default the server allows cluster write operations, so read-only protection only applies once someone turns it on.

  • Default posture: Write operations are allowed until --readOnly or MDB_MCP_READ_ONLY=true is set.
  • Tool removal: --disabledTools accepts tool names or categories such as create,update,delete,atlas, which removes those tools from the local server.
  • Server-side JavaScript: disableServerSideJs is true by default, which blocks $where, $function and $accumulator.
  • Who can change it: A developer can edit flags or environment variables on their own machine unless the organization controls the launch configuration.
  • Client hints: Read-only and destructive annotations help the AI client decide when to ask for approval, but they inform the client and are not a permission boundary on their own.

Check how the local server is launched on managed endpoints, which flags are fixed in the client configuration, and whether a developer can run a second copy with different settings. The MongoDB MCP Server security best practices page is the starting point for confirming these defaults.

Which tool categories can change data and what to disable first

The MongoDB MCP server groups its tools into categories, and each category carries a different level of risk to data and deployments. The cards below cover the categories and defaults that matter most, with the setting or role that limits each one, so reviewers can decide what to disable before any AI client connects.

Write operations on local servers

Create, update and delete tools let an agent change documents and collections in a self-managed cluster. By default the local server allows cluster write operations, so read-only mode is off unless someone sets --readOnly or MDB_MCP_READ_ONLY=true. Confirm that setting in every local configuration before approval. Also run --disabledTools create,update,delete when the use case only needs reads, and connect with a dedicated read-only database user rather than a write credential.

Security best practices

Atlas tools that manage deployments

Atlas tools manage deployments and project resources, not just the data inside them. The local server's atlas category can be blocked with --disabledTools atlas, and the same example command also blocks all write categories. Reviewers should ask which Atlas tools are available on the server they plan to use, because MongoDB notes that not every tool is available on both the Atlas Managed MCP Server and the Local MCP Server. Check the tools page before assuming a block applies.

MCP tools reference

Server-side JavaScript execution

Server-side JavaScript operators, including $where, $function and $accumulator, let a query run code on the database server. The local server disables them by default through disableServerSideJs set to true. Keep that default in place and confirm that no configuration file overrides it. Enabling these operators widens what a prompt-driven query can execute, so treat any change to this key as a security exception that needs an owner and a review.

Configuration options

Atlas tools outside the access mode

On the Atlas-hosted server, the Organization Owner chooses Read, Read and write, or Disabled as the AI client access mode. Tools outside that mode are not registered with the client session, so an agent cannot call them even if it asks. Set the mode deliberately for each organization and confirm it before rollout, because a broader mode silently adds write tools to every connected client. Review the setting again after any change to project or role assignments.

Manage AI client access

Read tools that expose sensitive documents

Read, connect and metadata tools are not harmless. Read-only mode prevents modifications, but an agent that can query a collection can still return personal, financial or health records to the AI client and into the model context. Limit what the database user can see by granting the read role only on the databases the use case needs, and avoid pointing the server at production collections that hold regulated data. Ask the vendor how the client treats returned query results before approving access.

Remote MCP security

Order the lockdown: database user, server settings, then client review

This sequence starts at the data layer, then narrows the server and the client, so each control is verified before the next one relies on it. The output is a short evidence file that shows a reviewer what the MCP connection can and cannot do.

  1. Create a dedicated read-only database user

    The database administrator creates a separate user for MCP connections and grants it the read role only, with no write roles on any database the assistant should reach. Confirm that no developer or service credential with write access is placed in the MCP configuration. MongoDB recommends this user and says never to use database write credentials with the server, so the check is simple: the connection string on the client side resolves to the read-only user. Keep the role grant output and a screenshot or export of the user's roles as evidence.

  2. Set read-only mode or disabled tools on the local server

    For a local deployment, the platform owner enables read-only mode through the documented setting, or disables the create, update, delete, and atlas tool categories that are not needed. By default the local server allows cluster write operations, so this step is not optional for a read-only use case. Verify the effective configuration by starting the server with the chosen settings and listing the tools the client receives. Keep the configuration file, the version of the server package pinned for review, and the tool list captured from the running session.

  3. Confirm server-side JavaScript is disabled

    The reviewer checks that server-side JavaScript functions ($where, $function, $accumulator) remain disabled, which the local server does by default through the disableServerSideJs setting. If any team has turned this off for a workload, record who approved it and why, since these operators can run code inside the database. Confirm the value in the active configuration, not only in the documentation. Keep a copy of the configuration showing the setting and its owner.

  4. Set the Atlas access mode to Read

    For Atlas-hosted use, an Organization Owner sets the AI client access mode to Read, so only read tools are registered in the client session. Tools outside the mode are not registered with the client, which is a stronger control than asking the assistant to behave. Confirm the mode in the Atlas organization settings and confirm which users and roles can change it. Keep the saved setting, the date it was changed, and the name of the person who changed it.

  5. Test that a write attempt is refused from the client

    Using a non-production cluster or a test collection, the reviewer asks the AI client to perform a write, such as inserting or updating a document, and checks that the request is refused or that the tool is absent from the session. Repeat for a delete and for a server-side JavaScript request. Read the tool annotations the client displays, since destructive tools should carry a destructive hint. Record each prompt, the client response, and the database log entry showing that nothing changed. Illustrative example: a reviewer asks for an insert, and the expected result is a refusal with no new document in the collection.

  6. File the evidence for the security review

    The security or compliance lead collects the role grant, configuration, Atlas access setting, tool list, test transcripts, and database logs into one review file with the date and reviewer names. Confirm that the file matches the deployed state, and schedule a repeat check whenever the server package version, the database user, or the Atlas access mode changes. The file is the basis for approving or restricting the connection, so it should show which controls were verified and which were not tested. Ask the vendor or your platform team to confirm any setting that this file does not cover.

Where the MongoDB MCP server controls stop short

The controls in the MongoDB MCP server reduce risk but do not finish the job. Several are client hints, several depend on how the database user and host are set up, and some are coarse enough that they need a second layer. Each card below names one gap and the usual way to cover it before an approval decision.

Local server allows writes by default

The local server permits cluster write operations unless read-only mode is turned on with --readOnly or MDB_MCP_READ_ONLY=true. A reviewer who approves the server without changing that setting has approved write access by default. Confirm the flag or environment variable in every developer configuration file, and check that a managed rollout sets it centrally rather than relying on each engineer.

Security best practices

Tool annotations are hints

Each tool carries readOnlyHint and destructiveHint annotations so that a client can decide when to ask before running it. These are signals the client reads, not an enforcement point on the server. Whether a given client actually prompts before a destructive call depends on that client's approval settings, so confirm the behavior in the client your staff use and do not treat the annotation as a control.

Remote MCP security

Read-only mode still allows reads

Read-only mode restricts the server to read, connect and metadata tools, which blocks modification but not disclosure. Any collection the database user can query can still be returned to the AI client, including personal, financial or health records. Review which databases and collections the connection can reach, and remove sensitive collections from the role rather than assuming read-only mode protects them.

Host and file system not confined

The server runs as a process on the developer's machine with that user's permissions. Our researched sources do not establish whether it confines the host process or limits file system access, so this needs confirmation with MongoDB before approval. Until it is confirmed, cover the gap with an operating system account that has no unnecessary file access and with network rules that limit where the process can connect.

Atlas access mode is coarse

The Atlas-hosted server offers only three access modes set by the Organization Owner: Read, Read and write, or Disabled. Tools outside the chosen mode are not registered with the client session, but there is no finer grant between those levels. An organization that needs read access to one project and no write access elsewhere should confirm with MongoDB whether that is possible, and otherwise limit the Atlas scope through its Organization Owner process and an approved client list.

Manage AI client access

Database user only as narrow as configured

MongoDB recommends a dedicated database user with the read role for MCP connections and says never to use write credentials with the server. The server cannot check whether the user it receives is narrower than intended. Review the role assignment during setup, confirm no shared or administrative credential is in the configuration, and retest after each change to the user's roles.

How the answer changes for production data, dev databases and Atlas organizations

Where the database holds regulated records, the default local behavior is the starting point for a finding, not an acceptable state. By default the local server allows cluster write operations, and read-only mode is only active when the operator sets --readOnly or MDB_MCP_READ_ONLY=true. The minimum position is therefore an explicit read-only configuration, a dedicated database user with the read role, and no database write credentials available to the server process.

  • Read-only mode set explicitly: Confirm the flag or environment variable is present in the launch configuration that developers actually use, not only in a template.
  • Dedicated read-only user: The database administrator should own a user with the read role for MCP connections and confirm that write credentials are absent from the client configuration.
  • Disabled risky categories: Use disabledTools to block create, update, delete and atlas categories, and confirm server-side JavaScript remains disabled.
  • Access mode on Atlas: The Organization Owner should set the AI client access mode to Read rather than leave writes enabled for a regulated project.
  • Recorded decision: Document who approved read access to regulated collections, which collections are in scope and the review date.

Before approval, ask the vendor and your database team to confirm how each setting behaves in the exact version you deploy, and test that a write attempt is refused under the chosen user.

What a security reviewer asks to see for MongoDB MCP server permissions

This table lists the evidence a reviewer should request before approving the MongoDB MCP server, where each item comes from and what it proves. Read each row as a question to answer with a file, a console setting or a log line from the actual environment. The main takeaway is that the local server defaults to allowing writes, so the configuration and the database user matter more than the tool list alone.

Evidence requestedWhere it comes fromWhat it shows
Read-only or disabledTools configuration in effectLocal server startup flags or the MDB_MCP_READ_ONLY environment variable, plus any disabledTools settingWhether writes are blocked and which tool names or categories are removed from the client
Database user and its rolesDatabase user list in the MongoDB deployment, with the roles assigned to the user the server connects asWhether the connection uses a dedicated read-only user with the read role instead of a write-capable credential
Atlas access mode and who set itAtlas Organization settings for AI client access, with the change history or owner recordWhether the mode is Read, Read and write or Disabled, and that an Organization Owner set it
Tools available to the clientA tools list captured from the client session, compared with the MongoDB tools pageWhich tools were actually registered, including whether any destructive or Atlas tools appear
Test log showing a refused writeA recorded attempt to insert or update through the client, with the server or database responseWhether a write is rejected in the running configuration, not just in the documentation
Server version and Node.js requirementOutput of the installed package version, and the Node.js runtime version on the hostWhich release is in use and whether the runtime meets the README requirement of Node.js v22.13.0 or later

What buyers ask before approving MongoDB MCP server permissions

Is read-only mode enough to lock down the MongoDB MCP server?

Read-only mode is a strong first control, but it is not the whole control. By default the local server allows cluster write operations, so read-only mode must be turned on with --readOnly or MDB_MCP_READ_ONLY=true. It restricts the server to read, connect and metadata tools. Pair it with a dedicated database user that holds only the read role, because MongoDB advises never giving the server write credentials. Also disable server-side JavaScript functions ($where, $function, $accumulator), which are off by default in the local server. Confirm the exact behavior of each setting against the configuration options page in your own test environment before approving use.

What does the MongoDB MCP server cost, and who pays for what?

The server's source code is licensed Apache-2.0, so the software itself carries no license fee. Costs come from the parts around it. Local use depends on your own Node.js runtime and the MongoDB deployment you connect to. Atlas-hosted use depends on your Atlas plan and the Organization Owner's decisions, so confirm with MongoDB which Atlas tier and features your organization needs. Database-side costs also apply, for example time to create read-only users, roles and monitoring. Ask MongoDB and your implementation partner for a written breakdown of recurring versus one-time costs before budgeting.

How long does it take to design and verify a MongoDB MCP lockdown?

No duration has been established for this, so treat any figure you hear with caution. The effort is driven by how many databases and collections the AI client needs, whether the team must split read and write roles, how many environments exist (local, staging, Atlas), and how much verification you require. Verification means confirming that write tools are disabled, that the database user cannot write, and that Atlas access modes match your policy. Ask any vendor or partner for a written plan with milestones and a retest step before you agree to dates.

Can our own team lock down the MongoDB MCP server without outside help?

Often yes, if your engineers can manage MongoDB roles, Node.js environments and client configuration files. The work is mostly configuration: setting read-only mode, listing disabled tool categories, creating a read-only user, and restricting Atlas access to Read or Disabled. The harder part is proving the result. A reviewer needs evidence that the tool list, database permissions and Atlas access mode all match the written policy. If your team lacks MongoDB administration or security testing experience, consider a short external review to test the setup against your requirements.

What would an outside partner do in a scoped MongoDB MCP engagement?

DeployOpen works on fixed scopes agreed in writing before work starts. For AI agent rollouts, DeployOpen tests the setup for prompt injection, tool and file permissions, data exposure, credential handling, and SSO and admin settings, then delivers a findings report with fixes and a retest. Deliverables, timelines and any out-of-scope items are defined in the written scope. DeployOpen does not issue audit reports or certifications. Ask for the scope document to confirm which MongoDB tools, environments and roles are included before you sign.

Do MongoDB Atlas access modes replace database roles?

No. Atlas access modes control what an AI client may do through the Atlas-hosted server, such as Read, Read and write, or Disabled, as set by the Organization Owner. Tools outside the chosen mode are not registered with the client session. Database roles still control what the underlying database user can do, and the local server connects with its own credentials. Use both layers: a restrictive Atlas access mode and a read-only database user with the read role. Confirm how each layer applies in your organization by checking the Atlas client access documentation.

Which MongoDB MCP tools are risky and should be disabled first?

The risky tools are the ones that create, update or delete data, and the Atlas tools that change deployments. The disabledTools option accepts tool names or categories such as create, update, delete, read, metadata, atlas and mongodb. For example, --disabledTools create,update,delete,atlas blocks writes and all Atlas operations. Each tool carries readOnlyHint and destructiveHint annotations, which help AI clients decide when to ask for approval, but those hints are advisory and do not enforce access. Review your tool list against the tools page before rollout.

How DeployOpen works on this

DeployOpen reviews how a MongoDB MCP server is set up for AI clients, from the local server against self-managed deployments to the Atlas-hosted server. The review covers which tools are exposed, how read-only mode, disabled tools and a read-only database user are configured, and what the reviewing team needs to approve the rollout.

How we scope

  • Scope names the local server, the Atlas-hosted server, or both, and the deployments each one may reach.
  • The written scope lists which tool categories are in review, including create, update, delete, read, metadata and Atlas tools.
  • Engagements are fixed-scope, with scope and deliverables agreed in writing before work starts. Ongoing support is available as a retainer.

How we build

  • We test a configured setup with read-only mode, disabled tools and a dedicated read-only database user in place.
  • We check whether write attempts, destructive tool calls and server-side JavaScript are blocked as the configuration claims.
  • We review how connection strings and Atlas API credentials are stored, passed to the client and kept out of prompts and logs.

How we hand over

  • The findings report lists each permission gap, the tool or setting involved, and the fix applied or recommended.
  • Documentation records the exact configuration keys, roles, access modes and client settings the review confirmed.
  • A retest confirms that the fixes hold before the setup is handed to the security and platform teams.

How we support

  • Retainers cover upgrades to the server, since tool lists and defaults can change between releases.
  • Continuous testing repeats the permission checks when new tools, clients or deployments are added.
  • Evidence packs keep the answers, configuration records and test results ready for later security reviews.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.