MongoDB MCP server tools: what read-only mode really stops, and how to make your agent ask

All 53 tools of MongoDB's own MCP server (mongodb-mcp-server 3.3.0), checked by running it against a local MongoDB and a stand-in for the Atlas API: what --readOnly removes, why atlas-connect-cluster still creates a database user and opens the access list in read-only mode, which confirmations need elicitation, and the Claude Code settings that make the rest ask.

Checked on by running mongodb-mcp-server 3.3.0 from mongodb-js/mongodb-mcp-server and reading its tools/list answer. Each tier is the tool risk checker’s reading, with our reason wherever we changed it. Written by the people who make VariantGate.

The short answer

Start it with --readOnly --disabledTools connect and a user that can only read the databases it needs. 23 of its 53 tools can then run on their own, and aggregate and aggregate-db too, on that server only. The flag also removes atlas-connect-cluster, which read-only mode keeps although it creates an Atlas user and access-list entry.

Can run on their own
23
Should ask a person
30

Which MongoDB server this is

This page is about MongoDB’s own server, published on npm as mongodb-mcp-server. We ran version 3.3.0 against MongoDB 7.0 in Docker, and pointed its Atlas tools at a stand-in for the Atlas API that logged every request. With only a connection string it offers 27 tools. Atlas API credentials add 22 more, and four Atlas Local tools appear when the server can reach Docker: 53 in all. With --readOnly it keeps 31.

What --readOnly removes, and what it keeps

Read-only mode drops every tool whose type is create, update or delete, and keeps read, metadata and connect. That held up for the database tools: no insert, update, rename or drop is left, and aggregate, aggregate-db and export refused pipelines with an $out or $merge stage. Without --readOnly, the same aggregate call with $out replaced our users collection with one order, though the tool is marked read-only. explain did not write: we explained $out and $merge pipelines with execution stats, and no collection appeared.

Two kinds of tool stay that read-only mode does not make safe:

  • connect takes any connection string. In a read-only session we connected as a second database user; a different user or host is one call away. --disabledTools connect removes it.
  • atlas-connect-cluster counts as connect too. Called in read-only mode, it added this machine’s IP to the project’s access list and created a temporary database user with readAnyDatabase. Without --readOnly the user gets readWriteAnyDatabase, even with delete and update disabled. The user is deleted when the connection ends or after four hours; the access-list entry was never removed.

Confirmations need a client that can answer

The server asks before drop-database, drop-collection, delete-many, drop-index, atlas-create-db-user, atlas-create-access-list and an $out or $merge pipeline, but only through MCP elicitation. With a client that declared it and declined, the drops, delete-many and the $out pipeline we tried were all refused. With a client that did not, each ran at once: delete-many with an empty filter emptied the collection, drop-database dropped the database, and atlas-create-access-list sent 0.0.0.0/0 to our stand-in Atlas. Some writes never ask: update-many with an empty filter changed every document, and rename-collection with dropTarget replaced an existing collection.

Answers that carry secrets

atlas-create-db-user returns the password it generates, and gave a new user atlasAdmin when asked. mongodb-logs returns mongod’s recent log, and mongod logs a slow operation with its values. We made every operation count as slow, and the log came back with a reset token another session had written. No tool returned the configured connection string: list-connections and the config resource show only that one is set.

Safe setup

claude mcp add mongodb -e MDB_MCP_CONNECTION_STRING="mongodb://agent:…@db.internal:27017/?authSource=admin" -- npx -y mongodb-mcp-server@latest --readOnly --disabledTools connect
db.getSiblingDB("admin").createUser({
  user: "agent", pwd: "…",
  roles: [{ role: "read", db: "app" }]
})

With a read role, the database refused insert-many and mongodb-logs for us, whatever the server allowed. Leave Atlas credentials out unless the agent needs Atlas. If it does, MongoDB’s README lists Project Read Only for viewing clusters and separate roles for database users and access lists; we could not check against real Atlas whether that stops what atlas-connect-cluster creates. export writes whole results to ~/.mongodb/mongodb-mcp/exports for five minutes; set --exportsPath if that folder is shared.

