kiliczsh/mcp-mongo-server

๐Ÿ—„๏ธ Databases
0 Views
0 Installs

๐Ÿ“‡ ๐Ÿ  - A Model Context Protocol Server for MongoDB

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "kiliczsh-mcp-mongo-server": {
      "command": "npx",
      "args": [
        "-y",
        "kiliczsh-mcp-mongo-server"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

MCP MongoDB Server


NPM Version NPM Downloads NPM License

A Model Context Protocol (MCP) server that lets AI assistants work with your MongoDB databases. It exposes your collections, infers their schemas, and runs queries, aggregations, and writes through a standard interface โ€” so tools like Claude Desktop and Cursor can read and reason about your data.

Demo

MCP MongoDB Server Demo | Claude Desktop

Why use it

  • Talk to your database in plain language โ€” the assistant discovers your collections and their shape automatically.
  • Safe by default โ€” turn on read-only mode to let an assistant explore without any risk of changing data.
  • Works everywhere โ€” connects to standalone, replica set, sharded, and Atlas deployments, over plain or TLS connections.

Key Features

  • Read-Only Mode โ€” blocks every write path (insert, update, index creation, and aggregation stages like $out/$merge that could modify data).
  • Smart ObjectId Handling โ€” configurable auto/none/force conversion of 24-character hex strings to ObjectIds.
  • Schema Inference โ€” automatic collection schema detection from document samples.
  • Query & Aggregation โ€” full query and aggregation pipeline support, with optional explain plans.
  • Write Operations โ€” insert, update, and index creation (when read-only mode is off).
  • Time Conversion โ€” a convertTime helper turns Unix timestamps and date strings into UTC/GMT/ISO, so date queries stay unambiguous across timezones.
  • Progress & Cancellation โ€” long operations report progress and can be cancelled mid-flight.
  • Two Transports โ€” run locally over stdio, or expose an HTTP endpoint for remote access.

Requirements

  • Node.js 20 or newer

Quick Start

Point the server at your database โ€” no install step needed:

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

Explore safely, without any chance of changing data:

npx -y mcp-mongo-server mongodb://localhost:27017/mydatabase --read-only

Usage

Local (stdio)

This is the default, used by Claude Desktop, Cursor, and other local clients:

npx -y mcp-mongo-server "mongodb://user:pass@localhost:27017/mydatabase"

Remote (HTTP)

Expose an HTTP endpoint at /mcp for remote or multi-client access:

npx -y mcp-mongo-server "mongodb://user:pass@localhost:27017/mydatabase" --transport http --port 3001

By default, only requests without a browser Origin (CLIs, IDEs) and requests from localhost are accepted; everything else is rejected with 403 to guard against DNS-rebinding attacks. Allow specific browser origins with --allowed-origins:

npx -y mcp-mongo-server "mongodb://..." --transport http --port 3001 --allowed-origins "https://app.example.com"

Options

FlagDescription
--read-only, -rBlock all write operations
--allow-cross-dbAllow aggregation $out/$merge/$lookup to target other databases (off by default)
--allow-server-jsAllow server-side JavaScript operators $function/$where/$accumulator (off by default)
--transport, -tstdio (default) or http
--port, -pHTTP port (default 3001)
--allowed-originsComma-separated browser origins to allow in HTTP mode
--json-limitMax HTTP request body size (default 10mb)
--auth-tokenRequire Authorization: Bearer <token> on the HTTP endpoint

Environment Variables

VariableDescription
MCP_MONGODB_URIMongoDB connection URI (alternative to the argument)
MCP_MONGODB_READONLYEnable read-only mode ("true")
MCP_MONGODB_ALLOW_CROSS_DBAllow cross-database aggregation stages ("true")
MCP_MONGODB_ALLOW_SERVER_JSAllow server-side JavaScript operators ("true")
MCP_PORTHTTP port
MCP_HTTP_ALLOWED_ORIGINSComma-separated browser origins to allow in HTTP mode
MCP_HTTP_JSON_LIMITMax HTTP request body size (default 10mb)
MCP_HTTP_AUTH_TOKENBearer token required to access the HTTP endpoint

Security

Database scope. The server operates on the database in your connection string. Aggregation stages that reach another database ($out, $merge, $lookup with an explicit db) are rejected by default, so a pipeline can't quietly read from or write to databases you didn't point it at. Enable them with --allow-cross-db if you need them.

Server-side JavaScript. The aggregation operators $function, $where, and $accumulator run arbitrary JavaScript on the MongoDB server. They are rejected by default; enable them with --allow-server-js if you trust the pipelines being run.

Read-only mode blocks every write path, including aggregation stages that write or run server-side JavaScript ($out, $merge, $function, $where, $accumulator).

Least privilege. Application-level checks only go so far โ€” the strongest guarantee comes from the database. Connect with a MongoDB user scoped to just the database you need, with read-only permissions when the assistant only needs to explore. That way the database itself enforces the boundary, as defense in depth.

Documentation

License

MIT โ€” see LICENSE for details.

Related MCP Servers

modelcontextprotocol/server-postgresVerified

๐Ÿ“‡ ๐Ÿ  - PostgreSQL database integration with schema inspection and query capabilities

๐Ÿ—„๏ธ Databases1 views
Aiven-Open/mcp-aiven

๐Ÿ โ˜๏ธ ๐ŸŽ–๏ธ - Navigate your Aiven projects and interact with the PostgreSQLยฎ, Apache Kafkaยฎ, ClickHouseยฎ and OpenSearchยฎ services

๐Ÿ—„๏ธ Databases0 views
alexanderzuev/supabase-mcp-server

Supabase MCP Server with support for SQL query execution and database exploration tools

๐Ÿ—„๏ธ Databases0 views
aliyun/alibabacloud-tablestore-mcp-server

โ˜• ๐Ÿ โ˜๏ธ - MCP service for Tablestore, features include adding documents, semantic search for documents based on vectors and scalars, RAG-friendly, and serverless.

๐Ÿ—„๏ธ Databases0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it โ†’
โ˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.