Community Data

MongoDB

Query, modify, and administer MongoDB databases — full driver surface.

282 stars 56 forks Last commit 2w ago Language TypeScript License MIT
Sign in to like, install, or save to a bundle → View on GitHub →

Install

npm install -g mcp-mongo-server

Maintain this server? Add the badge

Show your README readers it's in a curated directory — and give them a one-click path to install docs and config.

Listed on Prismix ← links back here

Markdown

[![Listed on Prismix](https://prismix.dev/api/badge/mcp/mongodb.svg)](https://prismix.dev/mcp/mongodb)
Theme-aware version (auto dark/light on GitHub) →
<a href="https://prismix.dev/mcp/mongodb"><picture><source media="(prefers-color-scheme: dark)" srcset="https://prismix.dev/api/badge/mcp/mongodb.svg?theme=dark"><img alt="Listed on Prismix" src="https://prismix.dev/api/badge/mcp/mongodb.svg"></picture></a>

About

MongoDB Node-driver wrapper. Database + collection listing, document CRUD, aggregation pipelines, index management. Connection-string config like the Postgres server.

Recent releases (5)

All releases →
  • 3.0.1 Latest Jul 29, 2026
    **Patch release.**
    
    Renames the CLI bin from `mongodb` to `mcp-mongo-server` so `npx -y mcp-mongo-server "<connection-string>"` (the form documented in the README) resolves directly.
    
    Previously, because the package name (`mcp-mongo-server`) and bin name (`mongodb`) differed, `npx` failed to resolve the single bin:
    
    ```
    sh: mongodb: command not found
    ```
    
    and the only working invocation was the awkward `npx -y -p mcp-mongo-server mongodb "<connection-string>"`.
    
    No API or behavior changes.
    
    **Full changelog:** https://github.com/kiliczsh/mcp-mongo-server/pull/45
    
    View on GitHub ↗
  • 3.0.0 Jul 29, 2026
    Major release: migrates to the **MCP SDK v2** with dual-era protocol support, adds security hardening, and introduces new capabilities.
    
    ## Highlights
    
    ### Protocol / SDK
    - Migrated to **MCP SDK v2** (`@modelcontextprotocol/server`, `/node`, `/express`).
    - **Dual-era protocol support** — negotiates `2026-07-28` while still serving legacy `2025-11-25` clients.
    - Error semantics aligned with the newer spec: validation/lookup misses return `InvalidParams` (`-32602`).
    
    ### Security hardening (opt-in, safe by default)
    - **Cross-database scoping** — aggregations pinned to the connected database; cross-db `$lookup`/`$out`/`$merge` rejected unless `--allow-cross-db`.
    - **Server-side JavaScript blocked** by default (`$where`, `$function`, `$accumulator`, `mapReduce`) unless `--allow-server-js`.
    - Hardened **system-collection guard** (case-insensitive).
    - Configurable **HTTP body limit** (`--json-limit`); oversized/malformed bodies return proper JSON-RPC errors.
    - **Nesting-depth guard** on the aggregation operator scan.
    - Optional **bearer-token auth** for the HTTP transport (`--auth-token`), constant-time comparison.
    
    ### Features & fixes
    - New **`convertTime`** tool (Unix/date → UTC ISO 8601 / GMT / Unix + server timezone); date filters honor timezone offsets.
    - Fixed **`sort`** on the `query` tool (was silently stripped from the input schema).
    - Fixed **`createIndex`** returning an empty `{}` — now returns `{ acknowledged, createdIndexes, indexCount }`.
    
    ## Breaking changes
    - Runs on the MCP SDK v2 line and negotiates the `2026-07-28` protocol (legacy `2025-11-25` still supported).
    - Stricter defaults: cross-database targets and server-side JavaScript are rejected unless explicitly enabled.
    - **Minimum MongoDB server version is 4.2+** (modern driver requirement); older servers can no longer be connected.
    
    **Full changelog:** https://github.com/kiliczsh/mcp-mongo-server/pull/44
    
    View on GitHub ↗
  • 2.1.1 Jul 21, 2026
    ## Security fix
    
    Fixes a read-only mode bypass in the `aggregate` tool. When the server was started with `--read-only` (or `MCP_MONGODB_READONLY=true`), an aggregation pipeline containing `$out` or `$merge` could still write to or replace collections, bypassing the read-only protection. Server-side JavaScript operators (`$function`, `$accumulator`, `$where`) are now rejected in read-only mode as well.
    
    **Affected:** all versions up to and including 2.1.0 when run in read-only mode.
    **Fixed:** aggregation pipelines are now recursively checked and these operators are rejected under read-only mode. Normal (writable) mode is unchanged.
    
    For defense in depth, we also recommend enforcing read-only access at the database level with a read-only MongoDB user.
    
    **Full Changelog**: https://github.com/kiliczsh/mcp-mongo-server/compare/2.1.0...2.1.1
    View on GitHub ↗
  • 2.1.0 Jul 21, 2026
    ## MCP 2025-11-25 spec compliance, security hardening and dependency updates
    
    ### Spec compliance
    - **SEP-1303**: validation and MongoDB runtime errors are now tool execution errors (`isError: true`) so models can self-correct; unknown tools remain protocol errors, cancellation propagates as `AbortError`
    - Task-augmented execution only runs when explicitly requested by the client
    - Added `title`, `description` and `websiteUrl` to server implementation info
    - Tool schemas verified against JSON Schema 2020-12 (strict), tool names conform to SEP-986
    
    ### Security
    - Origin header validation on HTTP transport (DNS rebinding protection): invalid origins get `403 Forbidden`; configurable via `--allowed-origins` / `MCP_HTTP_ALLOWED_ORIGINS`
    - Dependency overrides for 13 vulnerable transitive packages: audit findings reduced from 57 (1 critical, 16 high) to 3 moderate
    
    ### Dependencies
    - `@modelcontextprotocol/sdk` 1.29 (protocol 2025-11-25), `mongodb` 7.5, `zod` 4, `@biomejs/biome` 2.5, `@types/node` 26, inspector 1.0
    
    Tested end-to-end against MongoDB 4.4, 6.0, 7.0 and 8.2 (standalone, replica set, no-auth, auth+keyFile RS, TLS) — 7/7 passing.
    
    **Full Changelog**: https://github.com/kiliczsh/mcp-mongo-server/compare/2.0.2...2.1.0
    View on GitHub ↗
  • 2.0.2 Feb 6, 2026
    ## 2.0.2                                                                                                                                                                                                                             
                                                                                                                                                                                                                                             
     ### Breaking Changes
    
     - Dockerfile completely rewritten — now uses multi-stage `oven/bun` + `node:22-slim` build instead of `debian:bullseye-slim` with `mcp-proxy`
     - Removed `mcp-proxy` dependency — HTTP transport is now native
     - `docker-compose.yml` no longer uses `tty`/`stdin_open` (HTTP mode by default)
    
     ### Features
    
     - **Streamable HTTP transport**: `--transport http` flag starts an Express server with MCP Streamable HTTP at `/mcp`
     - **Port configuration**: `--port` flag and `MCP_PORT` env var (default: `3001`)
     - **Request logging**: HTTP mode logs every request with timestamp, client IP, method, status, duration, and MCP method
     - **Docker healthcheck**: built-in health monitoring via `/mcp` endpoint
     - **Docker logging**: `json-file` driver with rotation (10MB x 3 files)
    
     ### Improvements
    
     - Multi-stage Docker build — smaller image, no git clone, copies local files
     - `tsup` externals: `@modelcontextprotocol/sdk` and `mongodb` kept as runtime imports
     - `.dockerignore` added to reduce build context
     - CI workflows switched from npm to bun, Node 20 to 22
     - Docs reorganized to reference example files
    
    **Full Changelog**: https://github.com/kiliczsh/mcp-mongo-server/compare/1.3.0...2.0.2
    View on GitHub ↗

Discussion (0)

Sign in to comment →

No comments yet. Sign in to start the discussion.

More Data servers