Labsco
MCP SERVER

MongoDB That Works

by sourabhfb

Query and write to MongoDB from the conversation, with a schema call that shows the real field names first.

NoSQL, Graph & Key-Value StoresVerified
Summary
getSchema is the reason to pick this over a bare Mongo connection.

An agent guessing at field names in a schemaless collection burns several queries getting empty results back. getSchema returns the field names and their types up front, so find and aggregate get written against what the documents actually contain. Writes are single-document only — insertOne, updateOne, deleteOne — so a filter that matches more than you expected still touches one record.

What it is

A MongoDB server over one connection string: the usual reads — find, findOne, aggregate, count, distinct — single-document writes, a collection listing, and a getSchema call that reports the field names and types a collection actually holds.

What you get
  • Documents matching a filter, with sort and limit for paging through them
  • A single document by filter, when one is all you want
  • Aggregation pipelines run as written — $match, $group and the rest
  • A count of the documents matching a filter
  • The distinct values a field takes across a collection
  • The collections in the database, with an optional filter
  • Field names and types for a collection, analysed from the documents in it
  • Single-document insert, update and delete
Requirements

MONGODB_URI, a full connection string — MongoDB Atlas and authenticated deployments both work. MONGODB_DATABASE names the default database and is optional. Installs from npm as @sourabhshegane/mongodb-mcp-that-works.

Setup effort

One command — npx -y @sourabhshegane/mongodb-mcp-that-works@latest