OpenViSTAI · Agents · Blockchain · Crypto
Menu
MCP & Tooling

MCP MongoDB Server

MCP MongoDB Server is a self-hosted Model Context Protocol server that connects compatible AI assistants to MongoDB. It exposes collections, infers schemas from document samples, and provides tools for queries, aggregation pipelines and database writes.

Independent OpenViST project profile, based on linked sources.

MCP MongoDB Server — Assistant-assisted inspection of MongoDB collections and inferred document schemas
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when an MCP-compatible assistant needs access to MongoDB data or operations, and you want to select a local or HTTP transport and control whether writes are available.

Who it is for

  • Developers connecting an MCP-compatible assistant to MongoDB.
  • Teams that want database discovery and query tasks available through clients such as Claude Desktop or Cursor.
  • Operators who need to restrict assistant access with read-only mode or named connections.

Documented uses

  • Expose MongoDB collections and inferred schemas to an assistant.
  • Run MongoDB queries and aggregation pipelines through MCP, with optional explain plans.
  • Enable insert, update and index-creation operations when read-only mode is off.
  • Provide local stdio access or an HTTP endpoint for remote or multi-client use.
Before you choose

Requirements & limits

The server requires Node.js 20 or newer and a MongoDB connection URI. It is self-hosted and supports stdio and HTTP transports.

  • Read-only mode blocks all write paths, including modifying aggregation stages; writes are available when that mode is disabled.
  • Named connections can limit database selection and set a connection read-only, while global read-only mode applies to every connection.
  • HTTP mode restricts browser origins by default and supports configured allowed origins and bearer-token authentication.
  • The README lists standalone, replica-set, sharded and Atlas deployments, with plain or TLS connections.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Start a local read-only MCP server

Run the server against a MongoDB database with write operations blocked.

Before you start

  • Node.js 20 or newer
  • A MongoDB connection URI

Steps

  1. Run the command below, replacing the URI with the target database connection URI.

    Documented command
    npx -y mcp-mongo-server mongodb://localhost:27017/mydatabase --read-only
  2. Configure a local MCP client to use the server over stdio; the README identifies this as the default transport and names Claude Desktop and Cursor as example clients.

Expected outcome

The local MCP server exposes MongoDB functionality with write operations blocked.

Guide limitations

  • This recipe covers the server command and transport; client-specific configuration steps are not included.
  • Read-only mode blocks write paths, including inserts, updates, index creation and modifying aggregation stages.
Source-based practical guide

Expose the server over HTTP

Start the MCP server with an HTTP endpoint for remote or multi-client access.

Before you start

  • Node.js 20 or newer
  • A MongoDB connection URI

Steps

  1. Run the command below, substituting the appropriate URI.

    Documented command
    npx -y mcp-mongo-server "mongodb://user:pass@localhost:27017/mydatabase" --transport http --port 3001
  2. For browser clients, add --allowed-origins with the permitted comma-separated origins.

  3. If the endpoint should require a bearer token, configure --auth-token.

Expected outcome

The server exposes an HTTP MCP endpoint at `/mcp` on the configured port.

Guide limitations

  • By default, requests without a browser Origin and requests from localhost are accepted; other requests are rejected with 403 unless their origins are allowed.
  • This recipe describes server startup, not client setup or network deployment.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
21 November 2026
Original website title
kiliczsh/mcp-mongo-server · Official homepage title · retained in its source language