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,140 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)

  • Needs API key
  • Databases
  • Apache-2.0
  • Actively maintained

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"
      }
    }
  }
}

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 --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"
      }
    }
  }
}

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
    }
  ],
  "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 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_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_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. Optional, if not set, you'll need to call the connect tool before interacting with MongoDB data.
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_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_EXPORT_CLEANUP_INTERVAL_MSNoTime in milliseconds between export cleanup cycles that remove expired export files.
MDB_MCP_EXPORT_TIMEOUT_MSNoTime in milliseconds after which an export is considered expired and eligible for cleanup.
MDB_MCP_EXPORTS_PATHNoFolder to store exported data files.
MDB_MCP_EXTERNALLY_MANAGED_SESSIONSNoWhen 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_HOSTNoDeprecated. Use monitoringServerHost instead. Host address to bind the healthCheck HTTP server to (only used when transport is 'http'). If provided…
MDB_MCP_HEALTH_CHECK_PORTNoDeprecated. Use monitoringServerPort instead. Port number for the healthCheck HTTP server (only used when transport is 'http'). If provided, healthCheckHost…
MDB_MCP_HTTP_BODY_LIMITNoMaximum 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_HEADERSNoHeader that the HTTP server will validate when making requests (only used when transport is 'http').

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. The following plugins are available:

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

FAQ

MongoDB MCP Server FAQ

Still curious? Email info@appsgit.com.

What is 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,140 GitHub stars, is released under the Apache-2.0 license and runs locally with npx -y mongodb-mcp-server. The source code is at github.com/mongodb-js/mongodb-mcp-server.

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 and MDB_MCP_CONNECTION_STRING) for the service it connects to, which may require a paid account.

Is MongoDB MCP Server actively maintained?

The most recent commit was on Oct 6, 2026. The latest release is v3.0.5, published Oct 1, 2026. appsgit only lists MCP servers with a commit in the last six months and re-checks every server daily.