Server profile

MongoDB MCP Server

MongoDB MCP Server connects AI clients to MongoDB databases and Atlas. Its tools cover queries, schema inspection, database changes, and MongoDB knowledge searches, with read-only launch examples for safer exploration.

Server facts

MongoDB MCP Server

Project

License
Apache-2.0
Category
Databases

Tech

Runtime / language
node
Transports
stdio
Remote available
No
Authentication
Not specified

Activity

GitHub stars
1,143
Last commit
Data as of

Tags

  • Database Queries
  • Mongodb
  • Mongodb Atlas
  • Schema Inspection

Overview

MongoDB MCP Server exposes database and Atlas interactions to MCP-compatible assistants. A connection string can target either a local MongoDB instance or an Atlas cluster, while Atlas-specific tools require service-account credentials. The supplied tool inventory spans document queries, aggregation, collection schemas, indexes, storage measurements, execution-plan inspection, and database statistics. It also includes operations that insert, update, delete, rename, or remove database objects. Separate knowledge tools search MongoDB Assistant resources and enumerate their available sources, allowing documentation-oriented questions alongside direct database work.

The README's client examples enable read-only mode, which must be removed when write access is needed. It recommends passing connection strings and credentials through environment variables rather than exposing them in process arguments, and assigning minimal Atlas permissions. A recent Node.js runtime is required: the stated baseline is version 22.13.0, with Node 20 support marked deprecated. Users can launch through npx or Docker; the container option avoids installing Node.js locally. Standard input/output is the default transport, and Streamable HTTP is also documented. The HTTP instructions explicitly warn against direct internet exposure without authentication and other protective measures. Multiple database connections can coexist, with identifiers used by subsequent operations and tools available to list or close active connections.

Install & configure

Requirements

  • Node.js 22.13.0 or later
  • A MongoDB connection string or Atlas service-account credentials
  • An MCP-compatible client
Documented launch / install command
npx -y mongodb-mcp-server@latest --readOnly

This is the README's read-only connection-string setup. Atlas operations instead need MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET. Docker and HTTP alternatives are documented; HTTP needs deployment-level authentication and protection.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "mongodb-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository tool metadata. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
aggregate-dbExecute a database-level aggregation pipeline.
aggregateExecute an aggregation pipeline on a collection.
collection-indexesInspect indexes attached to a collection.
collection-schemaInspect a collection's document structure.
collection-storage-sizeReport storage size for a collection.
connectOpen an independent MongoDB connection and return its identifier.
countCount collection documents, optionally constrained by a query.
create-collectionAdd a collection, creating its database if necessary.
create-indexAdd an index to a collection.
db-statsReport usage statistics for one database.
delete-manyDelete collection documents selected by a filter.
disconnectClose a connection; a configured default connection can reopen on later use.
drop-collectionRemove a collection or view together with its indexes.
drop-databaseDelete a database and its associated data files.
drop-indexRemove a specified collection index.
explainInspect execution statistics for the optimizer's selected query plan.
exportSave query or aggregation output in the requested EJSON format.
findSearch documents within a collection.
insert-manyInsert a document array, splitting large payloads into batches when needed.
list-collectionsEnumerate collections belonging to a database.
list-connectionsShow active connection identifiers, including any preconfigured connection.
list-databasesEnumerate databases reachable through a connection.
mongodb-logsRead recent events logged by mongod.
rename-collectionChange a collection's name.
update-manyModify collection documents that satisfy a filter.
list-knowledge-sourcesDiscover sources and filtering options in the MongoDB Assistant knowledge base.
search-knowledgeSearch MongoDB documentation and expert resources with source and version filters.

Names, permissions, and defaults can change. Check the current upstream documentation before granting access.

Use cases

  • Inspect collection schemas and indexes before writing queries.
  • Run document searches and aggregation pipelines from an assistant.
  • Review query plans, database statistics, and recent MongoDB logs.
  • Search MongoDB documentation and curated knowledge sources.

Strengths

  • Covers both local MongoDB and Atlas connections.
  • Read-only examples provide a conservative starting configuration.
  • Offers database operations and MongoDB knowledge lookup in one server.

Limitations

  • Atlas tools require separate service-account credentials.
  • HTTP deployments need additional security controls.
  • Write-enabled tools can delete data and database objects.

Frequently asked questions

Yes. A connection string can point to a local MongoDB instance or an Atlas cluster.

No. The selected README example includes --readOnly. Removing that flag permits write operations subject to database permissions.

They require Atlas API service-account credentials and the permissions needed for the requested operations.

Streamable HTTP is documented, but the README warns that authentication, TLS, network restrictions, and other protections are needed.

Independent listing, not an affiliation or security review. Grant the least access needed and verify the upstream instructions before running code.

Related MCP servers

MCP Alchemy

Databases

MCP Alchemy lets Claude Desktop inspect SQL database structure and execute queries through SQLAlchemy. An optional companion integration exposes complete result sets when the normal response is shortened.

Qdrant MCP Server

Memory & Knowledge

Qdrant MCP Server stores information and retrieves relevant memories through semantic search. It connects MCP clients to a Qdrant service or a local database path.

Neon MCP Server

Databases

Manage Neon Postgres projects, branches, queries, and migrations through an AI assistant. The hosted MCP service supports OAuth or API keys, read-only access, and project-level scoping.

MCP Toolbox for Databases

Databases

MCP Toolbox for Databases connects agents and IDEs to enterprise data through prebuilt tools or custom query definitions. It combines database access with connection pooling, authentication integration, and observability.

MCP Server for MySQL

Databases

MCP Server for MySQL lets Claude and other AI clients inspect schemas and execute SQL. It defaults to read-only access, with optional write flags, SSH tunneling, multi-database support, and result redaction.

DBHub

Databases

DBHub exposes SQL execution and database discovery through a small MCP interface. It spans five database engines, supports multiple configured connections, and includes a web workbench for use without an assistant.

Supabase MCP Server

Databases

Connect AI assistants to Supabase projects for SQL, schema changes, debugging, and Edge Functions. Hosted HTTP setup supports project scoping, read-only access, and selectable feature groups.

Postgres MCP Pro

Databases

Give assistants PostgreSQL schema access, SQL execution, health checks, and performance analysis. Postgres MCP Pro adds query plans and hypothetical index evaluation with configurable read-only operation.