Discover / Development

MongoDB MCP Server

by mongodb-jsTypeScript

MCP server to query MongoDB databases and Atlas clusters from coding agents.

MCP Serveractive

Maturity: active because commit 1d ago, latest release v2.1.1. Derived from release and commit history, not a rating.

Stars
1.1k
Forks
286
Downloads / mo
Last commit
2026-09-09
License
Apache-2.0
Open issues
23

Market and trust evidence

Edition not yet matched
Trust stateAvoidRecorded review — not endorsed
Review methodenrichment-staticTop installable trust gate
Selection rank#46Among Claude Skills and MCP Servers
Partner auditunknownNo crown clearance
SkillPilot static reviewavoid

1 finding require review.

Partner audit summaryunknown

No partner audit was returned. Status remains unknown.

Trust analysis is a screening signal, not a security warranty. Read the ranking and trust methodology.

Install

Derived from the published package name in the repository, not from a model.

Video walkthroughs

Third-party YouTube uploads matched to this tool by title, channel and repository name. Not made, reviewed or endorsed by SkillPilot. View counts and publish months are as of the match date and the month is approximate. Nothing loads from YouTube until you press play.

What the repository ships

CI configured

Detected from the actual files in the repository root.

Latest release v2.1.1

Published 2026-09-03

What's New

You can now create Atlas clusters with multi-region support and Customer-Managed Key (CMK) encryption, pause or resume clusters, load sample data, and look up available cloud regions using the new atlas-get-regions tool. Aggregation pipelines that include write stages like $out or $merge now prompt for explicit user confirmation before executing, helping prevent accidental data modifications. Connection management has been made more explicit, sensitive configuration values are now redacted from logs and resource output, and input validation has been tightened across tools to reject unrecognized arguments and enforce required fields.

<!-- Release notes generated using configuration in .github/release.yml at 2e8eae98d1301ca48f1e81273a3f3d5c5820f216 -->

Full Changelog: https://github.com/mongodb-js/mongodb-mcp-server/compare/v2.1.0...v2.1.1

Tags

README

Install in VS Code

Install in Cursor

MongoDB MCP Server

A Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas.

Quick Start

Using the official MongoDB plugins for AI agents

MongoDB MCP Server comes bundled with the official MongoDB plugins for AI agents. The following plugins are available:

mongodb-atlas — connects to the MongoDB-hosted Atlas MCP server over OAuth. This does not require you to run anything locally, and is the recommended way to connect to MongoDB Atlas from your AI agent:

  • Cursor: marketplace
  • VSCode: Open the Extensions view (⇧⌘X / Ctrl+Shift+X), search for @agentPlugins, and install mongodb-atlas.
  • Claude: marketplace
  • Codex: Open /plugins and install mongodb-atlas.
  • GitHub Copilot CLI: Run copilot plugin install mongodb-atlas.
  • Grok: Open /marketplace in Grok Build and install mongodb-atlas.

mongodb — runs the MongoDB MCP server locally and connects to any self-managed deployment:

  • Cursor: marketplace
  • Claude: marketplace
  • Gemini: marketplace
  • Codex: Run codex plugin marketplace add mongodb/agent-skills, then open /plugins and install mongodb.
  • GitHub Copilot CLI: Run copilot plugin install mongodb.
  • Grok: Open /marketplace in Grok Build and install mongodb.
Using the setup script

You can manually set up the local MCP server by running the following command:


npx -y mongodb-mcp-server@latest setup

This will guide you through an interactive setup process, including configuring your MongoDB connection string or Atlas API credentials.

For more advanced setup options, see the Manual Setup section below.

Using the MongoDB MCP Server setup skill

You can add and use the MongoDB MCP Server setup skill to configure your local MCP server using an AI agent.


npx skills add https://github.com/mongodb/agent-skills --skill mongodb-mcp-setup
Using manual configuration

See Manual Setup for instructions on how to manually configure the MongoDB MCP Server.

📚 Table of Contents

  • 🚀 Getting Started
  • Prerequisites
  • Manual Setup
  • 🛠️ Supported Tools
  • MongoDB Atlas Tools
  • MongoDB Database Tools
  • MongoDB Assistant Tools
  • 📄 Supported Resources
  • ⚙️ Configuration
  • Configuration Options
  • Atlas API Access
  • Configuration Methods
  • Environment Variables
  • Command-Line Arguments
  • MCP Client Configuration
  • Proxy Support
  • 🚀 Deploy on Public Clouds
  • Azure Cloud
  • 🤝 Contributing

<a name="getting-started"></a>

Prerequisites

[!NOTE]

