Data as of

MongoDB MCP Server for Claude Desktop: Setup & Config

Claude Desktop: MongoDB MCP Server connects AI clients to MongoDB databases and Atlas.

What you can do with MongoDB in Claude Desktop

A broad MongoDB toolset with read-only onboarding and integrated MongoDB knowledge search.

  • Inspect collection schemas and indexes before writing queries.
  • Run document searches and aggregation pipelines from an assistant.

Before you start: MongoDB in Claude Desktop

  • Node.js 22.13.0 or later
  • A MongoDB connection string or Atlas service-account credentials
  • An MCP-compatible client

This is the README's read-only connection-string setup. Atlas operations instead need MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET. Docker and HTTP alternatives are documented; HTTP needs deployment-level authentication and protection.

MongoDB Claude Desktop configuration

  1. Choose Claude Desktop configuration scope

    For MongoDB MCP Server, open macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json. Merge under mcpServers via Settings → Developer → Edit Config when available.

  2. Add MongoDB MCP Server to Claude Desktop

    Use the mongodb-mcp-server entry below in mcpServers. Keep MongoDB MCP Server's documented stdio connection fields and your other Claude Desktop entries.

  3. Check MongoDB MCP Server in Claude Desktop

    MongoDB MCP Server: Fully quit and reopen Claude Desktop; check developer diagnostics.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

JSON
{
  "mcpServers": {
    "mongodb-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "<MongoDB connection string with appropriate credentials>"
      }
    }
  }
}

MongoDB tools available to Claude Desktop

MongoDB's stored tool list documents 27 tools; compare it with Claude Desktop's connected tool list, because the stored list is not a live check.

aggregate-db

When Claude Desktop requests aggregate-db from MongoDB, review the action before approving it.

Execute a database-level aggregation pipeline.

aggregate

When Claude Desktop requests aggregate from MongoDB, review the action before approving it.

Execute an aggregation pipeline on a collection.

collection-indexes

When Claude Desktop requests collection-indexes from MongoDB, review the action before approving it.

Inspect indexes attached to a collection.

collection-schema

When Claude Desktop requests collection-schema from MongoDB, review the action before approving it.

Inspect a collection's document structure.

collection-storage-size

When Claude Desktop requests collection-storage-size from MongoDB, review the action before approving it.

Report storage size for a collection.

connect

When Claude Desktop requests connect from MongoDB, review the action before approving it.

Open an independent MongoDB connection and return its identifier.

count

When Claude Desktop requests count from MongoDB, review the action before approving it.

Count collection documents, optionally constrained by a query.

create-collection

When Claude Desktop requests create-collection from MongoDB, review the action before approving it.

Add a collection, creating its database if necessary.

create-index

When Claude Desktop requests create-index from MongoDB, review the action before approving it.

Add an index to a collection.

db-stats

When Claude Desktop requests db-stats from MongoDB, review the action before approving it.

Report usage statistics for one database.

delete-many

When Claude Desktop requests delete-many from MongoDB, review the action before approving it.

Delete collection documents selected by a filter.

disconnect

When Claude Desktop requests disconnect from MongoDB, review the action before approving it.

Close a connection; a configured default connection can reopen on later use.

drop-collection

When Claude Desktop requests drop-collection from MongoDB, review the action before approving it.

Remove a collection or view together with its indexes.

drop-database

When Claude Desktop requests drop-database from MongoDB, review the action before approving it.

Delete a database and its associated data files.

drop-index

When Claude Desktop requests drop-index from MongoDB, review the action before approving it.

explain

When Claude Desktop requests explain from MongoDB, review the action before approving it.

export

When Claude Desktop requests export from MongoDB, review the action before approving it.

find

When Claude Desktop requests find from MongoDB, review the action before approving it.

insert-many

When Claude Desktop requests insert-many from MongoDB, review the action before approving it.

list-collections

When Claude Desktop requests list-collections from MongoDB, review the action before approving it.

list-connections

When Claude Desktop requests list-connections from MongoDB, review the action before approving it.

list-databases

When Claude Desktop requests list-databases from MongoDB, review the action before approving it.

mongodb-logs

When Claude Desktop requests mongodb-logs from MongoDB, review the action before approving it.

rename-collection

When Claude Desktop requests rename-collection from MongoDB, review the action before approving it.

update-many

When Claude Desktop requests update-many from MongoDB, review the action before approving it.

list-knowledge-sources

When Claude Desktop requests list-knowledge-sources from MongoDB, review the action before approving it.

search-knowledge

When Claude Desktop requests search-knowledge from MongoDB, review the action before approving it.

MongoDB: full stored tool descriptions

Troubleshooting MongoDB in Claude Desktop

  • Fully quit and reopen Claude Desktop for MongoDB MCP Server. If npx mongodb-mcp-server@latest (Node.js/npm) is missing, check the desktop process's PATH, which may differ from your terminal.
  • In Claude Desktop's MongoDB MCP Server entry, check MDB_MCP_CONNECTION_STRING. Keep secrets out of shared screenshots and repositories.
  • MongoDB MCP Server uses stdio here: Claude Desktop must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
  • Known limitation: Atlas tools require separate service-account credentials.
  • Known limitation: HTTP deployments need additional security controls.
  • Known limitation: Write-enabled tools can delete data and database objects.
  • General Claude Desktop troubleshooting lives in the /clients/claude-desktop guide.

MongoDB MCP Server — details. Claude Desktop guide

Frequently asked questions

Claude Desktop loads MongoDB MCP Server from claude_desktop_config.json: ~/Library/Application Support/Claude/ on macOS, or %APPDATA%\Claude\ on Windows. Open it via Settings → Developer → Edit Config when available.

Claude Desktop's mongodb-mcp-server example uses stdio.

MongoDB MCP Server's Claude Desktop configuration invokes npx mongodb-mcp-server@latest (Node.js/npm).

Claude Desktop's MongoDB MCP Server example references MDB_MCP_CONNECTION_STRING. Check these names if startup or authentication fails; the example alone does not distinguish required from optional values.

MongoDB MCP Server's stored list contains 27 tools, including aggregate-db, aggregate, collection-indexes. Compare those names with Claude Desktop's connected tool list; the stored list is not a live check.

Yes. A connection string can point to a local MongoDB instance or an Atlas cluster.

No. The selected README example includes --readOnly. Removing that flag permits write operations subject to database permissions.