Back to MCP Directory
Mongo
Model Context Protocol moderate risk

Mongo

MCP MongoDB Server bridges LLMs and MongoDB, enabling schema inspection, data querying, and manipulation with configurable read-only mode and ObjectId handling.

Connections & Capabilities

Connects To

MongoDBDocker

Capabilities

readwriteexec

Quickstart

Install

npx -y mcp-mongo-server mongodb://localhost:27017/database

Config

{
  "mcpServers": {
    "mongodb-env": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mongo-server"
      ],
      "env": {
        "MCP_MONGODB_URI": "mongodb://muhammed:kilic@localhost:27017/database",
        "MCP_MONGODB_READONLY": "true"
      }
    }
  }
}

Exposed MCP Tools (5)

safe
query

Executes a MongoDB query against a specified collection.

Read-only operation if read-only mode is enabled.

safe
aggregate

Executes a MongoDB aggregation pipeline against a specified collection.

Read-only operation if read-only mode is enabled.

high
update

Updates documents in a MongoDB collection based on a query.

Modifies existing data; potential for data corruption.

moderate
insert

Inserts new documents into a MongoDB collection.

Adds new data to the database.

high
index creation

Creates indexes on MongoDB collections.

Modifies the database schema and can impact performance.

Safety Assessment

This server is relatively safe in read-only mode, allowing data exploration without modification. However, when write operations are enabled, the risk increases significantly, requiring careful management of permissions and query construction to prevent unintended data manipulation or exposure.

  • Configurable read-only mode to prevent accidental writes.
  • Schema inference helps understand data structure before interaction.
  • ObjectId handling prevents common data type errors.
  • Verified on MseeP
  • Write operations are possible when not in read-only mode.
  • Direct access to MongoDB database, requires careful URI management.
  • No built-in RBAC; relies on MongoDB's own security.
  • Potential for data exfiltration if queries are not carefully constructed.
  • Environment variables used for configuration can be exposed.