# MongoDB MCP Server (MCP server)

> MongoDB MCP Server is an MCP server that adds database tools to AI assistants such as Claude Desktop, Claude Code and Cursor. MongoDB Model Context Protocol Server. It has 1,140 GitHub stars, is released under the Apache-2.0 license and runs locally with npx -y mongodb-mcp-server.

A Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas. MongoDB MCP Server comes bundled with the official MongoDB plugins for AI agents. The following plugins are available:

## Key facts

| Fact | Value |
|---|---|
| Repository | https://github.com/mongodb-js/mongodb-mcp-server |
| GitHub stars | 1,140 |
| License | Apache-2.0 |
| Language | TypeScript |
| Transport | stdio |
| Packages | npm: mongodb-mcp-server; docker: docker.io/mongodb/mongodb-mcp-server:2.1.0 |
| Remote URL | none |
| Needs API key | yes |
| Official | no |
| Works with | Claude Desktop, Claude Code, Cursor, VS Code |
| Category | Databases |
| Latest release | v3.0.5 (Oct 1, 2026) |
| Last commit | Oct 6, 2026 |
| MCP registry name | io.github.mongodb-js/mongodb-mcp-server |

## Install

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server"
      ],
      "env": {
        "MDB_MCP_API_CLIENT_ID": "your-value",
        "MDB_MCP_API_CLIENT_SECRET": "your-value",
        "MDB_MCP_CONNECTION_STRING": "your-value"
      }
    }
  }
}
```

Settings > Developer > Edit Config. macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\. Restart Claude Desktop afterwards.

### Claude Code

```sh
claude mcp add --env MDB_MCP_API_CLIENT_ID=your-value --env MDB_MCP_API_CLIENT_SECRET=your-value --env MDB_MCP_CONNECTION_STRING=your-value --transport stdio mongodb-mcp-server -- npx -y mongodb-mcp-server
```

### Cursor (.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server"
      ],
      "env": {
        "MDB_MCP_API_CLIENT_ID": "your-value",
        "MDB_MCP_API_CLIENT_SECRET": "your-value",
        "MDB_MCP_CONNECTION_STRING": "your-value"
      }
    }
  }
}
```

Project file; use ~/.cursor/mcp.json to enable it in every project.

### VS Code (.vscode/mcp.json)

```json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "mdb_mcp_api_client_id",
      "description": "MDB_MCP_API_CLIENT_ID",
      "password": true
    },
    {
      "type": "promptString",
      "id": "mdb_mcp_api_client_secret",
      "description": "MDB_MCP_API_CLIENT_SECRET",
      "password": true
    },
    {
      "type": "promptString",
      "id": "mdb_mcp_connection_string",
      "description": "MDB_MCP_CONNECTION_STRING",
      "password": true
    }
  ],
  "servers": {
    "mongodb-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server"
      ],
      "env": {
        "MDB_MCP_API_CLIENT_ID": "${input:mdb_mcp_api_client_id}",
        "MDB_MCP_API_CLIENT_SECRET": "${input:mdb_mcp_api_client_secret}",
        "MDB_MCP_CONNECTION_STRING": "${input:mdb_mcp_connection_string}"
      }
    }
  }
}
```

Config formats checked against the official docs on 2026-10-07.

## Environment variables