All 53 tools

Hard to undo16 toolsAsk a person every time. Consider two people, or deny it if the agent never needs it.

  • aggregate

    Run an aggregation against a MongoDB collection

    Server says: read-only · toolset mongodb

    Our call: Marked read-only, but a pipeline ending in $out or $merge writes: without --readOnly, $out replaced a whole collection for us, unasked when the client has no elicitation. --readOnly refused both stages.

  • aggregate-db

    Run an aggregation against a MongoDB database

    Server says: read-only · toolset mongodb

    Our call: Marked read-only, but a pipeline ending in $out or $merge writes: without --readOnly, $out replaced a whole collection for us, unasked when the client has no elicitation. --readOnly refused both stages.

  • atlas-connect-cluster

    Connect to MongoDB Atlas cluster and get back a connectionId to pass to the other MongoDB tools.

    Server says: read-only · toolset atlas

    Our call: Marked read-only and kept by --readOnly, but it adds your IP to the project's access list for good and creates a database user, readWriteAnyDatabase unless the server is read-only. We watched both requests.

  • atlas-create-access-list

    Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.

    Server gives no read-only or destructive hint · toolset atlas

    Our call: Opens the project's clusters to the addresses it is given. We passed 0.0.0.0/0, the whole internet, and it sent it on; its confirmation needs a client with elicitation.

  • atlas-create-db-user

    Create an MongoDB Atlas database user

    Server gives no read-only or destructive hint · toolset atlas

    Our call: Creates a database user with any role: we asked for atlasAdmin and got it, with the generated password in the answer.

  • atlas-local-delete-deployment

    Delete a MongoDB Atlas local deployment

    Server says: destructive · toolset atlas-local

  • atlas-pause-resume-cluster

    Pause or resume a dedicated (M10+) MongoDB Atlas cluster (Free and Flex clusters cannot be paused).

    Server says: destructive · toolset atlas

  • atlas-streams-manage

    Manage Atlas Stream Processing resources: start/stop processors, modify pipelines, update configurations.

    Server says: destructive · toolset atlas

  • atlas-streams-teardown

    Delete Atlas Stream Processing resources.

    Server says: destructive · toolset atlas

  • atlas-upgrade-cluster

    Upgrade or scale a MongoDB Atlas cluster.

    Server says: destructive · toolset atlas

  • delete-many

    Removes all documents that match the filter from a MongoDB collection

    Server says: destructive · toolset mongodb

  • drop-collection

    Removes a collection or view from the database.

    Server says: destructive · toolset mongodb

  • drop-database

    Removes the specified database, deleting the associated data files

    Server says: destructive · toolset mongodb

  • drop-index

    Drop an index for the provided database and collection.

    Server says: destructive · toolset mongodb

  • rename-collection

    Renames a collection in a MongoDB database

    Server says: destructive · toolset mongodb

  • update-many

    Updates all documents that match the specified filter for a collection.

    Server says: destructive · toolset mongodb

Moves money1 toolSend the amount. A rule lets small amounts through; above the limit a person decides.

  • atlas-create-cluster

    Create a MongoDB Atlas cluster (M10–M80, replica set or single shard, single or multi-region).

    Server gives no read-only or destructive hint · toolset atlas

    Our call: Creates a dedicated M10 to M80 cluster, a paid tier, with autoscaling on by default.

Not sure5 toolsAsk a person until you have checked what it does.

  • atlas-get-performance-advisor

    Get MongoDB Atlas performance advisor recommendations and suggestions, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max 50) slow query logs

    Server says: read-only · toolset atlas

    Our call: Returns up to 50 slow query log lines. A local mongod logs slow operations with their values, as mongodb-logs showed us; we did not run this one against Atlas.

  • atlas-local-connect-deployment

    Connect to a MongoDB Atlas Local deployment and get back a connectionId to pass to the other MongoDB tools

    Server says: read-only · toolset atlas-local

    Our call: Switches the server's connection to another local Atlas deployment, like connect does, so later calls reach a different database.

  • connect

    Connect to a MongoDB instance and get back a connectionId to pass to the other MongoDB tools.

    Server says: read-only · toolset mongodb

    Our call: Kept by --readOnly, and connects with any connection string the agent passes: we switched to a second user mid-session. --disabledTools connect removes it.

  • export

    Export a query or aggregation results in the specified EJSON format.

    Server says: read-only · toolset mongodb

    Our call: Reads, but writes the whole result, with no 100-document cap, to a file under ~/.mongodb/mongodb-mcp/exports, and is kept by --readOnly.

  • mongodb-logs

    Returns the most recent logged mongod events

    Server says: read-only · toolset mongodb

    Our call: Returns mongod's recent log, and a slow operation is logged with its values: we got back a token another session had written. A role without clusterMonitor cannot read it.

