MCP.so
Sign In

MongoDB MCP Server

@mongodb-js

About MongoDB MCP Server

A Model Context Protocol server to connect to MongoDB databases and MongoDB Atlas Clusters.

Basic information

Category

Databases

License

Apache-2.0

Runtime

node

Transports

stdio

Publisher

mongodb-js

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb+srv://username:[email protected]/myDatabase"
      }
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is MongoDB MCP Server?

It is a Model Context Protocol server for interacting with MongoDB databases and MongoDB Atlas. It allows AI assistants to perform read‑only (or optionally write) database operations and manage Atlas resources using either a MongoDB connection string or Atlas API service account credentials.

How to use MongoDB MCP Server?

Requires Node.js v22.13 or later. Configure it in your MCP client (e.g., VS Code, Cursor, Claude Desktop) by running npx -y mongodb-mcp-server@latest with the --readOnly flag by default. Pass credentials via environment variables (MDB_MCP_CONNECTION_STRING or MDB_MCP_API_CLIENT_ID/MDB_MCP_API_CLIENT_SECRET). Docker images are also available.

Key features of MongoDB MCP Server

  • Supports MongoDB Atlas tools (API‑based) and database tools (driver‑based).
  • Provides MongoDB assistant tools for common help tasks.
  • Reads database schemas, collections, and indexes as resources.
  • Configurable via environment variables, command‑line arguments, or MCP client configuration.
  • Runs as a standalone service or inside a Docker container.
  • Defaults to read‑only mode; remove --readOnly to enable writes.

Use cases of MongoDB MCP Server

  • Query and explore MongoDB databases through a conversational AI assistant.
  • Manage Atlas clusters, projects, and API keys using service account credentials.
  • Retrieve database schemas and indexes for documentation or migration planning.
  • Deploy as a microservice on public clouds such as Azure.

FAQ from MongoDB MCP Server

What are the prerequisites to run MongoDB MCP Server?

Node.js v22.13 or later is required. A MongoDB connection string or Atlas API service account credentials must be provided.

Is the server read‑only by default?

Yes. All configuration examples include the --readOnly flag. Remove it if you need write operations.

Can I run MongoDB MCP Server using Docker?

Yes. A Docker image mongodb/mongodb-mcp-server:latest is available. Pass environment variables via -e flags or through an MCP configuration file.

How do I pass credentials securely?

The README strongly recommends using environment variables (MDB_MCP_CONNECTION_STRING, MDB_MCP_API_CLIENT_ID, MDB_MCP_API_CLIENT_SECRET) instead of command‑line arguments to avoid exposing secrets in process lists or logs.

Which MCP clients are supported?

Configuration examples are provided for Windsurf, VS Code, Claude Desktop, Cursor, Copilot CLI, and Opencode CLI.

Comments

More Databases MCP servers