Loading...

This MCP server allows LLMs to interact with MongoDB databases, enabling querying, schema inspection, index management, and document operations via natural language.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
This MCP server allows LLMs to interact with MongoDB databases, enabling querying, schema inspection, index management, and document operations via natural language.
This MCP server provides a balance between functionality and risk. It is relatively safe for read-only operations and index management. However, the ability to perform document operations introduces a moderate risk, especially if the MongoDB instance is not properly secured or if prompts are not carefully vetted.
Performance depends on the size of the database, the complexity of the queries, and the available indexes. Index management is crucial for optimizing query performance.
Cost depends on the MongoDB hosting solution (e.g., cloud provider, self-managed) and the volume of data processed. Frequent or complex queries can increase costs.
npx -y @smithery/cli install mongo-mcp --client claude{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}findQuery documents in a MongoDB collection using specified filters and projections.
Read-only operation; retrieves data without modifying it.
listCollectionsList the available collections in the MongoDB database.
Read-only operation; retrieves metadata without modifying data.
insertOneInsert a single document into a MongoDB collection.
Adds new data to the database, but only one document at a time.
updateOneUpdate a single document in a MongoDB collection based on specified criteria.
Modifies existing data in the database, potentially altering important information.
deleteOneDelete a single document from a MongoDB collection based on specified criteria.
Removes data from the database, which can lead to data loss.
createIndexCreate a new index on a MongoDB collection to improve query performance.
Modifies the database schema, but does not directly affect data content.
dropIndexRemove an existing index from a MongoDB collection.
Modifies the database schema and can impact query performance.
indexesList the indexes for a specific MongoDB collection.
Read-only operation; retrieves metadata without modifying data.
Environment Variable
cloud
This MCP server provides a balance between functionality and risk. It is relatively safe for read-only operations and index management. However, the ability to perform document operations introduces a moderate risk, especially if the MongoDB instance is not properly secured or if prompts are not carefully vetted.
The server defaults to read and write access, and does not provide sandboxing or rollback capabilities. Exercise caution when granting autonomy to agents, especially with destructive tools.
Production Tip
Implement robust input validation and sanitization to prevent injection attacks and ensure data integrity.
Store the connection string in a secure environment variable and restrict access to it.
Authentication is handled by the MongoDB instance itself. This server does not provide additional authorization mechanisms.
Yes, as long as you have a valid connection string for the MongoDB instance.
Implement robust input validation and sanitization to prevent injection attacks. Consider using a read-only user for querying data.
No, rate limiting is not built-in. You may need to implement it at the application level.
Monitor the Node.js application logs and the MongoDB instance metrics to identify performance bottlenecks.
You would need to configure separate MCP server instances for each database.