by nabid-pf
Enables Claude to perform CRUD, aggregation and index operations on MongoDB databases, with optional Mongoose schema support for validation, hooks and soft‑delete handling.
Mongo Mongoose MCP provides a Model Context Protocol server that lets Claude interact directly with MongoDB collections. It can operate in a schemaless mode using the native MongoDB driver or switch to Mongoose‑based schemas when a SCHEMA_PATH is supplied, allowing data validation and lifecycle hooks.
claude_desktop_config.json and add a server entry:{
"mcpServers": {
"mongodb-mongoose": {
"command": "npx",
"args": ["-y", "mongo-mongoose-mcp"],
"env": {
"MONGODB_URI": "<your mongodb uri>",
"SCHEMA_PATH": "<path to schema folder>"
}
}
}
}
npx command.npm install, npm run build, then test with:npx @modelcontextprotocol/inspector node dist/index.js
find, insertOne, updateOne, deleteOne, aggregate, etc., and the MCP translates the request to MongoDB operations.createIndex, dropIndex, indexes).listCollections.npx – no global install required.isDeleted, deletedAt).Q: Do I need Mongoose schemas?
A: No. If SCHEMA_PATH is omitted the server works with the native driver in a schemaless mode.
Q: How does soft delete work?
A: The deleteOne command sets isDeleted to true and records deletedAt; the document remains in the collection.
Q: Which Node version is required? A: Node.js v18 or higher.
Q: Can I use this outside Claude? A: Yes. The MCP server exposes a standard protocol that can be called by any client that implements the Model Context Protocol.
Q: How are indexes created?
A: Use the createIndex command with collection name, field specification and optional options.
An MCP (Model Context Protocol) server that enables Claude to interact with MongoDB databases, with optional Mongoose schema support.
To add the MCP server to Claude Desktop:
{
"mcpServers": {
"mongodb-mongoose": {
"command": "npx",
"args": [
"-y",
"mongo-mongoose-mcp",
],
"env": {
"MONGODB_URI": "<your mongodb uri>",
"SCHEMA_PATH" : "<path to the root folder of all your mongoose schema objects>"
}
}
}
}
When integrated with Claude, the following commands become available:
find: Query documents with filtering and projectionlistCollections: List available collectionsinsertOne: Insert a single documentupdateOne: Update a single documentdeleteOne: Soft delete a single documentcount: Count documents with filteringaggregate: Query documents with aggregation pipelinecreateIndex: Create a new indexdropIndex: Remove an indexindexes: List indexes for a collectionOnce integrated with Claude Desktop, you can use natural language to interact with your MongoDB database:
# Clone the repository
git clone https://github.com/nabid-pf/mongo-mongoose-mcp.git
cd mongo-mongoose-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Test with the MCP inspector
npx @modelcontextprotocol/inspector node dist/index.js
Place your Mongoose schema object files in the a directory and specify that path in SCHEMA_PATH var Make sure file names reflect the collection name
// models/users.js (for users collection)
export default {
name: { type: String, required: true },
email: { type: String, required: true, unique: true },
age: Number,
createdAt: { type: Date, default: Date.now },
isDeleted: { type: Boolean, default: false },
deletedAt: Date
};
This project uses:
MIT
Please log in to share your review and rating for this MCP.
{
"mcpServers": {
"mongodb-mongoose": {
"command": "npx",
"args": [
"-y",
"mongo-mongoose-mcp"
],
"env": {
"MONGODB_URI": "<YOUR_MONGODB_URI>",
"SCHEMA_PATH": "<PATH_TO_SCHEMA_DIRECTORY>"
}
}
}
}claude mcp add mongodb-mongoose npx -y mongo-mongoose-mcpExplore related MCPs that share similar capabilities and solve comparable challenges
by googleapis
An MCP server that streamlines database tool development by handling connection pooling, authentication, observability, and secure access, allowing agents to interact with databases via natural language.
by bytebase
Provides a universal gateway that lets MCP‑compatible clients explore and query MySQL, PostgreSQL, SQL Server, MariaDB, and SQLite databases through a single standardized interface.
by designcomputer
Enables secure interaction with MySQL databases via the Model Context Protocol, allowing AI applications to list tables, read contents, and execute queries safely.
by benborla
Provides read‑only access to MySQL databases for large language models, allowing schema inspection and safe execution of SQL queries.
by neo4j-contrib
Enables natural‑language interaction with Neo4j databases, allowing large language models to query, modify, and manage graph data through multiple transport modes.
by mongodb-js
Provides a Model Context Protocol server that enables interaction with MongoDB databases and MongoDB Atlas clusters through a unified API.
by ClickHouse
Enables AI assistants to run read‑only ClickHouse queries, list databases and tables, and execute embedded chDB queries through an MCP interface.
by neondatabase
Interact with Neon Postgres databases using natural language commands through the Model Context Protocol, enabling conversational database creation, migration, and query execution.
by motherduckdb
Enables SQL analytics on DuckDB and MotherDuck databases via a Model Context Protocol server, allowing AI assistants and IDEs to query data directly.