mongodb3-mcp-server
Provides tools for interacting with MongoDB databases (3.6+), including querying, aggregating, counting, exploring metadata, and optionally writing, updating, and deleting documents. Supports connection management and database/collection operations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mongodb3-mcp-servershow me all collections in the database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mongodb3-mcp-server
A lightweight MCP (Model Context Protocol) server for MongoDB, compatible with MongoDB 3.6.18+.
Uses mongodb driver v4.x which officially supports MongoDB 3.6+.
Quick Start
# Install dependencies
npm install
# Build
npm run build
# Run (stdio transport)
MDB_MCP_CONNECTION_STRING="mongodb://localhost:27017" node dist/index.jsRelated MCP server: mongo-mcp
MCP Client Configuration
{
"mcpServers": {
"MongoDB": {
"command": "node",
"args": ["/path/to/mongodb3-mcp-server/dist/index.js"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017"
}
}
}
}Enable Write Mode
By default, the server runs in read-only mode for safety. To enable write/delete operations:
{
"mcpServers": {
"MongoDB": {
"command": "node",
"args": ["/path/to/mongodb3-mcp-server/dist/index.js"],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017",
"MDB_MCP_WRITABLE": "true"
}
}
}
}Pass
--writableCLI flag as an alternative.
Kiro MCP Configuration
Add the following to your Kiro MCP config (~/.kiro/settings/mcp.json):
{
"mcpServers": {
"dev-mongodb3": {
"command": "npx",
"args": ["mongodb3-mcp-server"],
"env": {
"MDB_MCP_WRITABLE": "false",
"MDB_MCP_CONNECTION_STRING": "mongodb://root:root@localhost:17017/admin?authSource=admin"
},
"disabled": true
}
}
}Configuration
Environment Variable / CLI Flag | Default | Description |
| - | MongoDB connection string |
|
| Set |
|
| Max documents per query |
Supported Tools (23 tools)
Connection (2)
Tool | Description |
| Connect to a MongoDB instance |
| Switch to a different connection |
Read (5)
Tool | Description |
| Query documents in a collection |
| Run aggregation pipeline on a collection |
| Run aggregation pipeline at database level |
| Count documents with optional filter |
| Get execution plan for find/aggregate/count |
Metadata (7)
Tool | Description |
| List all database names (uses |
| List collections in a database |
| List indexes on a collection |
| Infer schema by sampling documents |
| Get collection storage size |
| Get database statistics |
| Get recent mongod log entries |
Write (requires --writable or MDB_MCP_WRITABLE=true) (3)
Tool | Description |
| Insert documents into a collection |
| Update documents matching a filter |
| Delete documents matching a filter |
Manage (requires --writable or MDB_MCP_WRITABLE=true) (6)
Tool | Description |
| Create a new collection |
| Drop a collection |
| Drop a database |
| Rename a collection |
| Create an index |
| Drop an index |
Resources
Resource | URI | Description |
|
| Server configuration (redacted) |
MongoDB 3.6 Compatibility
This server uses mongodb driver v4.17.x which officially supports MongoDB 3.6+. All tools use commands and operations available in MongoDB 3.6:
find,aggregate,count— core query operations$sampleaggregation stage for schema inferencecollStats,dbStats,getLogadmin commandscreateIndexes,dropIndexesindex managementlistDatabases,listCollectionsmetadata commandsinsert,update,deletewrite operations
No features requiring MongoDB 4.0+ (like transactions or $merge) are used.
This server cannot be deployed
Maintenance
Related MCP Connectors
The official MCP Server for the Mux API
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
MCP server for Riveter's enrichment, scraping, and monitoring API
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceFull featured MCP Server for MongoDB database analysis.52 npm207MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables querying, inserting, updating, deleting, aggregating, and listing collections in MongoDB via natural language commands.19 npmMIT
- AlicenseNot gradedqualityAmaintenanceMCP server for comprehensive MongoDB integration, enabling database operations, document management, schema analysis, and query tools.19 npmMIT
- AlicenseAqualityDmaintenanceA read-only MCP server for querying MongoDB databases, enabling listing databases, collections, indexes, and running aggregation pipelines.528 npmMIT