← Back to directory
M

MongoDB MCP Server

Community
Let AI assistants work with your MongoDB databases safely.
Category
Database #54 of 58
Stars
★ 282 Very popular
Transport
stdio (local process) · Streamable HTTP
Runtime
Node.js 20+
Credentials
No credential needed
License
MIT
Last commit
Tools
8
42FMRS · D

mcp-mongo-server is a feature-rich MongoDB MCP server with read-only mode, schema inference, query and aggregation support. It is easy to use via npx and prioritizes safety by restricting cross-db and server-side JS by default. Suitable for developers to safely explore and manipulate MongoDB through AI tools.

Strongest · Documentation 13/20 Weakest · Reliability 5/20

Reliability
5/20
Security and permissions
7/20
Maintenance
6/20
Documentation
13/20
Setup experience
11/20
Why each score
Reliability 5/20
The README claims npx startup, stdio/http transports and a tool set, but no source, CI workflows or tests were provided, so the MCP handshake, tool list and actual behavior cannot be verified. Per static calibration, missing execution evidence forces a conservative score.
Security and permissions 7/20
The README discloses read-only mode, cross-database aggregation blocking, server-side JavaScript blocking, HTTP Bearer auth and origin allowlists, but no source code was available to confirm these defenses are enforced. No real secrets or obvious malicious behavior appear in the install examples; the inability to verify enforcement accounts for the deduction.
Maintenance 6/20
The repository is not archived, has an MIT license and only one open issue, which are positive signals; however no commit history, release cadence, dependency updates or security-response channel were supplied, so sustained maintenance cannot be confirmed.
Documentation 13/20
The README offers quick start, CLI/env variables, security notes and doc links, with clear examples and disclosed read-only/cross-db/JS limitations; but full tool-parameter details and a troubleshooting section are absent from the supplied material, and the linked docs are not included.
Setup experience 11/20
Node.js 20+ is required, npx one-liners start the server, and stdio/http plus env vars are documented, so the steps are clear; but no actual client configuration examples are included in the README, and no CI/tests verify the install path, so the score stays conservative under the static calibration cap.

Static review · not runListed 2026-08-07

Read the FMRS scoring method →

Fit and risk

What it can accessConnects to a database

Best for

  • Users of AI coding assistants (Claude Desktop, Cursor, Windsurf) that need to interact with MongoDB
  • Developers who want to query databases using plain language
  • Teams sharing MongoDB data access with AI tools

Not for

  • High-security production environments unless properly configured with authentication and permissions
  • Performance-critical scenarios where AI may run suboptimal queries
  • Users needing full database administration (e.g., user management, backups)

Required permissions

  • MongoDB connection string, possibly including username and password
  • Read/write access to the target database (unless read-only mode is enabled)
  • HTTP mode may require an authentication token

Risks and side effects

  • If read-only mode is not enabled, AI may inadvertently perform write operations (updates, inserts, index creation)
  • Cross-database operations are blocked by default, but enabling --allow-cross-db may expose other databases
  • Server-side JavaScript operators ($function, $where) are disabled by default, but enabling can introduce code execution risks
  • HTTP mode defaults to localhost only, but misconfiguration could expose the database
  • May execute resource-intensive aggregations or queries, leading to performance issues

Setup

Before you start

Runtime:Node.js 20+

MCP_MONGODB_URI optionalsecret MongoDB connection URI, an alternative to the command-line argument; use your local or Atlas connection string.
MCP_HTTP_AUTH_TOKEN optionalsecret Bearer token required to access the HTTP endpoint; choose your own value for the Authorization header.
Other optional settings (6)
MCP_MONGODB_READONLY optional Set to "true" to enable read-only mode, blocking all write operations.
MCP_MONGODB_ALLOW_CROSS_DB optional Set to "true" to allow cross-database aggregation stages (off by default).
MCP_MONGODB_ALLOW_SERVER_JS optional Set to "true" to allow server-side JavaScript operators (off by default).
MCP_PORT optional HTTP port (default 3001).
MCP_HTTP_ALLOWED_ORIGINS optional Comma-separated browser origins allowed in HTTP mode.
MCP_HTTP_JSON_LIMIT optional Max HTTP request body size (default 10mb).

No install needed; run via npx: npx -y mcp-mongo-server mongodb://localhost:27017/mydatabase

Check that it works

Tools such as query, insert, listCollections, and inferSchema should appear in the client's tool list; ask the AI to run listCollections — returning collection names confirms the connection.

Troubleshooting

  1. Check the MongoDB URI correctness and reachability
  2. Ensure Node.js version is 20 or newer
  3. If write operations fail, check if read-only mode is enabled
  4. In HTTP mode, if receiving 403, check allowed origins
  5. See docs/integration.md for client-specific configuration examples

Things to try

Once connected, you can ask your AI assistant things like:

  • List all collections in the database
  • Infer the schema of the orders collection
  • Query the 10 most recent documents in the orders collection
  • Convert the timestamp 1700000000 to ISO time

Tools 8

query read-only
Query documents in a collection with filters, projections, etc.
aggregate read-only
Run aggregation pipelines, optionally with explain plans.
update writes
Update documents in a collection (when not read-only).
insert writes
Insert new documents into a collection (when not read-only).
createIndex writes
Create an index on a collection (when not read-only).
convertTime read-only
Convert Unix timestamps or date strings to UTC/GMT/ISO formats.
listCollections read-only
List collections in the database.
inferSchema read-only
Infer schema of a collection from document samples.

Use cases

Ask AI assistants to query MongoDB in natural language
Automatically discover database structure and understand collections
Let AI safely explore data in read-only mode without modifications
Provide remote access over HTTP for multi-client or team use

Supported clients

Claude Desktop
Cursor
Windsurf

Listed from the project's documentation, not tested by this site.

Overview

mcp-mongo-server is a Model Context Protocol (MCP) server that enables AI assistants to interact with MongoDB databases. It automatically exposes collections, infers schemas, and runs queries, aggregations, and writes through a standard interface. Supports read-only mode, smart ObjectId handling, schema inference, aggregation pipelines, time conversion, and progress/cancellation. Works over stdio or HTTP transport, compatible with Claude Desktop, Cursor, and Windsurf.

Similar servers

Source revision 55310c0d09ed Data synced 2026-10-19 Read the FMRS scoring method