MongoDB That Works is an MCP server that connects LLM clients directly to MongoDB databases with built-in schema discovery and field validation. Built using TypeScript and Zod validation, the server runs over standard input/output (stdio) and enables AI assistants to inspect collection structures, validate field names, and execute CRUD operations. Developers, data engineers, and technical teams use it to interact with NoSQL data stores without manually writing and testing raw database drivers. The server exposes tools for listing collections, fetching document schemas, running aggregation pipelines, and querying documents with filters and pagination. It also provides write capabilities, including single-document insertion, updates, and deletions. By providing MCP tool annotations for read-only and destructive actions, the server helps clients identify safe versus mutating calls. Because it supports standard MongoDB connection strings, it interfaces with both local MongoDB instances and cloud-hosted MongoDB Atlas deployments.
Category: Databases & Data Stores
Tags: database, mongodb, nosql, schema-discovery
@sourabhshegane/mongodb-mcp-that-works@latest using npx. 3. Configure the environment variables by setting MONGODB_URI to your MongoDB connection string (e.g., mongodb+srv://<user>:<password>@cluster.mongodb.net/<database>). Optionally set MONGODB_DATABASE to specify a default database. 4. Save your configuration and restart your client. For instance, in Claude Desktop, edit claude_desktop_config.json with the command npx and args ["-y", "@sourabhshegane/mongodb-mcp-that-works@latest"] under the mongodb server key.getSchema to understand database contents before writing queries. - Running multi-stage aggregation pipelines on MongoDB collections to compute metrics and summarize transactional records directly from LLM prompts. - Searching and filtering documents across collections using find and findOne with explicit sorting, limits, and pagination parameters. - Updating or inserting individual documents into application databases through natural language requests handled via insertOne and updateOne. - Counting matching records and retrieving distinct values across specific fields using count and distinct for instant dataset profiling.Part of MCP Servers
You can run the server directly using npx by specifying @sourabhshegane/mongodb-mcp-that-works@latest in your MCP client configuration. Alternatively, install it globally from npm by executing npm install -g @sourabhshegane/mongodb-mcp-that-works in your terminal.
MongoDB That Works operates over standard stdio, making it compatible with any MCP-compliant client. Supported clients include Claude Desktop, Claude Code, OpenAI Codex, Cursor, VS Code with GitHub Copilot, and Zed.
The server provides ten core tools: listCollections, find, findOne, aggregate, count, distinct, insertOne, updateOne, deleteOne, and getSchema. These tools support collection exploration, document filtering, pipeline aggregation, schema validation, and single-document mutations.
Yes, it supports insertOne, updateOne, and deleteOne. These tools carry destructive hints in the MCP annotations to notify clients of state changes. For sensitive or high-risk environments, using a read-only database user in the connection string is recommended.
The only required configuration setting is the MONGODB_URI environment variable containing your standard MongoDB connection string. You can also optionally provide MONGODB_DATABASE to define the fallback database name if it is not embedded in the URI.