Menu

AI

MongoDB MCP Server: Tools, Setup and Security

What MongoDB's official MCP server can do across databases and Atlas, how to run it locally or use the hosted Atlas server, and how --readOnly limits it.

By: Irina ShvayaOctober 28, 2026

MongoDB MCP Server: Tools, Setup and Security

This profile is part of our MCP server directory, within The MCP Guide. Profiles are checked against each vendor's own documentation. Need a server built? See MCP development.

The MongoDB MCP server lets an AI app query and manage MongoDB databases and MongoDB Atlas. It can run finds and aggregations, describe schemas and indexes, and create or scale Atlas clusters. MongoDB publishes it as open source, and also runs an Atlas-hosted version that uses OAuth.

Checked against: MongoDB MCP Server README on 28 October 2026. eSEOspace did not install or test this server.

Key Takeaways

  • You can run the server locally with npx against any MongoDB connection string, or use the Atlas-hosted server with OAuth.
  • Every config example in MongoDB's README includes --readOnly, which removes create, update and delete tools.
  • By default, risky tools such as drop-database, drop-collection and delete-many ask for confirmation, if your client supports elicitation.
  • Tool results are wrapped with a prompt-injection warning unless you turn that off.
  • MongoDB advises passing connection strings and API credentials as environment variables, not command-line arguments.

At a glance

ItemDetail
PublisherMongoDB
Official?Yes
HostingBoth: local npm package (mongodb-mcp-server) and an Atlas-hosted remote server
Transportstdio locally; HTTP option for the local server; remote server over HTTP
Sign-inConnection string or Atlas service account (local); OAuth (Atlas-hosted)
Read or writeRead and write; --readOnly available
PriceNo separate MCP price listed
Source codemongodb-js/mongodb-mcp-server
StatusNot stated

What it can do

The README lists four tool groups.

Database tools include find, aggregate, count, collection-schema, collection-indexes, explain, export, list-databases and list-collections. Write tools include insert-many, update-many, delete-many, create-collection, create-index, rename-collection, drop-collection, drop-index and drop-database.

Atlas tools need Atlas API credentials. They include atlas-list-clusters, atlas-inspect-cluster, atlas-create-free-cluster, atlas-create-cluster, atlas-upgrade-cluster, atlas-pause-resume-cluster, atlas-create-db-user, atlas-create-access-list, atlas-get-performance-advisor and atlas-list-alerts. Four atlas-streams-* tools manage Atlas Stream Processing.

Atlas Local tools create, connect to, list and delete local Atlas deployments.

Assistant tools are list-knowledge-sources and search-knowledge, which search MongoDB's documentation and guidance.

The server also offers resources: config, debug and an exported-data template for files made by export.

How to connect it

MongoDB's quickest route is its official plugins. The mongodb-atlas plugin connects to the Atlas-hosted server over OAuth. MongoDB calls it the recommended way to reach Atlas. The mongodb plugin runs the server locally for self-managed databases. Plugins exist for Cursor, VS Code, Claude, Codex, GitHub Copilot CLI and Grok.

For a guided local setup, MongoDB gives:

npx -y mongodb-mcp-server@latest setup

A manual config with a connection string looks like this in the README:

{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}

The local server needs Node.js 22.13 or later. MongoDB says Node 20 support is deprecated. A Docker image is also documented.

The README notes that you cannot sign in to the remote Atlas server with a static API key over HTTP. Use a client that supports OAuth, or the mongodb-atlas-mcp-remote stdio package with service account credentials.

Security notes

MongoDB builds several safety defaults into the server:

  • Read-only mode. --readOnly or MDB_MCP_READ_ONLY=true registers only read, connect and metadata tools. MongoDB's examples all include it. Its getting started guide says: "For security, always enable read-only mode unless you must perform write operations."
  • Confirmation. MDB_MCP_CONFIRMATION_REQUIRED_TOOLS defaults to a list that includes drop-database, drop-collection, delete-many, drop-index, atlas-create-db-user and atlas-create-access-list. This needs a client that supports elicitation, a feature defined in the MCP specification.
  • Untrusted data warning. Results are wrapped in delimiters with a prompt-injection warning unless MDB_MCP_DISABLE_UNTRUSTED_DATA_WARNING is set to true. Leave it on. See prompt injection through MCP tool results.
  • Disabled tools. MDB_MCP_DISABLED_TOOLS lets you remove specific tools.
  • Server-side JavaScript is disabled by default.

MongoDB also gives two "Security Recommendations." Give Atlas service accounts only the minimum permissions they need. And pass secrets as environment variables, because command-line arguments "can be visible in process lists and logged." For more on that risk, read secrets and credential leakage in MCP and the MCP security hub.

Alternatives

See every database profile in the MCP server directory.

Next step

Decide whether your team needs Atlas admin tools at all. If you only want answers from data, run with --readOnly and no Atlas credentials. For help planning access, see our MCP readiness audit.

Frequently asked questions

Is the MongoDB MCP server read-only by default?

Not by default. The readOnly setting defaults to false. However, every configuration example in MongoDB's README includes --readOnly, and MongoDB says to remove it only if you need writes.

Can it work with self-hosted MongoDB, not just Atlas?

Yes. The local server accepts any MongoDB connection string, whether the database runs locally or in Atlas. The Atlas tools need Atlas service account credentials.

Does the MongoDB MCP server ask before deleting data?

By default it asks for confirmation before tools such as drop-database, drop-collection and delete-many. This only works if your MCP client supports elicitation, so do not rely on it alone.

Is there a hosted MongoDB MCP server?

Yes. MongoDB runs an Atlas-hosted MCP server that uses OAuth. The mongodb-atlas plugin connects to it, and MongoDB calls this the recommended way to work with Atlas.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.