https://github.com/QuantGeekDev/mongo-mcp
A mongo db server for the model context protocol (MCP)
https://github.com/QuantGeekDev/mongo-mcp
Last synced: about 2 months ago
JSON representation
A mongo db server for the model context protocol (MCP)
- Host: GitHub
- URL: https://github.com/QuantGeekDev/mongo-mcp
- Owner: QuantGeekDev
- License: mit
- Created: 2024-12-05T23:12:54.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-15T23:32:51.000Z (7 months ago)
- Last Synced: 2025-08-03T22:44:56.017Z (2 months ago)
- Language: TypeScript
- Size: 43.9 KB
- Stars: 158
- Watchers: 4
- Forks: 30
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mcp-servers - mongo-mcp - MongoDB MCP server integration for allowing LLMs to interact directly with MongoDB databases via MCP. ([Read more](/details/mongo-mcp.md)) `mcp` `mongodb` `database` `integration` (Database & Messaging MCP Servers)
- awesome-mcp-list - QuantGeekDev/mongo-mcp - mcp?style=social)](https://github.com/QuantGeekDev/mongo-mcp): Enables direct interaction with MongoDB databases. (Uncategorized / Uncategorized)
- awesome-mcp-zh - QuantGeekDev/mongo-mcp
- best-of-mcp-servers - GitHub
- awesome-mcp-servers - QuantGeekDev/mongo-mcp - MongoDB integration that enables LLMs to interact directly with databases. (Legend / ๐๏ธ <a name="databases"></a>Databases)
- awesome-mcp-servers - Mongo - A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases (Community Servers)
- awesome-mcp-servers - Mongo - A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases (Community Servers)
- Awesome-MCP-Servers-directory - Mongo - A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases (Databases)
- awesome-mcp-servers - QuantGeekDev/mongo-mcp - LLMใใใผใฟใใผในใจ็ดๆฅๅฏพ่ฉฑใงใใใใใซใใMongoDB็ตฑๅ (ใตใผใใผๅฎ่ฃ / ๐งฎ <a name="data-science-tools"></a>ใใผใฟใตใคใจใณในใใผใซ)
- awesome-mcp-servers - MongoMCP - A mongo db server for the model context protocol (MCP) (Table of Contents / Databases)
- awesome-mcp-servers - MongoMCP - A mongo db server for the model context protocol (MCP) (Table of Contents / Databases)
- mcp-index - MongoDB MCP Server - Enables LLMs to interact directly with MongoDB databases using natural language, facilitating schema inspection, document querying, and data management. (Task and Project Management)
- awesome-mcp-servers - QuantGeekDev/mongo-mcp - MongoDB integration that enables LLMs to interact directly with databases. (Legend / ๐๏ธ <a name="databases"></a>Databases)
- awesome-mcp - QuantGeekDev/mongo-mcp - MongoDB integration that enables LLMs to interact directly with databases. (MCP Servers / ๐๏ธ Databases)
README
# ๐๏ธ MongoDB MCP Server for LLMS
[](https://nodejs.org/en/)
[](https://opensource.org/licenses/MIT)
[](https://smithery.ai/server/mongo-mcp)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.
## โจ Features
- ๐ Collection schema inspection
- ๐ Document querying and filtering
- ๐ Index management
- ๐ Document operations (insert, update, delete)## Demo Video
https://github.com/user-attachments/assets/2389bf23-a10d-49f9-bca9-2b39a1ebe654
## ๐ Quick Start
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````json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://:@:/?authSource=admin"
]
}
}
}
```### Installing via Smithery
To install MongoDB MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mongo-mcp):
```bash
npx -y @smithery/cli install mongo-mcp --client claude
```### Prerequisites
- Node.js 18+
- npx
- Docker and Docker Compose (for local sandbox testing only)
- MCP Client (Claude Desktop App for example)### Test Sandbox Setup
If you don't have a mongo db server to connect to and want to create a sample sandbox, follow these steps
1. Start MongoDB using Docker Compose:
```bash
docker-compose up -d
```2. Seed the database with test data:
```bash
npm run seed
```### Configure Claude Desktop
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`#### Local Development Mode:
```json
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": [
"dist/index.js",
"mongodb://root:example@localhost:27017/test?authSource=admin"
]
}
}
}
```### Test Sandbox Data Structure
The seed script creates three collections with sample data:
#### Users
- Personal info (name, email, age)
- Nested address with coordinates
- Arrays of interests
- Membership dates#### Products
- Product details (name, SKU, category)
- Nested specifications
- Price and inventory info
- Tags and ratings#### Orders
- Order details with items
- User references
- Shipping and payment info
- Status tracking## ๐ฏ Example Prompts
Try these prompts with Claude to explore the functionality:
### Basic Operations
```plaintext
"What collections are available in the database?"
"Show me the schema for the users collection"
"Find all users in San Francisco"
```### Advanced Queries
```plaintext
"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"
```### Index Management
```plaintext
"What indexes exist on the users collection?"
"Create an index on the products collection for the 'category' field"
"List all indexes across all collections"
```### Document Operations
```plaintext
"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"
```## ๐ Available Tools
The server provides these tools for database interaction:
### Query Tools
- `find`: Query documents with filtering and projection
- `listCollections`: List available collections
- `insertOne`: Insert a single document
- `updateOne`: Update a single document
- `deleteOne`: Delete a single document### Index Tools
- `createIndex`: Create a new index
- `dropIndex`: Remove an index
- `indexes`: List indexes for a collection## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.