queryLABSCO SUMMARY
Read-only mode blocks the aggregation stages that write, not just the write tools.
That is the detail most bridges miss: $out and $merge can modify data from inside a pipeline, and $function, $where and $accumulator run JavaScript on the server. All of them are rejected by default, along with cross-database $lookup, and each has its own opt-in flag. The project still tells you the strongest guarantee is a MongoDB user scoped to one database — which is the right advice.
What it is
A MongoDB server for MCP clients: it exposes your collections, infers their schemas from document samples, and runs queries, aggregations and writes.
What you get
- query — a filter, projection and limit, with an optional explain plan
- aggregate — full pipelines, also with an optional explain
- count — matching documents for a filter
- update, insert and createIndex — available when read-only mode is off
- serverInfo — MongoDB server details
- convertTime — turns a Unix timestamp or date string into UTC ISO 8601, GMT and Unix seconds and milliseconds, and reports the server's own time and timezone
- Schema inference from document samples, so the assistant discovers collection shape by itself
- Configurable ObjectId handling — auto, none or force — for 24-character hex strings
- Progress reporting and cancellation on long operations
- Stdio for local clients, or an HTTP endpoint at /mcp for remote access
Requirements
Node.js 20 or newer, and a connection URI — npx -y mcp-mongo-server with the URI, no install step. Add --read-only to block every write path. In HTTP mode, only requests without a browser Origin and requests from localhost are accepted by default, everything else gets a 403; use --allowed-origins to permit specific browser origins and --auth-token to require a bearer token.
Setup effort
One command plus credentials — npx -y mcp-mongo-server mongodb://localhost:27017/mydatabase, then supply credentials
USE CASES
Exploring a database nobody documented
The assistant discovers collections and infers their shape from samples before you write a query.
Letting someone look without risk
Start it with --read-only so every write path, including the aggregation stages that write, is blocked.
Answering a grouped question
Run the aggregation pipeline and, when it is slow, ask for the query planner's explanation.
Getting a date query right across timezones
Convert the timestamp and read the server's own current time and timezone before filtering.
8 tools
Listed in project docs. Your client may show a different list.
aggregatecountupdateinsertcreateIndexserverInfoconvertTimeBEFORE YOU INSTALL
What to know first
Tools you get
8 tools named in the project's documentation.
Requires
- Node.js 20 or newer (npx on PATH)
- A MongoDB connection URI, passed as the argument or as MCP_MONGODB_URI
INSTALLATION
Connect your client
Server setup
npx -y mcp-mongo-server mongodb://localhost:27017/mydatabaseMCP Clients
Claude Desktop, Cursor, Windsurf
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mcp-mongo-server",
"mongodb://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:27017/<YOUR_DB_NAME>"
]
}
}
}mcp-get
npx @michaellatman/mcp-get@latest install mcp-mongo-serverAny MCP client — HTTP
Start the server in HTTP mode with a bearer token; it then listens at http://<YOUR_HOST>:3001/mcp.
MCP_HTTP_AUTH_TOKEN="<YOUR_MCP_HTTP_AUTH_TOKEN>" npx -y mcp-mongo-server "mongodb://user:pass@localhost:27017/mydatabase" --transport http --port 3001{
"mcpServers": {
"mongodb": {
"type": "http",
"url": "http://localhost:3001/mcp",
"headers": {
"Authorization": "Bearer <YOUR_MCP_HTTP_AUTH_TOKEN>"
}
}
}
}Use the same token in the Authorization header; requests without it get a 401.