- `MDB_MCP_ALLOW_REQUEST_OVERRIDES`: When set to true, allows configuration values to be overridden via request headers and query parameters.
- `MDB_MCP_API_CLIENT_ID` (secret): Atlas API client ID for authentication. Required for running Atlas tools.
- `MDB_MCP_API_CLIENT_SECRET` (secret): Atlas API client secret for authentication. Required for running Atlas tools.
- `MDB_MCP_ASSISTANT_BASE_URL`: Base URL for the MongoDB Assistant API.
- `MDB_MCP_ATLAS_TEMPORARY_DATABASE_USER_LIFETIME_MS`: Time in milliseconds that temporary database users created when connecting to MongoDB Atlas clusters will remain active before being automatically deleted.
- `MDB_MCP_CONFIRMATION_REQUIRED_TOOLS`: Comma separated values of tool names that require user confirmation before execution. Requires the client to support elicitation.
- `MDB_MCP_CONNECTION_SCOPE`: Visibility scope for MongoDB connections created at runtime. With 'session' (the default), each MCP session only sees the connections it created (plus the…
- `MDB_MCP_CONNECTION_STRING` (secret): MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the connect tool before interacting with MongoDB data.
- `MDB_MCP_DISABLE_SERVER_SIDE_JS`: When set to true, disallows the use of server-side JavaScript operators (such as $where, $function, and $accumulator) in query filters and aggregation…
- `MDB_MCP_DISABLED_TOOLS`: Comma separated values of tool names, operation types, and/or categories of tools that will be disabled.
- `MDB_MCP_DRY_RUN`: When true, runs the server in dry mode: dumps configuration and enabled tools, then exits without starting the server.
- `MDB_MCP_ELICITATION_TIMEOUT_MS`: Time in milliseconds the user has to respond to an elicitation request (such as a tool confirmation prompt) before it fails.
- `MDB_MCP_EXPORT_CLEANUP_INTERVAL_MS`: Time in milliseconds between export cleanup cycles that remove expired export files.
- `MDB_MCP_EXPORT_TIMEOUT_MS`: Time in milliseconds after which an export is considered expired and eligible for cleanup.
- `MDB_MCP_EXPORTS_PATH`: Folder to store exported data files.
- `MDB_MCP_EXTERNALLY_MANAGED_SESSIONS`: When true, the HTTP transport allows requests with a session ID supplied externally through the 'mcp-session-id' header. When an external ID is supplied, the…
- `MDB_MCP_HEALTH_CHECK_HOST`: Deprecated. Use monitoringServerHost instead. Host address to bind the healthCheck HTTP server to (only used when transport is 'http'). If provided…
- `MDB_MCP_HEALTH_CHECK_PORT`: Deprecated. Use monitoringServerPort instead. Port number for the healthCheck HTTP server (only used when transport is 'http'). If provided, healthCheckHost…
- `MDB_MCP_HTTP_BODY_LIMIT`: Maximum size of the HTTP request body in bytes (only used when transport is 'http'). This value is passed as the optional limit parameter to the Express.js…
- `MDB_MCP_HTTP_HEADERS`: Header that the HTTP server will validate when making requests (only used when transport is 'http').

## Tools

- `aggregate`: Run an aggregation 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`: Gets the size of the collection
- `connect`: Connect to a MongoDB instance
- `count`: Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter…
- `create-collection`: Creates a new collection in a database. If the database doesn't exist, it will be created automatically.
- `create-index`: Create an index for a collection
- `db-stats`: Returns statistics that reflect the use state of a single database
- `delete-many`: Removes all documents that match the filter from a MongoDB collection
- `disconnect`: Close a MongoDB connection and revoke its connectionId.
- `drop-collection`: Removes a collection or view from the database. The method also removes any indexes associated with the dropped…
- `drop-database`: Removes the specified database, deleting the associated data files
- `drop-index`: Drop an index for the provided database and collection.
- `explain`: Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method
- `export`: Export a query or aggregation results in the specified EJSON format.
- `find`: Run a find query against a MongoDB collection
- `insert-many`: Insert an array of documents into a MongoDB collection. If the list of documents is above…
- `list-collections`: List all collections for a given database
- `list-connections`: List the active MongoDB connections and their connectionIds. Use this to find a connectionId established earlier.
- `list-databases`: List all databases for a MongoDB connection
- `mongodb-logs`: Returns the most recent logged mongod events
- `rename-collection`: Renames a collection in a MongoDB database
- `update-many`: Updates all documents that match the specified filter for a collection.
- `atlas-connect-cluster`: Connect to MongoDB Atlas cluster and get back a connectionId to pass to the other MongoDB tools.
- `atlas-create-access-list`: Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.
- `atlas-create-cluster`: Create a MongoDB Atlas cluster (M10–M80, replica set or single shard).
- `atlas-create-db-user`: Create an 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 MongoDB Atlas performance advisor recommendations and suggestions, which includes the operations: suggested…
- `atlas-get-regions`: List supported MongoDB Atlas regions for a cloud provider.
- `atlas-inspect-access-list`: Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.
- `atlas-inspect-cluster`: Inspect metadata of a MongoDB Atlas cluster
- `atlas-list-alerts`: List triggered alerts for a MongoDB Atlas project. These are alerts Atlas has raised, not the alert configurations…
- `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.

## Similar MCP servers

- [Dbx](https://appsgit.com/mcp-servers/dbx): Query databases from AI agents using connections configured in DBX. (24,945 stars, Apache-2.0)
- [Butterbase AI MCP Server](https://appsgit.com/mcp-servers/butterbase-ai-mcp-server): Butterbase MCP server — manage your backend: schemas, auth, functions, storage, RAG, deploys. (3,686 stars, Apache-2.0, needs API key)
- [DBHub](https://appsgit.com/mcp-servers/dbhub): Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite. (3,610 stars, MIT, needs API key)
- [LINQ to DB](https://appsgit.com/mcp-servers/linq-to-db): Inspect database schemas and execute SQL queries across multiple database providers with LINQ to DB. (3,332 stars, MIT)
- [Mindwtr](https://appsgit.com/mcp-servers/mindwtr): Task automation via SQLite, desktop Local API, or Mindwtr Cloud; read-only by default. (2,211 stars, AGPL-3.0, needs API key)
- [MCP Memory Service](https://appsgit.com/mcp-servers/mcp-memory-service): Open-source persistent memory for AI agent pipelines (LangGraph, CrewAI, AutoGen) and Claude. (1,988 stars, Apache-2.0)

---

Canonical page: https://appsgit.com/mcp-servers/mongodb-mcp-server
Source: appsgit (https://appsgit.com), the app store for github. Data from the GitHub API, refreshed nightly.
Machine access: JSON API https://appsgit.com/api/v1/apps (OpenAPI: https://appsgit.com/openapi.json), MCP server https://mcp.appsgit.com/mcp, full index https://appsgit.com/llms-full.txt.
