MCP MongoDB Server (kiliczsh)

MCP MongoDB Server

An MCP server that gives an agent queries, aggregations and writes in MongoDB and starts with one npx command, no install

  • 283 ★ on the repository
  • Last commit
  • MIT
MCP server

Broad access

Why this level

  • Without --read-only, by default it gives an agent insert, update and index-creation access to a real MongoDB database
  • The connection string carries database credentials and is passed as a command argument or environment variable
  • The --allow-cross-db and --allow-server-js flags remove the guards against reaching outside the database and running arbitrary code on the MongoDB server
All reasons and checks

kiliczsh/mcp-mongo-server

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add mcp/mcp-mongodb-server

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Broad accessThe tool can change data, run commands or handle secrets.

  • Without --read-only, by default it gives an agent insert, update and index-creation access to a real MongoDB database
  • The connection string carries database credentials and is passed as a command argument or environment variable
  • The --allow-cross-db and --allow-server-js flags remove the guards against reaching outside the database and running arbitrary code on the MongoDB server

This is third-party code. Review the repository files before installing.

What it does

MCP MongoDB Server connects an agent to MongoDB with no package install. `npx -y mcp-mongo-server` with a connection string starts a server that infers collection schemas from document samples. Over MCP the agent gets queries, aggregations and write operations. The `--read-only` flag closes every write path: insert, update, index creation and the $out and $merge aggregation stages. Separately, aggregations that reach beyond the connection string's database and server-side JavaScript operators such as $function and $where, which run code on the MongoDB server, are off by default. `--allow-cross-db` and `--allow-server-js` lift these limits. A convertTime helper brings Unix timestamps and dates to one format so date queries do not drift across time zones. By default the server runs locally over stdio. `--transport http` starts an HTTP endpoint for remote access. In that mode the server accepts requests with no browser Origin header or from origins listed in `--allowed-origins` and answers 403 to the rest, which guards against DNS rebinding.

Who it is for. For developers who want to give Claude Desktop, Cursor or another MCP client access to their MongoDB database.

Good fit when

  • You want to connect an agent to MongoDB in one npx command, with no package installed permanently
  • The agent should only read and explore collections
  • You need aggregations with an explain plan to debug slow queries
  • The database runs on Atlas, a replica set or a sharded cluster, over a plain or TLS connection
  • You need remote HTTP access for several clients with a list of allowed origins

Not a fit when

  • You want the vendor's official MongoDB MCP server: the catalog has a separate MongoDB MCP Server entry from MongoDB itself
  • Your database is not MongoDB: the server works only with it
  • You need remote access with mandatory auth out of the box: the HTTP-mode token is off by default

Example request

Connect to the mydatabase database in read-only mode and show me the `orders` collection's schema from a document sample

MCP

Transport
stdio, http
Authentication
not required

Environment variables

MCP_MONGODB_URI secret
MongoDB connection string as an alternative to the command-line argument
MCP_MONGODB_READONLY
Enables read-only mode ("true")
MCP_HTTP_AUTH_TOKEN secret
Bearer token required to access the HTTP endpoint

Limitations

The server protects the database only at the application level. So it is better to give the agent a MongoDB account with rights to the one database it needs, and read-only rights if it does not need to write. Aggregations that write data or run server-side JavaScript are blocked in read-only mode as well. HTTP mode caps the request body size with `--json-limit`, 10 MB by default. Node.js 20 or newer is required.

How to disable. Stop the server process (Ctrl+C or close the terminal) and remove its entry from the MCP client's configuration. There is nothing permanently installed if the server was started via npx.

FAQ

How do I run MCP MongoDB Server with no install?

Run `npx -y mcp-mongo-server mongodb://localhost:27017/mydatabase`. The package downloads and starts right away, with no separate install step.

How do I grant read-only access?

Pass `--read-only` or set `MCP_MONGODB_READONLY=true`. The server then blocks insert, update, index creation and any aggregation that writes data or runs server-side JavaScript.

How do I connect to the server remotely?

Add `--transport http --port 3001` to expose an HTTP endpoint at /mcp. The `--allowed-origins` list limits which clients get in.

How does the server turn strings into MongoDB ObjectIds?

The string-to-ObjectId setting takes auto, none or force. In auto mode the server detects a 24-character hex string and converts it itself, none turns the conversion off, and force always applies it.

Can I pass the connection string as an environment variable?

Yes, MCP_MONGODB_URI sets the connection string instead of a command-line argument. Separate variables, MCP_MONGODB_ALLOW_CROSS_DB and MCP_MONGODB_ALLOW_SERVER_JS, turn on cross-database reach and server-side JavaScript.

Discussion

No questions or reviews yet.

Official

Official MongoDB MCP server: queries and aggregations, index management, Atlas clusters and local deployments

MCP serverBroad access1.2KRepository stars

DB MCP Server

db-mcp-server

An MCP server for several databases with protection: a read-only mode per database and a row limit. Written in Go, launched in Docker

MCP serverBroad access474Repository stars

MCP server that gives an agent access to MySQL: schema inspection and queries, read-only by default, writes behind flags

MCP serverExtended access2.2KRepository stars

MCP SQLite Server (npx)

MCP SQLite Server

Node.js MCP server for SQLite databases that runs via npx, no Python or uvx needed

MCP serverExtended access17Repository stars
Russian stack

An npm-published Moscow Exchange ISS MCP server with 10 tools, SQLite caching and resilient request retries

MCP serverExtended access

A Python MCP server for MySQL: listing tables, reading data, running SQL and inspecting schema through a controlled interface

MCP serverBroad access1.4KRepository stars

README in short

The README opens with a demo video of connecting through Claude Desktop and a list of supported MongoDB deployments. Quick-start commands for stdio and HTTP, a table of flags and variables and a section on protection limits at the database and application levels follow.

README badge

Report a problem

Foxx AIMCP MongoDB Server (kiliczsh)
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.