Connects Claude directly to MongoDB databases through the Model Context Protocol, exposing collection querying, schema inspection, and document CRUD operations. You can ask Claude to find documents with natural language filters, create and manage indexes, insert or update records, and explore database structures without writing MongoDB queries manually. Works with any MongoDB instance via connection string. Ideal when you need to let Claude analyze your data, generate reports from collections, or perform database maintenance tasks through conversation rather than switching to a MongoDB client or writing scripts.
A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.
https://github.com/user-attachments/assets/2389bf23-a10d-49f9-bca9-2b39a1ebe654
To get started, find your mongodb connection url and add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}
To install MongoDB MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mongo-mcp --client claude
If you don't have a mongo db server to connect to and want to create a sample sandbox, follow these steps
docker-compose up -d
npm run seed
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": [
"dist/index.js",
"mongodb://root:example@localhost:27017/test?authSource=admin"
]
}
}
}
The seed script creates three collections with sample data:
Try these prompts with Claude to explore the functionality:
"What collections are available in the database?"
"Show me the schema for the users collection"
"Find all users in San Francisco"
"Find all electronics products that are in stock and cost less than $1000"
"Show me all orders from the user john@example.com"
"List the products with ratings above 4.5"
"What indexes exist on the users collection?"
"Create an index on the products collection for the 'category' field"
"List all indexes across all collections"
"Insert a new product with name 'Gaming Laptop' in the products collection"
"Update the status of order with ID X to 'shipped'"
"Find and delete all products that are out of stock"
The server provides these tools for database interaction:
find: Query documents with filtering and projectionlistCollections: List available collectionsinsertOne: Insert a single documentupdateOne: Update a single documentdeleteOne: Delete a single documentcreateIndex: Create a new indexdropIndex: Remove an indexindexes: List indexes for a collectionThis project is licensed under the MIT License - see the LICENSE file for details.
hovecapital/read-only-local-postgres-mcp-server
cocaxcode/database-mcp
io.github.infoinlet-marketplace/mcp-mysql
io.github.cybeleri/database-admin
io.github.yash-0620/postgres-mcp-secured