Changes data8 toolsAsk a person. Once it is routine, a standing rule can answer.

  • atlas-create-free-cluster

    Create a free MongoDB Atlas cluster

    Server gives no read-only or destructive hint · toolset atlas

  • atlas-create-project

    Create a MongoDB Atlas project

    Server gives no read-only or destructive hint · toolset atlas

  • atlas-load-sample-dataset

    Load a MongoDB sample dataset into an Atlas cluster, or check the status of a previously-initiated load.

    Server gives no read-only or destructive hint · toolset atlas

    Our call: Writes the sample databases into the cluster. The server marks it as not read-only; the checker read the word load.

  • atlas-local-create-deployment

    Create a MongoDB Atlas local deployment.

    Server gives no read-only or destructive hint · toolset atlas-local

  • atlas-streams-build

    Create Atlas Stream Processing resources.

    Server gives no read-only or destructive hint · toolset atlas

  • create-collection

    Creates a new collection in a database.

    Server gives no read-only or destructive hint · toolset mongodb

  • create-index

    Create an index for a collection

    Server gives no read-only or destructive hint · toolset mongodb

  • insert-many

    Insert an array of documents into a MongoDB collection.

    Server gives no read-only or destructive hint · toolset mongodb

Only looks23 toolsLet it run. It only looks.

  • atlas-get-regions

    List supported MongoDB Atlas regions for a cloud provider.

    Server says: read-only · toolset atlas

  • atlas-inspect-access-list

    Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.

    Server says: read-only · toolset atlas

  • atlas-inspect-cluster

    Inspect metadata of a MongoDB Atlas cluster

    Server says: read-only · toolset atlas

  • atlas-list-alerts

    List triggered alerts for a MongoDB Atlas project.

    Server says: read-only · toolset atlas

  • atlas-list-clusters

    List MongoDB Atlas clusters

    Server says: read-only · toolset atlas

  • atlas-list-db-users

    List MongoDB Atlas database users

    Server says: read-only · toolset atlas

  • atlas-list-orgs

    List MongoDB Atlas organizations

    Server says: read-only · toolset atlas

  • atlas-list-projects

    List MongoDB Atlas projects.

    Server says: read-only · toolset atlas

  • atlas-local-list-deployments

    List MongoDB Atlas local deployments

    Server says: read-only · toolset atlas-local

  • atlas-streams-discover

    Discover and inspect Atlas Stream Processing resources.

    Server says: read-only · toolset atlas

  • collection-indexes

    Describe the indexes for a collection

    Server says: read-only · toolset mongodb

  • collection-schema

    Describe the schema for a collection

    Server says: read-only · toolset mongodb

  • collection-storage-size

    Gets the size of the collection

    Server says: read-only · toolset mongodb

  • count

    Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter

    Server says: read-only · toolset mongodb

  • db-stats

    Returns statistics that reflect the use state of a single database

    Server says: read-only · toolset mongodb

  • disconnect

    Close a MongoDB connection and revoke its connectionId.

    Server says: read-only · toolset mongodb

    Our call: Only closes a connection this server opened. The checker reads the word close as a change.

  • explain

    Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method

    Server says: read-only · toolset mongodb

  • find

    Run a find query against a MongoDB collection

    Server says: read-only · toolset mongodb

    Our call: Marked read-only, and only reads; $where and other server-side JavaScript are refused by default. The checker reads the word run.

  • list-collections

    List all collections for a given database

    Server says: read-only · toolset mongodb

  • list-connections

    List the active MongoDB connections and their connectionIds.

    Server says: read-only · toolset mongodb

  • list-databases

    List all databases for a MongoDB connection

    Server says: read-only · toolset mongodb

  • list-knowledge-sources

    List available data sources in the MongoDB Assistant knowledge base.

    Server says: read-only · toolset assistant

  • search-knowledge

    Search for information in the MongoDB Assistant knowledge base.

    Server says: read-only · toolset assistant

    Our call: Searches MongoDB's documentation. The question the model writes is sent to knowledge.mongodb.com, so keep secrets out of prompts.

