MongoDB MCP Server
A Model Context Protocol (MCP) server for MongoDB operations, enabling AI assistants to interact with MongoDB databases through a standardized interface.
Power your agent
पब्लिशर का इंस्टॉल। PlugMCP एंडपॉइंट नहीं।
Host a copy with our keys and logs.
रजिस्ट्री में अभी कोई पैकेज्ड रिलीज़ नहीं है। रिपॉज़िटरी का README देखें.
रिमोट URL या आपकी मशीन पर कमांड? दोनों इंस्टॉल में क्या अंतर है
PlugMCP पर चलाएँ
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
लॉन्चपब्लिशर से
A Model Context Protocol (MCP) server for MongoDB operations, enabling AI assistants to interact with MongoDB databases through a standardized interface.
Professional MongoDB MCP Server. Empowers LLMs with intelligent document management, complex aggregation pipeline construction, and collection analysis. Built for secure, AI-driven NoSQL development with robust access control and query validation.
npm install mongodb-mcp
Or from source:
git clone https://github.com/az-coder-123/mongodb-mcp.git
cd mongodb-mcp
npm install
npm run build
Create a mcp-settings.json file in your project root or home directory:
{
"connectionString": "mongodb://localhost:27017",
"permissions": {
"readOnly": false,
"allowedDatabases": ["myapp", "analytics"],
"deniedDatabases": ["admin", "config"],
"allowedCollections": {
"myapp": ["users", "orders", "products"]
},
"deniedTools": ["drop_database"],
"maxQueryResults": 1000,
"maxBulkOperations": 1000
},
"auditLog": {
"enabled": true,
"logFilePath": "./logs/audit.log",
"maxEntries": 10000,
"logSuccess": true,
"logFailure": true
},
"rateLimit": {
"enabled": true,
"maxRequests": 100,
"windowMs": 60000
},
"dataMasking": true,
"maskedFields": ["password", "secret", "token", "apiKey"]
}
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": ["/path/to/mongodb-mcp/dist/index.js"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017"
}
}
}
}
List all databases in the MongoDB instance.
{}
Get statistics for a specific database.
{
"database": "mydb"
}
⚠️ Drop a database (requires confirmation).
{
"database": "test_db",
"confirm": true
}
List all collections in a database.
{
"database": "mydb"
}
Create a new collection.
{
"database": "mydb",
"collection": "users",
"options": {
"capped": true,
"size": 1048576,
"max": 1000
}
}
⚠️ Drop a collection (requires confirmation).
{
"database": "mydb",
"collection": "temp_data",
"confirm": true
}
Find documents with filters, projections, sorting, and pagination.
{
"database": "mydb",
"collection": "users",
"filter": { "age": { "$gte": 18 } },
"projection": { "name": 1, "email": 1 },
"sort": { "name": 1 },
"limit": 10,
"skip": 0
}
Insert a single document.
{
"database": "mydb",
"collection": "users",
"document": {
"name": "John Doe",
"email": "[email protected]",
"age": 30
}
}
Insert multiple documents.
{
"database": "mydb",
"collection": "users",
"documents": [
{ "name": "User 1", "email": "[email protected]" },
{ "name": "User 2", "email": "[email protected]" }
]
}
Update a single document.
{
"database": "mydb",
"collection": "users",
"filter": { "email": "[email protected]" },
"update": { "$set": { "age": 31 } },
"upsert": false
}
Delete a single document.
{
"database": "mydb",
"collection": "users",
"filter": { "email": "[email protected]" }
}
Run an aggregation pipeline.
{
"database": "mydb",
"collection": "orders",
"pipeline": [
{ "$match": { "status": "completed" } },
{ "$group": { "_id": "$customerId", "total": { "$sum": "$amount" } } },
{ "$sort": { "total": -1 } },
{ "$limit": 10 }
]
}
Create an index on a collection.
{
"database": "mydb",
"collection": "users",
"keys": { "email": 1 },
"options": {
"unique": true,
"name": "email_unique_idx"
}
}
Check MongoDB connection health and server status.
{}
Get audit log entries.
{
"limit": 100,
"toolName": "insert_one",
"failuresOnly": false
}
Get current server configuration.
{}
Enable or disable read-only mode.
{
"enabled": true
}
Control access to databases and collections:
{
"permissions": {
"allowedDatabases": ["myapp"],
"deniedDatabases": ["admin"],
"allowedCollections": {
"myapp": ["users", "orders"]
},
"deniedTools": ["drop_database", "drop_collection"]
}
}
Prevent all write operations:
MCP_READ_ONLY=true node dist/index.js
Or via tool call:
{
"name": "set_read_only",
"arguments": { "enabled": true }
}
Dangerous operations require explicit confirmation:
drop_database requires "confirm": truedrop_collection requires "confirm": trueSensitive fields are automatically masked in responses:
{
"dataMasking": true,
"maskedFields": ["password", "secret", "token", "apiKey", "creditCard"]
}
Prevent abuse with configurable limits:
{
"rateLimit": {
"enabled": true,
"maxRequests": 100,
"windowMs": 60000
}
}
The server implements a comprehensive error handling system with structured error classes, automatic categorization, and actionable recovery suggestions.
The server returns errors in the following format:
{
"content": [
{
"type": "text",
"text": "VALIDATION_ERROR: Invalid value for 'collection': expected string, got number\n\nSuggestions:\n 1. Check 'collection' parameter\n 2. Refer to documentation for valid values\n\nContext: {\n \"field\": \"collection\",\n \"value\": 123,\n \"expectedType\": \"string\"\n}"
}
],
"isError": true
}
All errors are categorized for proper handling:
The server provides specific error types with recovery suggestions:
For comprehensive error handling documentation, see docs/error-handling.md.
This guide includes:
npm run dev
This will watch for file changes and automatically rebuild.
npm run build
npm run clean
src/
├── types/
│ └── index.ts # TypeScript interfaces and types
├── validators/
│ └── index.ts # Input validation functions
├── handlers/
│ ├── database.ts # Database operation handlers
│ ├── collection.ts # Collection operation handlers
│ ├── document.ts # Document CRUD handlers
│ ├── index-operations.ts # Index operation handlers
│ └── index.ts # Handler exports
├── resources/
│ └── index.ts # MCP resource handlers
├── tools/
│ └── index.ts # Tool definitions
├── utils/
│ ├── permission-checker.ts # Permission system
│ ├── audit-logger.ts # Audit logging
│ ├── rate-limiter.ts # Rate limiting
│ ├── data-masker.ts # Data masking
│ ├── config-loader.ts # Configuration loading
│ └── index.ts # Utility exports
├── server.ts # Main server class
└── index.ts # Entry point
MIT License - see LICENSE file for details.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Professional MongoDB MCP Server. Empowers LLMs with intelligent document management, complex aggregation pipeline construction, and collection analysis. Built for secure, AI-driven NoSQL development w
ओवरव्यू
Professional MongoDB MCP Server. Empowers LLMs with intelligent document management, complex aggregation pipeline construction, and collection analysis. Built for secure, AI-driven NoSQL development with robust access control and query validation.
टूल
अभी टूल सूची नहीं है। रिमोट सर्वर को पहले हेल्थ चेक के बाद सूची मिलती है।
FAQ
इस पेज पर Cursor, Claude Desktop, Claude Code या VS Code के लिए stdio कॉन्फ़िग कॉपी करें। यह पब्लिशर का इंस्टॉल इस्तेमाल करता है, PlugMCP प्रॉक्सी नहीं।
इस रिकॉर्ड में कोई ज़रूरी एनवायरनमेंट वेरिएबल दर्ज नहीं है।
Mongodb stdio पर लोकल चलता है।
पिछली जाँच 2026-10-28 को हुई। Professional MongoDB MCP Server. Empowers LLMs with intelligent document management, complex aggregation pipeline construction, and collection analysis. Built for secure, AI-driven NoSQL development with robust access control and query validation.