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.
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.
- 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
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.
One command — npx -y @sourabhshegane/mongodb-mcp-that-works@latest