Let the reads run in Claude Code

Claude Code asks before every MCP tool it has no rule for. Added as mongodb, this server’s tools are named mcp__mongodb__<tool>. These allow rules, in .claude/settings.json or ~/.claude/settings.json, let the tools that only look run without a prompt. Everything else keeps asking, including any tool a later version of the server adds.

{
  "permissions": {
    "allow": [
      "mcp__mongodb__atlas-get-regions",
      "mcp__mongodb__atlas-inspect-access-list",
      "mcp__mongodb__atlas-inspect-cluster",
      "mcp__mongodb__atlas-list-alerts",
      "mcp__mongodb__atlas-list-clusters",
      "mcp__mongodb__atlas-list-db-users",
      "mcp__mongodb__atlas-list-orgs",
      "mcp__mongodb__atlas-list-projects",
      "mcp__mongodb__atlas-local-list-deployments",
      "mcp__mongodb__atlas-streams-discover",
      "mcp__mongodb__collection-indexes",
      "mcp__mongodb__collection-schema",
      "mcp__mongodb__collection-storage-size",
      "mcp__mongodb__count",
      "mcp__mongodb__db-stats",
      "mcp__mongodb__disconnect",
      "mcp__mongodb__explain",
      "mcp__mongodb__find",
      "mcp__mongodb__list-collections",
      "mcp__mongodb__list-connections",
      "mcp__mongodb__list-databases",
      "mcp__mongodb__list-knowledge-sources",
      "mcp__mongodb__search-knowledge"
    ]
  }
}

The command that adds the server:

claude mcp add mongodb -e MDB_MCP_CONNECTION_STRING="mongodb://agent:…@db.internal:27017/?authSource=admin" -- npx -y mongodb-mcp-server@latest --readOnly --disabledTools connect

Send the rest to a person, not the terminal

A prompt in the terminal only works while someone is watching it. With this hook, every other tool of the server becomes a request in your VariantGate inbox, on your phone or in Slack, and Claude Code waits for the answer. The matcher names the look-only tools, so a tool added later is sent too. Put the key in VARIANTGATE_KEY, or run the one-command setup for Claude Code first.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__mongodb__(?!(atlas-get-regions|atlas-inspect-access-list|atlas-inspect-cluster|atlas-list-alerts|atlas-list-clusters|atlas-list-db-users|atlas-list-orgs|atlas-list-projects|atlas-local-list-deployments|atlas-streams-discover|collection-indexes|collection-schema|collection-storage-size|count|db-stats|disconnect|explain|find|list-collections|list-connections|list-databases|list-knowledge-sources|search-knowledge)$).*",
        "hooks": [
          { "type": "command", "command": "variantgate hook claude-code", "timeout": 180 }
        ]
      }
    ]
  }
}

Disagree with a tier, or run the server with other flags? Open these tools in the tool risk checker, change what you like, and copy the settings for your own setup. It runs in your browser and starts from its own reading, so a tool we marked as only looking by hand asks there until you change it.

Any MCP client: put the proxy in front

Claude Desktop, Cursor and most other MCP clients have no hook to send a call to a person. The VariantGate MCP proxy does it in the server’s place: it starts the server, lets the look-only tools above through, and holds every other call until someone approves it in the inbox. Run npx -y https://variantgate.com/sdk/variantgate-agent-0.15.0.tgz login once to save a key, then use this in claude_desktop_config.json or ~/.cursor/mcp.json:

