MCP server Official

MongoDB MCP Server

Official MongoDB MCP server: query and manage MongoDB databases and Atlas from an AI agent, with a read-only mode.

Author
MongoDB
Works with
Any MCP client, Cursor, Gemini CLI, OpenAI Codex
License
Apache-2.0
Last release
Oct 1, 2026
Documented
Oct 2, 2026
Maintainer
Official vendor server
Last commit
Oct 29, 2026
Runs as
Local via npx
Security scan
Not confirmed

What MongoDB MCP Server is

A Model Context Protocol server for interacting with MongoDB databases and MongoDB Atlas. It runs locally via npx and connects with a connection string or Atlas API service-account credentials. The README recommends starting in read-only mode.

What it does

How MongoDB MCP Server plugs in: which agents run it and what it addsRUNS INYour agentAny MCP clientCursorOpenAI CodexGemini CLI4 hosts documentedMCP SERVER · OFFICIALMongoDB MCP ServerConnect the agent to tools, data…5 install steps2 permission noteslicense: Apache-2.0WHAT IT ADDSWhat it doesRun find, aggregate, count and ex…Inspect databases, collections, s…Insert, update and delete documen…Create and drop collections and i…agent → extension → new capability · from the official repository or docs
Where MongoDB MCP Server runs and what it adds, from its documentation
  • Run find, aggregate, count and explain against collections
  • Inspect databases, collections, schemas, indexes and storage size
  • Insert, update and delete documents when not in read-only mode
  • Create and drop collections and indexes
  • Export query results in EJSON format
  • Manage Atlas resources when Atlas API credentials are provided

When to use it

Good fit

  • You want an agent to explore or query a MongoDB or Atlas deployment
  • You need read-only database access for an AI assistant
  • You want Atlas administration tools in the same server

Not for

  • You cannot run Node.js 22.13+ (Docker is documented as an alternative)
  • You want write access without confirmation prompts on destructive tools (several tools require confirmation by default)

How to install MongoDB MCP Server

You need: Node.js v22.13.0 or later; A MongoDB connection string or Atlas API service-account credentials (required for Atlas tools)

Install in one click Add to Cursor

Cursor opens and asks you to confirm the server. For Claude Code or VS Code, paste the copied command into a terminal. For Claude Desktop, paste the configuration example below into Settings, Developer, Edit Config.

  1. Install Node.js v22.13.0 or later
  2. Run interactive setup: npx -y mongodb-mcp-server@latest setup
  3. Or add the server to your MCP client config with npx -y mongodb-mcp-server@latest --readOnly
  4. Pass MDB_MCP_CONNECTION_STRING or Atlas API credentials (MDB_MCP_API_CLIENT_ID / MDB_MCP_API_CLIENT_SECRET) via env
  5. Remove --readOnly only if you need write operations
Configuration example (from the official docs)
{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}

Permissions and security

What it can access

  • Reads and, unless --readOnly is set, writes data in the connected MongoDB deployment
  • Atlas tools act with the permissions of the supplied service account

Security notes from the maintainers

  • README recommends minimum permissions for the Atlas service account
  • README strongly recommends environment variables instead of command-line arguments for connection strings and API credentials
  • Telemetry is enabled by default (MDB_MCP_TELEMETRY / --telemetry)
  • Destructive tools such as drop-database, drop-collection and delete-many require confirmation by default

Review the source before granting an agent access to credentials or production systems. We document what the maintainers state; we do not audit code.

Limitations

  • Atlas tools need Atlas API service-account credentials
  • Node 20.x support is deprecated

Tools it extends

Frequently asked questions

Does the MongoDB MCP Server support read-only mode?

Yes. Start it with the --readOnly flag (or MDB_MCP_READ_ONLY); the README's examples all include it by default. source

What Node.js version does the MongoDB MCP Server need?

Node.js v22.13.0 or later; Node 20.x support is deprecated. A Docker option avoids a local Node install. source

How does the MongoDB MCP Server connect to my database?

Through a connection string (MDB_MCP_CONNECTION_STRING) or Atlas API service-account credentials; the README prefers environment variables over CLI arguments. source

Can the MongoDB MCP Server manage Atlas?

Yes, with Atlas API service-account credentials it exposes Atlas tools; the README advises minimum permissions. source

Related guides

Sources and gaps

More extensions to look at