MCP Mongo Server logo

MCP Mongo Server

by kiliczsh

Connects AI clients to MongoDB for schema discovery, queries, aggregations, and controlled writes over stdio or HTTP.

Install MCP Mongo Server

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "kiliczsh-mcp-mongo-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mongo-server"
      ],
      "env": {
        "MCP_MONGODB_URI": "YOUR_VALUE_HERE",
        "MCP_MONGODB_READONLY": "YOUR_VALUE_HERE",
        "MCP_MONGODB_ALLOW_CROSS_DB": "YOUR_VALUE_HERE",
        "MCP_MONGODB_ALLOW_SERVER_JS": "YOUR_VALUE_HERE",
        "MCP_PORT": "YOUR_VALUE_HERE",
        "MCP_HTTP_ALLOWED_ORIGINS": "YOUR_VALUE_HERE",
        "MCP_HTTP_JSON_LIMIT": "YOUR_VALUE_HERE",
        "MCP_HTTP_AUTH_TOKEN": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y mcp-mongo-server

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 1mo ago.

Overview

kiliczsh/mcp-mongo-server MCP server connects AI clients to MongoDB through the Model Context Protocol. It discovers collections, infers schemas from document samples, and supports queries, aggregation pipelines, inserts, updates, and index creation. Read-only mode blocks write operations, including modifying aggregation stages, while optional safeguards restrict cross-database access and server-side JavaScript. Use it with local clients over stdio or expose an HTTP endpoint for remote access.

Use cases

  • Explore MongoDB collections through an AI client
  • Inspect inferred document schemas
  • Run read-only queries and aggregations
  • Insert or update documents when writes are enabled
  • Expose MongoDB tools over an HTTP endpoint

Key features

  • Collection discovery and schema inference
  • MongoDB queries and aggregation pipelines
  • Read-only mode with write-path blocking
  • Insert, update, and index operations
  • Stdio and HTTP transports
  • ObjectId and time conversion helpers

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

20/20 checks healthy over the last 78d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · mcp-mongo-server (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars283Stargazers on the source repository.
npm downloads814Package downloads in the last 30 days.
Last commit3mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Directory activity4 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Mongo Server works

What kiliczsh/mcp-mongo-server MCP server does

kiliczsh/mcp-mongo-server MCP server gives MCP-compatible AI clients access to a MongoDB database selected by the connection URI. It can inspect collections, infer their schemas from sampled documents, run queries, execute aggregation pipelines, and optionally explain query plans. When read-only mode is disabled, the available database operations also include inserts, updates, and index creation.

The server is intended for the 🗄️ Databases category and is useful when an assistant needs to inspect or operate on MongoDB data through a standard tool interface. It supports standalone MongoDB instances, replica sets, sharded deployments, and Atlas connections over plain or TLS connections.

How it works

The process receives a MongoDB URI as a command-line argument or through MCP_MONGODB_URI. By default, it communicates with local MCP clients over stdio. Claude Desktop and Cursor use this mode, and the documentation also covers Windsurf integration. An HTTP transport is available at /mcp for remote or multi-client use.

Schema discovery happens automatically from document samples. Query and aggregation operations support MongoDB syntax, with optional query explanation. A convertTime helper converts Unix timestamps and date strings into UTC, GMT, or ISO formats for clearer date handling across time zones. Long-running operations can report progress and accept cancellation.

Setup and configuration

kiliczsh/mcp-mongo-server MCP server requires Node.js 20 or newer. The quickest start uses npx with a MongoDB URI:

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

Add --read-only when the client should be prevented from changing data. For HTTP mode, select --transport http and optionally set --port, --allowed-origins, --json-limit, and --auth-token. HTTP requests without a browser Origin and requests from localhost are accepted by default; other browser origins must be explicitly allowed.

The corresponding environment variables include MCP_MONGODB_URI, MCP_MONGODB_READONLY, MCP_PORT, MCP_HTTP_ALLOWED_ORIGINS, MCP_HTTP_JSON_LIMIT, and MCP_HTTP_AUTH_TOKEN. Cross-database aggregation and server-side JavaScript are disabled by default and can be enabled with --allow-cross-db and --allow-server-js, or their environment-variable equivalents.

Tools and capabilities

The kiliczsh/mcp-mongo-server MCP server supports:

  • Collection discovery and schema inference from sampled documents.
  • MongoDB queries and aggregation pipelines.
  • Optional query and aggregation explain plans.
  • Inserts, updates, and index creation when writes are enabled.
  • Read-only enforcement across direct writes and modifying aggregation stages such as $out and $merge.
  • Configurable conversion of 24-character hexadecimal strings to MongoDB ObjectId values using auto, none, or force behavior.
  • Progress reporting and cancellation for long operations.

Limitations and notes

The server operates on the database named in its connection string. Cross-database $out, $merge, and $lookup targets are rejected unless explicitly enabled. MongoDB server-side JavaScript operators including $function, $where, and $accumulator are also blocked by default. Read-only mode blocks these operators as well as all supported write paths.

Application-level restrictions should be backed by MongoDB permissions. The README recommends using a database user limited to the required database, with read-only permissions when data exploration is the only need. The project is licensed under MIT.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Mongo Server

No separate install step is required for the documented quick start. With Node.js 20 or newer, run `npx -y mcp-mongo-server` followed by a MongoDB connection URI.

Yes. Claude Desktop is documented as a local stdio client for the server.

Yes. Use `--read-only` or set `MCP_MONGODB_READONLY` to `true`. This blocks direct writes and modifying aggregation stages.

Yes. Start it with `--transport http`; the endpoint is available at `/mcp`. You can configure the port, allowed browser origins, request size, and bearer-token authentication.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Mongo Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/kiliczsh-mcp-mongo-server?style=directory)](https://allmcps.com/mcp/kiliczsh-mcp-mongo-server)
HTML Embed
<a href="https://allmcps.com/mcp/kiliczsh-mcp-mongo-server"><img src="https://allmcps.com/api/badge/kiliczsh-mcp-mongo-server?style=directory" alt="MCP Mongo Server on AllMCPs" /></a>