MongoDB MCP Server

MongoDB databases queried and managed via schema-aware AI integration.

Data last scanned today · Reviewed today

688 tools284TypeScriptMIT

Overview

This MCP server enables AI assistants to interact directly with MongoDB deployments. By exposing collection structures and automatically inferring schemas from sample documents, it allows for natural language database operations including standard queries, complex aggregations, and data modifications. It supports various infrastructure types, including standalone, replica sets, and Atlas clusters. The server features a configurable read-only mode to prevent accidental data changes, making it suitable for exploratory analysis. Additional developer utilities include automatic ObjectId string conversion, time-format normalization for accurate date queries, and support for both stdio and HTTP transport layers.

Our verdict

This server carries a high risk level with a security score of 48/100. It is community-maintained rather than official, and critical aspects such as the read-only implementation and authentication methods have not yet been editorially reviewed. Given these factors, users should exercise caution and avoid using this tool with production databases containing sensitive or mission-critical data until further verification is available.

  • Supports read-only mode to restrict write operations
  • Small supply-chain surface with only 4 dependencies
  • Provides automated schema inference from document samples
  • Supports complex aggregation pipelines and explain plans
  • Not maintained by MongoDB official vendor
  • Authentication mechanisms lack editorial security review
  • Read-only enforcement has not been independently verified

Setup

Claude Desktop
{
  "mcpServers": {
    "mcp-mongo-server": {
      "args": [
        "-y",
        "mcp-mongo-server"
      ],
      "command": "npx"
    }
  }
}

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart Claude Desktop. Some servers require API keys or tokens as environment variables — check the project's README and add an "env" object if needed.

  • No read-only mode — running this grants full read/write access.
  • No built-in authentication — anyone with access to this config can invoke every tool it exposes.

Tools

ToolDescriptionRisk
queryExecute MongoDB querieslow
aggregateRun aggregation pipelineslow
countCount matching documentslow
updateModify documentsmedium
insertAdd new documentsmedium
createIndexCreate collection indexesmedium
serverInfoGet MongoDB server detailslow
convertTimeConvert a Unix timestamp or date string to UTC ISO 8601, GMT, and Unix seconds/milliseconds, and report the server's current time and timezone.low

Compatibility

ClientLocalDockerRemoteRead-only
Claude Desktop
Cursor
VS Code
Windsurf
ChatGPT

Frequently asked questions

What are the software prerequisites for running this server?

This server requires Node.js version 20 or newer to run.

How can I prevent the AI from accidentally modifying my data?

You can use the --read-only flag or the MCP_MONGODB_READONLY environment variable to block all write operations and risky aggregation stages.

Does this server support remote access via HTTP?

Yes, you can use the --transport http flag to expose an endpoint, which allows for remote or multi-client access on a configurable port.

How are security risks regarding cross-database access handled?

Aggregation stages like $out, $merge, or $lookup that target databases outside your connection string are blocked by default to prevent unauthorized data access.

Are server-side JavaScript aggregation operators allowed by default?

No, operators like $function, $where, and $accumulator are rejected by default because they execute arbitrary code on the MongoDB server. You must explicitly enable them using the --allow-server-js flag.

Can I secure the HTTP endpoint with an authentication token?

Yes, you can use the --auth-token flag or the MCP_HTTP_AUTH_TOKEN environment variable to require a Bearer token for all requests to the HTTP endpoint.

Alternatives

Changelog

Badge

MongoDB MCP Server security score, rated on RepoAI

Maintain this server? Add the live badge to your README.