{
  "mcpServers": {
    "mongodb": {
      "args": [
        "-y",
        "https://variantgate.com/sdk/variantgate-agent-0.15.0.tgz",
        "mcp-proxy",
        "--name",
        "mongodb",
        "--look-only",
        "atlas-get-regions,atlas-inspect-access-list,atlas-inspect-cluster,atlas-list-alerts,atlas-list-clusters,atlas-list-db-users,atlas-list-orgs,atlas-list-projects,atlas-local-list-deployments,atlas-streams-discover,collection-indexes,collection-schema,collection-storage-size,count,db-stats,disconnect,explain,find,list-collections,list-connections,list-databases,list-knowledge-sources,search-knowledge",
        "--",
        "npx",
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly",
        "--disabledTools",
        "connect"
      ],
      "command": "npx",
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://agent:…@db.internal:27017/?authSource=admin"
      }
    }
  }
}

Already have it in Claude Desktop? One command rewrites the file for you, with these look-only tools filled in, and keeps the old one (setup vscode does the same for VS Code; how it works):

npx -y https://variantgate.com/sdk/variantgate-agent-0.15.0.tgz setup claude-desktop

The same in Claude Code, instead of the hook. The proxy now asks about every call that matters, so an allow rule for the whole server, mcp__mongodb, keeps Claude Code from asking a second time in the terminal:

claude mcp add mongodb -e MDB_MCP_CONNECTION_STRING="mongodb://agent:…@db.internal:27017/?authSource=admin" -- npx -y https://variantgate.com/sdk/variantgate-agent-0.15.0.tgz mcp-proxy --name mongodb --look-only atlas-get-regions,atlas-inspect-access-list,atlas-inspect-cluster,atlas-list-alerts,atlas-list-clusters,atlas-list-db-users,atlas-list-orgs,atlas-list-projects,atlas-local-list-deployments,atlas-streams-discover,collection-indexes,collection-schema,collection-storage-size,count,db-stats,disconnect,explain,find,list-collections,list-connections,list-databases,list-knowledge-sources,search-knowledge -- npx -y mongodb-mcp-server@latest --readOnly --disabledTools connect

Claude Code’s allow rules match a tool’s name, never its arguments, so a rule cannot tell a harmless call of these tools from a risky one. On a server started with --readOnly, signed in as a user without the inprog privilege (so no clusterMonitor role), and only there, these rules also let aggregate, aggregate-db run unasked:

{
  "permissions": {
    "allow": [
      "mcp__mongodb__atlas-get-regions",
      "mcp__mongodb__atlas-inspect-access-list",
      "mcp__mongodb__atlas-inspect-cluster",
      "mcp__mongodb__atlas-list-alerts",
      "mcp__mongodb__atlas-list-clusters",
      "mcp__mongodb__atlas-list-db-users",
      "mcp__mongodb__atlas-list-orgs",
      "mcp__mongodb__atlas-list-projects",
      "mcp__mongodb__atlas-local-list-deployments",
      "mcp__mongodb__atlas-streams-discover",
      "mcp__mongodb__collection-indexes",
      "mcp__mongodb__collection-schema",
      "mcp__mongodb__collection-storage-size",
      "mcp__mongodb__count",
      "mcp__mongodb__db-stats",
      "mcp__mongodb__disconnect",
      "mcp__mongodb__explain",
      "mcp__mongodb__find",
      "mcp__mongodb__list-collections",
      "mcp__mongodb__list-connections",
      "mcp__mongodb__list-databases",
      "mcp__mongodb__list-knowledge-sources",
      "mcp__mongodb__search-knowledge",
      "mcp__mongodb__aggregate",
      "mcp__mongodb__aggregate-db"
    ]
  }
}

When the agent should write

Run a second server without --readOnly, with a user that can write only the collections it needs, under its own name such as mongodb-write, so the allow rules above do not cover it. Every write tool of that server should ask in Claude Code, not just the ones the server confirms: the person who answers sees the filter, and an empty one is caught before it runs.

See it before you decide.

The playground runs the whole approval loop in your browser, no account needed. When it fits, the free plan covers 100 requests a month.