Skip to content
appsgit

MongoDB 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,162 GitHub stars, is released under the Apache-2.0 license and runs locally with npx -y mongodb-mcp-server.

github.com/mongodb-js/mongodb-mcp-server (opens in a new tab)

Data as of from the GitHub API and the official MCP registry; description from the project's repository. Report an error

Install MongoDB MCP Server

Generated from the server's MCP registry entry. Replace your-value with your own values.

Claude Desktop

claude_desktop_config.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",
        "MDB_MCP_CONNECTION_STRINGS": "your-value"
      }
    }
  }
}

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

Claude Code

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 --env MDB_MCP_CONNECTION_STRINGS=your-value --transport stdio mongodb-mcp-server -- npx -y mongodb-mcp-server

Cursor

.cursor/mcp.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",
        "MDB_MCP_CONNECTION_STRINGS": "your-value"
      }
    }
  }
}

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

VS Code

.vscode/mcp.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
    },
    {
      "type": "promptString",
      "id": "mdb_mcp_connection_strings",
      "description": "MDB_MCP_CONNECTION_STRINGS",
      "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}",
        "MDB_MCP_CONNECTION_STRINGS": "${input:mdb_mcp_connection_strings}"
      }
    }
  }
}

Config formats checked against the official docs on Oct 7, 2026: modelcontextprotocol.io (opens in a new tab), code.claude.com (opens in a new tab), cursor.com (opens in a new tab), code.visualstudio.com (opens in a new tab).

Environment variables

Variables the server reads at startup.

NameRequiredDescription
MDB_MCP_AGGREGATION_COUNT_MAX_TIME_MS_CAPNoDeprecated. Use aggregationCountTimeoutMs instead.
MDB_MCP_AGGREGATION_COUNT_TIMEOUT_MSNoThe maximum time in milliseconds for the count phase of aggregation operations. This is used to limit the time spent counting documents when determining if…
MDB_MCP_ALLOW_REQUEST_OVERRIDESNoWhen set to true, allows configuration values to be overridden via request headers and query parameters.
MDB_MCP_API_CLIENT_IDsecretNoAtlas API client ID for authentication. Required for running Atlas tools.
MDB_MCP_API_CLIENT_SECRETsecretNoAtlas API client secret for authentication. Required for running Atlas tools.
MDB_MCP_ASSISTANT_BASE_URLNoBase URL for the MongoDB Assistant API.
MDB_MCP_ATLAS_TEMPORARY_DATABASE_USER_LIFETIME_MSNoTime in milliseconds that temporary database users created when connecting to MongoDB Atlas clusters will remain active before being automatically deleted.
MDB_MCP_CONFIRMATION_REQUIRED_TOOLSNoComma separated values of tool names that require user confirmation before execution. Requires the client to support elicitation.
MDB_MCP_CONNECTION_IDLE_TIMEOUT_MSNoMilliseconds a MongoDB connection may stay unused (no tool call touching it) before it is closed to release the underlying connection pool and its server-side…
MDB_MCP_CONNECTION_SCOPENoVisibility 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_STRINGsecretNoMongoDB connection string for direct database connections, exposed under the connectionId "preconfigured". Optional, if not set, you'll need to call the…
MDB_MCP_CONNECTION_STRINGSsecretNoMongoDB connection strings keyed by name, as a JSON object (e.g. {"preconfigured": "mongodb://...", "analytics": "mongodb://..."}). Each name becomes a…
MDB_MCP_DANGEROUS_HOST_BINDINGNoWhen set to true, allows binding the HTTP server (and monitoring server) to a non-loopback host such as 0.0.0.0, a LAN IP, or an empty host (all interfaces)…
MDB_MCP_DISABLE_SERVER_SIDE_JSNoWhen set to true, disallows the use of server-side JavaScript operators (such as $where, $function, and $accumulator) in query filters and aggregation…
MDB_MCP_DISABLE_UNTRUSTED_DATA_WARNINGNoWhen set to true, tool responses include potentially untrusted data (such as documents or query results) as-is, without wrapping it in delimiters and a…
MDB_MCP_DISABLED_TOOLSNoComma separated values of tool names, operation types, and/or categories of tools that will be disabled.
MDB_MCP_DRY_RUNNoWhen true, runs the server in dry mode: dumps configuration and enabled tools, then exits without starting the server.
MDB_MCP_ELICITATION_TIMEOUT_MSNoTime in milliseconds the user has to respond to an elicitation request (such as a tool confirmation prompt) before it fails.
MDB_MCP_EVICTION_IDLE_GRACE_M_SNoHow long a session must be idle before it becomes eligible for least-recently-used eviction when the HTTP transport is at its maxSessions cap (only used when…
MDB_MCP_EXPORT_CLEANUP_INTERVAL_MSNoTime in milliseconds between export cleanup cycles that remove expired export files.

Tools (40)

Parsed from the Tools section of the README; check the repository for the current list.

  • 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.

About 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.

  • mcp
  • mcp-server
  • mongodb
  • mongodb-atlas
  • mongodb-database

FAQ

MongoDB MCP Server FAQ

Still curious? Email info@appsgit.com.

How do I install the MongoDB MCP Server MCP server?

Add the command npx -y mongodb-mcp-server to your MCP client: put it in claude_desktop_config.json for Claude Desktop, run claude mcp add for Claude Code, or add it to .cursor/mcp.json (Cursor) or .vscode/mcp.json (VS Code). The snippets on this page are ready to paste.

Is MongoDB MCP Server free?

The server is open source under the Apache-2.0 license, so running it is free. It needs credentials (MDB_MCP_API_CLIENT_ID, MDB_MCP_API_CLIENT_SECRET, MDB_MCP_CONNECTION_STRING and MDB_MCP_CONNECTION_STRINGS) for the service it connects to, which may require a paid account.

Is MongoDB MCP Server actively maintained?

The most recent commit was on Nov 12, 2026. The latest release is v3.3.0, published Nov 9, 2026. appsgit only lists MCP servers with a commit in the last six months.