- Home
- MCP servers
- MongoDB
MongoDB
- typescript
13
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"1rb-mongo-mcp": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}You can empower your AI assistants to interact directly with MongoDB by exposing MongoDB operations through an MCP (Model Context Protocol) server. This lets you query collections, inspect schemas, manage data, and apply access controls from natural language prompts, all while keeping your data secure and consistently formatted for the AI client you’re using.
How to use
You connect an MCP client to the MongoDB MCP Server and start issuing natural language prompts to explore data. Expect to query available collections, view collection schemas, filter documents, and perform standard data operations like insert, update, and delete. The server converts your requests into MongoDB operations, validates inputs, and returns structured results the AI client can present.
How to install
Prerequisites you need to satisfy before installing the MCP server include Node.js version 18 or higher and a MongoDB instance (local or remote). You also should have an MCP client such as Claude Desktop or Cursor.ai ready to connect.
Install via Node package manager using the following command to run the MCP server through a one-off tool invocation (no global installation required):
npx -y @ smithery/cli install mongo-mcp --client claude
Local development and running options
You can run the server in local development mode using a direct Node command or through an npx-based invocation. Use the following configurations to connect your MCP client to MongoDB.
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": [
"dist/index.js",
"mongodb://root:example@localhost:27017/test?authSource=admin"
]
}
}
}
Available tools
listCollections
Lists all collections in the connected MongoDB database.
find
Queries documents with filtering and projection support.
insertOne
Inserts a single document into a specified collection.
updateOne
Updates a single document in a collection based on a filter.
deleteOne
Deletes a single document from a collection.
createIndex
Creates an index on a collection for specified fields.
dropIndex
Removes an index from a collection.
indexes
Lists all indexes for a collection.