# mcp-mongo-server

> mcp-mongo-server is an open-source MCP server for databases. MCP server that lets AI assistants query and modify your MongoDB databases. It is available on CLI, API, Self-hosted, macOS, Linux and Windows.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted, macOS, Linux, Windows
- **Website:** https://www.npmjs.com/package/mcp-mongo-server
- **Repository:** https://github.com/kiliczsh/mcp-mongo-server
- **GitHub stars:** 282
- **License:** MIT
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

Connects AI clients such as Claude Desktop and Cursor to MongoDB, so they can list collections, infer document structure, and run queries, aggregations and writes. It runs from npx with a single connection string and supports standalone, replica set, sharded and Atlas deployments over plain or TLS connections.

Safety controls are built in. A read-only flag blocks insert, update, index creation and aggregation stages such as $out and $merge, while cross-database stages and server-side JavaScript operators stay off unless explicitly enabled. Named connections can be defined in a JSON environment variable, each with its own database allowlist and read-only setting.

It suits developers and data analysts who want to explore a database in plain language, and teams that want to expose a shared database to several clients over HTTP with bearer-token auth.

## Features

- **Schema inference:** Detects collection structure automatically from document samples so assistants understand the data shape.
- **Read-only mode:** Blocks every write path globally or per connection for safe exploration.
- **Query and aggregation:** Runs queries and aggregation pipelines, with optional explain plans.
- **Named connections:** Defines multiple databases with individual permissions and database allowlists.
- **Time conversion helper:** Converts Unix timestamps and date strings into UTC, GMT or ISO for unambiguous date queries.
- **Stdio and HTTP transports:** Runs locally over stdio or as a remote HTTP endpoint with optional bearer-token auth.

## Good for

- Asking an AI assistant questions about production or analytics data without writing queries by hand
- Exploring an unfamiliar MongoDB database safely with read-only access
- Generating aggregation pipelines from natural-language requests
- Sharing one database with several AI clients over a remote HTTP endpoint

## FAQ

### Can mcp-mongo-server modify data?

Yes, by default it supports insert, update and index creation. Passing --read-only or setting MCP_MONGODB_READONLY to true blocks all writes.

### Which MongoDB deployments are supported?

Standalone, replica set, sharded and Atlas deployments, over plain or TLS connections.

### What Node.js version is required?

Node.js 20 or newer.

### How is remote access restricted?

In HTTP mode only requests without a browser Origin and requests from localhost are accepted by default. You can allow specific origins and require a bearer token.

### Is mcp-mongo-server free?

Yes. mcp-mongo-server is open source, so you can use and self-host it for free.

### What are the best alternatives to mcp-mongo-server?

The closest alternatives to mcp-mongo-server are mongo-mcp, Mongodb MCP Server, Mongo Scout MCP, mongodb-lens and florentine-ai.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [mongo-mcp](https://ai-powered.com/mcp/mongo-mcp): mongo-mcp is an open-source MCP server for databases.
- [Mongodb MCP Server](https://ai-powered.com/mcp/mongodb-mcp-server): Mongodb MCP Server is an open-source MCP server for databases.
- [Mongo Scout MCP](https://ai-powered.com/mcp/mongo-scout-mcp): Mongo Scout MCP is an open-source MCP server for databases.
- [mongodb-lens](https://ai-powered.com/mcp/mongodb-lens): mongodb-lens is an open-source MCP server for databases.
- [florentine-ai](https://ai-powered.com/mcp/florentine-ai): florentine-ai is a freemium MCP server for databases.
- [MongoDB Read-Only MCP](https://ai-powered.com/mcp/mongodb-read-only-mcp): MongoDB Read-Only MCP is an open-source MCP server for databases.
- [postgres_mcp](https://ai-powered.com/mcp/postgres-mcp-5): postgres_mcp is an open-source MCP server for databases.
- [mongodb-atlas-mcp-server](https://ai-powered.com/mcp/mongodb-atlas-mcp-server): mongodb-atlas-mcp-server is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/mcp-mongo-server