Node 20.x support is deprecated and will be removed in a future release. Please upgrade to Node 22.13 or later. See https://nodejs.org/en/blog/migrations/v20-to-v22 for migration details.

  • Node.js
  • At least v22.13.0. Check with node -v.
  • A MongoDB connection string or Atlas API credentials.
  • _Service Accounts Atlas API credentials_ are required to use the Atlas tools. You can create a service account in MongoDB Atlas and use its credentials for authentication. See Atlas API Access for more details.
  • If you have a MongoDB connection string, you can use it directly to connect to your MongoDB instance.

Manual Setup

🔒 Security Recommendation 1: When using Atlas API credentials, be sure to assign only the minimum required permissions to your service account. See Atlas API Permissions for details.

🔒 Security Recommendation 2: For enhanced security, we strongly recommend using environment variables to pass sensitive configuration such as connection strings and API credentials instead of command line arguments. Command line arguments can be visible in process lists and logged in various system locations, potentially exposing your secrets. Environment variables provide a more secure way to handle sensitive information.

Most MCP clients require a configuration file to be created or modified to add the MCP server.

Note: The configuration file syntax can be different across clients. Please refer to the following links for the latest expected syntax:

Default Safety Notice: All examples below include --readOnly by default to ensure safe, read-only access to your data. Remove --readOnly if you need to enable write operations.

Option 1: Connection String

You can pass your connection string via environment variables, make sure to use a valid username and password.


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

NOTE: The connection string can be configured to connect to any MongoDB cluster, whether it's a local instance or an Atlas cluster.

Option 2: Connect to the MongoDB Atlas-Managed MCP Server

When working with MongoDB Atlas, the recommended approach is to install the mongodb-atlas plugin for your AI agent, which handles OAuth authentication automatically.

For manual configuration, see the client-specific instructions for setting up the Atlas Remote MCP server with OAuth. Alternatively, you can connect using the mongodb-atlas-mcp-remote package with Service Account credentials — see the package README for setup instructions.

Note: You cannot authenticate to the remote MongoDB MCP server using a static API key over HTTP. You must either:

- Use a client that supports the OAuth flow.

- Use the mongodb-atlas-mcp-remote stdio server, which you can authenticate into using the static MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET environment variables.

To connect with the mongodb-atlas-mcp-remote stdio server using Service Account credentials, add it to your client's MCP configuration:


{
  "mcpServers": {
    "mongodb-atlas-mcp-remote": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mongodb-atlas-mcp-remote@latest"],
      "env": {
        "MDB_MCP_API_CLIENT_ID": "$CLIENT_ID",
        "MDB_MCP_API_CLIENT_SECRET": "$SECRET"
      }
    }
  }
}
Option 3: Atlas API Credentials

Use your Atlas API Service Accounts credentials. Must follow all the steps in Atlas API Access section.


{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
      "env": {
        "MDB_MCP_API_CLIENT_ID": "your-atlas-service-accounts-client-id",
        "MDB_MCP_API_CLIENT_SECRET": "your-atlas-service-accounts-client-secret"
      }
    }
  }
}
Option 4: Standalone Service using environment variables and command line arguments

You can source environment variables defined in a config file or explicitly set them like we do in the example below and run the server via npx.


# Set your credentials as environment variables first
export MDB_MCP_API_CLIENT_ID="your-atlas-service-accounts-client-id"
export MDB_MCP_API_CLIENT_SECRET="your-atlas-service-accounts-client-secret"

# Then start the server
npx -y mongodb-mcp-server@latest --readOnly

💡 Platform Note: The examples above use Unix/Linux/macOS syntax. For Windows users, see Environment Variables for platform-specific instructions.

  • For a complete list of configuration options see Configuration Options
  • To configure your Atlas Service Accounts credentials please refer to Atlas API Access
  • Connection String via environment variables in the MCP file example
  • Atlas API credentials via environment variables in the MCP file example
Option 5: Using Docker

You can run the MongoDB MCP Server in a Docker container, which provides isolation and doesn't require a local Node.js installation.

Run with Environment Variables

You may provide either a MongoDB connection string OR Atlas API credentials:

Option A: No configuration

docker run --rm -i \
  mongodb/mongodb-mcp-server:latest
Option B: With MongoDB connection string

# Set your credentials as environment variables first
export MDB_MCP_CONNECTION_STRING="mongodb+srv://username:password@cluster.mongodb.net/myDatabase"

# Then start the docker container
docker run --rm -i \
  -e MDB_MCP_CONNECTION_STRING \
  -e MDB_MCP_READ_ONLY="true" \
  mongodb/mongodb-mcp-server:latest

💡 Platform Note: The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#envi

Truncated. Read the full README on GitHub ↗

Related tools