Mongodb MCP Server logo

Mongodb MCP Server

Connects AI agents to MongoDB databases and Atlas clusters for querying, administration, and data changes.

Install Mongodb MCP Server

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

mongodb-mcp-server exposes MongoDB database and Atlas operations through MCP tools. It can connect to self-managed MongoDB deployments with a connection string, while Atlas administration uses Atlas API credentials and supports cluster, user, and access-list management. Use it when an MCP-compatible client needs to inspect schemas, run queries and aggregations, modify documents, or manage database resources. The local server runs through the npm package and can be configured interactively or through an MCP client configuration.

Use cases

  • Query MongoDB collections with natural-language requests
  • Inspect schemas and indexes before changing application data
  • Analyze aggregation performance with explain plans
  • Create and manage MongoDB Atlas clusters
  • Export query results as EJSON

Key features

  • MongoDB queries and aggregations
  • Document inserts, updates, and deletes
  • Schema, index, and storage inspection
  • Database and collection administration
  • MongoDB Atlas cluster and access management
  • EJSON result export

Tools53

What Mongodb MCP Server lets your agent do. Expand a tool for its parameters.

Self-reported~1.7k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

42/42 checks healthy over the last 58d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 14d ago via OSV.dev · mongodb-mcp-server@latest (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1.2kStargazers on the source repository.
npm downloads564kPackage downloads in the last 30 days.
Last commitTodayMost recent push to the default branch.
Tools exposed53Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How Mongodb MCP Server works

What mongodb-mcp-server does

mongodb-mcp-server gives AI agents an MCP interface to MongoDB databases and MongoDB Atlas. It supports both data-oriented work and administrative operations. Agents can inspect databases, collections, indexes, schemas, storage usage, query plans, and server logs, then use separate tools to insert, update, delete, rename, or remove data structures.

Atlas-specific tools cover connecting to a cluster, creating free or paid clusters, adding database users, and configuring IP or CIDR access ranges. The cluster creation tool supports M10 through M80 deployments, including replica sets and single-shard clusters. Atlas API access requires service-account credentials with appropriate permissions.

How it works

The server establishes MongoDB connections and returns a connection identifier for subsequent operations. Agents can list active connections, discover databases and collections, and close a connection when finished. Atlas connections are independent, so multiple Atlas connections can remain active at once.

Database tools accept collection names, filters, documents, and aggregation definitions as appropriate. Query and aggregation results can be exported in EJSON. The explain operation reports execution statistics for the query plan selected by MongoDB's optimizer, which helps investigate query behavior and index usage.

Operations that can change or remove data include inserts, updates, deletes, index creation and removal, collection and database drops, and collection renaming. Review generated arguments carefully before allowing destructive operations.

Setup and configuration

Node.js 22.13.0 or later is required; support for Node.js 20 is deprecated. The simplest installation path is the package's setup command:

Terminal
npx -y mongodb-mcp-server@latest setup

The interactive setup guides configuration of a MongoDB connection string or Atlas API credentials. A local MCP client can also launch the package directly with npx; the VS Code installation example passes the connection string through MDB_MCP_CONNECTION_STRING and starts the server in read-only mode.

Most clients require an MCP configuration entry. Store connection strings and Atlas credentials in environment variables rather than command-line arguments, since command-line values may appear in process listings or logs. Atlas tools require MongoDB Atlas service-account API credentials, and those accounts should have only the permissions needed for the intended tasks.

Official plugins are available for MongoDB Atlas and for the local MongoDB server in clients including Cursor, VS Code, Claude, Gemini CLI, and Codex. The Atlas plugin connects to MongoDB's hosted Atlas MCP server over OAuth and does not require a local process.

Tools and capabilities

  • Query collections with find, count matching documents, and run collection or database aggregations.
  • Inspect collection schemas, indexes, storage size, database statistics, and recent mongod events.
  • Create, update, insert, or delete MongoDB documents.
  • Create, drop, and inspect indexes; create, drop, and rename collections; or drop databases.
  • List databases, collections, and active connections, then connect or disconnect as needed.
  • Export query or aggregation output in EJSON.
  • Create Atlas clusters, including free clusters, database users, and network access entries.

Large insert and update payloads may need to be divided into batches when they exceed MongoDB's request-payload limit.

Limitations and notes

The server can perform destructive database and Atlas administration actions, so client permissions and service-account roles should be chosen carefully. Atlas cluster creation enables compute autoscaling by default, with the minimum set to the selected tier and the maximum set two tiers higher; disk autoscaling is enabled as well. Encryption at rest with customer-managed keys is supported for the relevant Atlas cluster configuration.

A MongoDB connection string is suitable for connecting to a MongoDB instance. Atlas administration tools instead require Atlas API service-account credentials, while Atlas data operations begin with an Atlas cluster connection that supplies a connection ID for other database tools.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Mongodb MCP Server

mongodb-mcp-server is an MCP server that connects AI agents to MongoDB databases and MongoDB Atlas. Its main tools query and aggregate collections, inspect schemas and indexes, modify documents, manage collections and databases, and administer Atlas clusters, users, and network access.

Run `npx -y mongodb-mcp-server@latest setup` to start the interactive setup. It guides you through configuring a MongoDB connection string or Atlas API credentials, after which you can add the local server to an MCP client configuration.

Yes, mongodb-mcp-server works with Cursor. The project provides a Cursor installation option and an official MongoDB plugin. Cursor can run the local server, while the Atlas plugin connects to MongoDB's hosted Atlas MCP server over OAuth.

mongodb-mcp-server requires Node.js 22.13.0 or later. Node.js 20 support is deprecated, so upgrade before using the server to avoid compatibility issues with future releases.

Use Atlas service-account API credentials for Atlas administration tools, or connect to an Atlas cluster and pass the returned connection ID to the other MongoDB tools. The interactive setup can configure Atlas credentials, and the hosted Atlas plugin uses OAuth without a local process.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMongodb MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mongodb-mcp-server?style=directory)](https://allmcps.com/mcp/mongodb-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/mongodb-mcp-server"><img src="https://allmcps.com/api/badge/mongodb-mcp-server?style=directory" alt="Mongodb MCP Server on AllMCPs" /></a>