Skip to content
← All MCP servers

Is the MongoDB MCP server safe? What it can reach

What the MongoDB MCP server can read, write and delete, how it signs in, and how to limit it in Claude Code and Codex.

Official serverChecked

MongoDB maintains this server, which runs locally over stdio and connects with a database connection string. With Atlas service account credentials it can also create clusters, add database users and open IP access. It can drop databases. Start it with --readOnly, which removes every create, update and delete tool.

Who maintains it

ImplementationKindStatus
MongoDB MCP Server (mongodb-js/mongodb-mcp-server)Officialactive
MongoDB Atlas remote MCP server (OAuth, via mongodb-atlas-mcp-remote)Officialactive

It runs as a local process on your machine or as a hosted remote server.

How it signs in

Database tools use a MongoDB connection string (MDB_MCP_CONNECTION_STRING), so they act with that database user’s rights. Atlas tools use Atlas service account credentials (MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET) and act with the roles you gave that service account. The Atlas-managed remote server uses OAuth.

Scope or permissionAccess
Org Member or Org Read Only (list orgs and projects)read
Project Read Only (view clusters and databases)read
Org Project Creator (create projects)write
Project Cluster Manager (create and manage clusters)write
Project IP Access List Admin (manage access lists)admin
Project Database Access Admin (manage database users)admin
Project Stream Processing Owner (manage stream processing)admin

What its tools can do

KindTools
Readaggregate, aggregate-db, collection-indexes, collection-schema, collection-storage-size, connect, count, db-stats, disconnect, explain, export, find, list-collections, list-connections, list-databases, mongodb-logs, atlas-connect-cluster, atlas-get-performance-advisor, 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-connect-deployment, atlas-local-list-deployments, atlas-streams-discover, list-knowledge-sources, search-knowledge
Writecreate-collection, create-index, insert-many, update-many, rename-collection, atlas-create-free-cluster, atlas-create-project, atlas-load-sample-dataset, atlas-local-create-deployment
Can’t be undonedelete-many, drop-collection, drop-database, drop-index, atlas-create-access-list, atlas-create-db-user, atlas-create-cluster, atlas-upgrade-cluster, atlas-pause-resume-cluster, atlas-streams-build, atlas-streams-manage, atlas-streams-teardown, atlas-local-delete-deployment

Atlas tools only load when Atlas credentials are set. aggregate and aggregate-db can write when a pipeline has a $out or $merge stage; the server asks for confirmation in that case. Some Atlas tools may create billable resources.

Built-in limits

OptionWhat it does
--readOnly / MDB_MCP_READ_ONLY=trueLimits the server to read, connect and metadata tools. Tools that create, update or delete are not registered.
--disabledTools / MDB_MCP_DISABLED_TOOLSTurns off tools by name, by category (atlas, mongodb) or by operation type (create, update, delete, read, metadata, connect).
--confirmationRequiredTools / MDB_MCP_CONFIRMATION_REQUIRED_TOOLSAsks you to confirm listed tools before they run. The default list is drop-database, drop-collection, delete-many, drop-index, atlas-create-db-user, atlas-create-access-list, atlas-streams-manage and atlas-streams-teardown. The client must support elicitation.
--indexCheck / MDB_MCP_INDEX_CHECK=trueRejects queries that would scan the whole collection.
--maxDocumentsPerQuery and --maxBytesPerQueryCaps results per query. Defaults are 100 documents and 16777216 bytes.
--disableServerSideJsBlocks server-side JavaScript. It defaults to true.
--telemetry disabled / MDB_MCP_TELEMETRY=disabledTurns off the server’s telemetry.

The risks

  • A prompt injected through document content could make the agent call delete-many, drop-collection or drop-database. Only the default confirmation list and --readOnly stand in the way.
  • The connection string carries one database user’s rights for every tool call. If that user can write, the agent can write to every database the user can reach.
  • With Atlas credentials loaded, atlas-create-access-list and atlas-create-db-user can open network and database access. atlas-create-cluster and atlas-upgrade-cluster can add cost.
  • The README warns that Organization Owner is rarely needed. A service account with that role gives the agent the whole organization.
  • Stored documents can contain text that reads like instructions. The server has a setting for the untrusted-data warning, so leave it on.

Limit it in Claude Code

Add it from the documented launch settings, at local or user scope so a token never lands in a shared .mcp.json:

claude mcp add --env MDB_MCP_CONNECTION_STRING=... mongodb -- npx -y mongodb-mcp-server@latest --readOnly

Claude Code names MCP tools mcp__mongodb__<tool>. Deny rules win over ask rules, and ask rules over allow rules. Put these in ~/.claude/settings.json or the project’s .claude/settings.json:

{
  "permissions": {
    "deny": [
      "mcp__mongodb__drop-database",
      "mcp__mongodb__drop-collection",
      "mcp__mongodb__drop-index",
      "mcp__mongodb__delete-many",
      "mcp__mongodb__atlas-create-access-list",
      "mcp__mongodb__atlas-create-db-user",
      "mcp__mongodb__atlas-streams-teardown",
      "mcp__mongodb__atlas-local-delete-deployment"
    ],
    "ask": [
      "mcp__mongodb__insert-many",
      "mcp__mongodb__update-many",
      "mcp__mongodb__create-index",
      "mcp__mongodb__rename-collection",
      "mcp__mongodb__create-collection",
      "mcp__mongodb__atlas-create-cluster",
      "mcp__mongodb__atlas-upgrade-cluster",
      "mcp__mongodb__atlas-pause-resume-cluster",
      "mcp__mongodb__atlas-streams-build",
      "mcp__mongodb__atlas-streams-manage"
    ]
  }
}

Limit it in Codex

Codex reads MCP servers from ~/.codex/config.toml. disabled_tools removes tools, and enabled_tools keeps only the ones you list:

[mcp_servers.mongodb]
command = "npx"
args = ["-y", "mongodb-mcp-server@latest", "--readOnly"]
env_vars = ["MDB_MCP_CONNECTION_STRING"]
disabled_tools = ["drop-database", "drop-collection", "drop-index", "delete-many", "atlas-create-access-list", "atlas-create-db-user", "atlas-streams-teardown", "atlas-local-delete-deployment"]

Checklist

  • Start with --readOnly and a database user that can only read.
  • Give the Atlas service account Project Read Only unless you need more.
  • Keep the default confirmation list and add any tool you worry about.
  • Add --indexCheck and keep the document limits on production data.
  • Leave Atlas credentials unset if you only need to query one database.

Checked against the vendor documentation on November 25, 2026. MongoDB MCP Server README · MongoDB MCP Server repository

What Excellent covers

Excellent doesn’t inspect MCP servers themselves. Its free scan reads supported logs on the Mac (Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code) and reports findings for review, so you can see what an agent did after a session. Run the free scan · See a sample report · How to vet any MCP server

Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Pro is US-only for now. Agent coverage · Pricing