← Back to directory
M

MongoDB MCP Server

Official
Official MCP server for MongoDB databases and Atlas clusters
GitHub source repository ↗
★ 1.1k Stars Category · Database Very popular Source revision ba9fa6a3b0aa
70FMRS · B
Reliability
10/20
Security and permissions
16/20
Maintenance
14/20
Documentation
16/20
Setup experience
14/20

Officially maintained by MongoDB, this MCP server is feature-rich, covering database and Atlas management, with read-only mode and security configs. Overall reliable, but security best practices should be followed.

Read the FMRS scoring method →

The MongoDB MCP server is an official Model Context Protocol server maintained by MongoDB, enabling AI assistants to interact with MongoDB databases and MongoDB Atlas clusters through standard tools. It provides a comprehensive set of database operations (query, aggregation, index management) and Atlas management tools (cluster creation, performance advisor, stream processing), with features like read-only mode, index checking, and logging. Supports stdio and HTTP transports, configurable via environment variables or command-line arguments.

Tools

aggregate
Run an aggregation pipeline against a MongoDB collection
aggregate-db
Run an aggregation against a MongoDB database
collection-indexes
Describe the indexes for a collection
collection-schema
Describe the schema for a collection
collection-storage-size
Get the size of the collection
connect
Connect to a MongoDB instance
count
Count documents matching a filter in a collection
create-collection
Create a new collection (creates database if not exists)
create-index
Create an index for a collection
db-stats
Return statistics reflecting the use state of a single database
delete-many
Remove all documents matching a filter from a collection
disconnect
Close a MongoDB connection and revoke its connectionId
drop-collection
Remove a collection or view and its associated indexes
drop-database
Remove the specified database and its data files
drop-index
Drop an index from a collection
explain
Return statistics describing the execution of the winning plan
export
Export query or aggregation results in EJSON format
find
Run a find query against a MongoDB collection
insert-many
Insert an array of documents into a collection
list-collections
List all collections for a given database
list-connections
List active MongoDB connections and their connectionIds
list-databases
List all databases for a MongoDB connection
mongodb-logs
Return the most recent logged mongod events
rename-collection
Rename a collection in a database
update-many
Update all documents matching a filter in a collection
atlas-connect-cluster
Connect to a MongoDB Atlas cluster and return a connectionId
atlas-create-access-list
Allow IP/CIDR ranges to access Atlas clusters
atlas-create-cluster
Create a MongoDB Atlas cluster (M10-M80)
atlas-create-db-user
Create a MongoDB Atlas database user
atlas-create-free-cluster
Create a free MongoDB Atlas cluster
atlas-create-project
Create a MongoDB Atlas project
atlas-get-performance-advisor
Get Atlas performance advisor recommendations (indexes, slow queries, etc.)
atlas-inspect-access-list
Inspect IP/CIDR ranges with access to Atlas clusters
atlas-inspect-cluster
Inspect metadata of a MongoDB Atlas cluster
atlas-list-alerts
List triggered alerts for a MongoDB Atlas project
atlas-list-clusters
List MongoDB Atlas clusters
atlas-list-db-users
List MongoDB Atlas database users
atlas-list-orgs
List MongoDB Atlas organizations
atlas-list-projects
List MongoDB Atlas projects
atlas-load-sample-dataset
Load a MongoDB sample dataset into an Atlas cluster
atlas-pause-resume-cluster
Pause or resume a dedicated (M10+) Atlas cluster
atlas-streams-build
Create Atlas Stream Processing resources (workspace, connection, processor)
atlas-streams-discover
Discover and inspect Atlas Stream Processing resources
atlas-streams-manage
Manage Atlas Stream Processing resources (start/stop, modify)
atlas-streams-teardown
Delete Atlas Stream Processing resources
atlas-upgrade-cluster
Upgrade an Atlas cluster tier (e.g., M0 to Flex or M10)
atlas-local-connect-deployment
Connect to an Atlas Local deployment and return a connectionId
atlas-local-create-deployment
Create a MongoDB Atlas local deployment
atlas-local-delete-deployment
Delete a MongoDB Atlas local deployment
atlas-local-list-deployments
List MongoDB Atlas local deployments
list-knowledge-sources
List available data sources in the MongoDB Assistant knowledge base
search-knowledge
Search the MongoDB Assistant knowledge base for official documentation and expert guidance

Setup

  1. Ensure Node.js v22.13.0 or higher is installed (check with node -v).
  2. Add the server configuration to your MCP client config file, e.g.:
{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}
  1. For Atlas tools, set Atlas API client ID and secret via environment variables or CLI args.
  2. For Docker, run docker run --rm -i mongodb/mongodb-mcp-server:latest.
  3. For HTTP transport, use --transport http.
claude_desktop_config.json
{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}

Fit and risk

Best for

  • Developers and data analysts who want to interact with MongoDB via natural language
  • Scenarios needing MongoDB integration into LLM workflows
  • Teams using MongoDB Atlas looking to automate cluster management

Not for

  • Users who need generic MCP services without database interaction
  • Users needing full write access without configuring safety measures (default is read-only)
  • Users requiring local storage or non-standard transports (only stdio and HTTP supported)

Required permissions

  • Network access: connect to MongoDB instance or Atlas API
  • File system access (optional): export data files, log files
  • Atlas API credentials (required for Atlas tools)

Risks and side effects

  • If read-only mode is not enabled, tools can modify or delete database data
  • Exposed Atlas API credentials could lead to unauthorized cluster management
  • HTTP transport without authentication may be exposed to unauthorized clients
  • Server-side JavaScript operators may be executed, but disabled by default

Troubleshooting

  1. Check Node version with `node -v` to ensure v22.13.0+
  2. Verify MongoDB connection string is correct and network-accessible
  3. Confirm Atlas API credentials are valid and have required permissions
  4. Check logs (default to disk and forwarded to MCP client) for error details

Use cases

Let AI assistants directly query and manipulate MongoDB data
Manage MongoDB Atlas clusters, projects, database users, and alerts
Get performance advice and optimize database queries
Retrieve official MongoDB documentation and expert guidance

Supported clients

Claude DesktopFull support
VS CodeFull support
CursorFull support
WindsurfFull support
Copilot CLIFull support
OpenCodeFull support