🗄️ Mongodb Mcp サーバー for Llms
概要
mongo-mcpとは?
mongo-mcpは、モデルコンテキストプロトコル(MCP)用に設計されたMongoDBサーバーの実装です。このプロジェクトは、MongoDBデータベースを管理し、相互作用するための堅牢で効率的な方法を提供し、MCPフレームワークを利用するアプリケーションとのシームレスな統合を促進することを目的としています。MongoDBの機能を活用することで、mongo-mcpは開発者がスケーラブルで高性能なアプリケーションを構築できるようにします。
mongo-mcpの特徴
- MCP互換性:mongo-mcpはモデルコンテキストプロトコルと連携するように特別に設計されており、このプロトコルに基づいて構築されたアプリケーションの要件を満たしています。
- スケーラビリティ:MongoDBを基盤にしているため、mongo-mcpは大量のデータと多数の同時接続を処理でき、エンタープライズレベルのアプリケーションに適しています。
- 使いやすさ:サーバーはユーザーフレンドリーを考慮して設計されており、簡単なセットアップと構成プロセスを提供します。
- オープンソース:公開リポジトリであるため、mongo-mcpは貢献を受け入れており、開発者が協力してプロジェクトを向上させることができます。
- 活発なコミュニティ:このプロジェクトは、成長する開発者コミュニティからの注目と貢献を集めており、継続的な改善とサポートを保証しています。
mongo-mcpの使い方
- インストール:まず、GitHubからリポジトリをクローンします:
git clone https://github.com/QuantGeekDev/mongo-mcp.git
- 設定:プロジェクトディレクトリに移動し、要件に応じてサーバー設定を構成します。これには、データベース接続の設定やプロトコルの定義が含まれる場合があります。
- サーバーの実行:提供されたスクリプトやコマンドを使用してmongo-mcpサーバーを起動します。MongoDBがマシンにインストールされ、実行されていることを確認してください。
- 統合:アプリケーションをMCPフレームワークを使用してmongo-mcpサーバーに接続し、効率的なデータ管理と取得を可能にします。
よくある質問
モデルコンテキストプロトコル(MCP)とは?
モデルコンテキストプロトコル(MCP)は、アプリケーションがデータモデルと構造的に相互作用する方法を定義するフレームワークです。データ操作のガイドラインを提供し、異なるアプリケーション間での一貫性と信頼性を確保します。
mongo-mcpは本番環境での使用に適していますか?
はい、mongo-mcpは堅牢でスケーラブルに設計されており、本番環境に適しています。ただし、ライブ環境に展開する前に、特定の使用ケースでサーバーを十分にテストすることをお勧めします。
mongo-mcpプロジェクトにどのように貢献できますか?
貢献は大歓迎です!問題を報告したり、プルリクエストを提出したり、ドキュメントを改善したりすることで貢献できます。貢献ガイドラインについては、プロジェクトのGitHubページを参照してください。
mongo-mcpに関する詳細情報はどこで見つけられますか?
詳細な情報、ドキュメント、更新については、mongo-mcp GitHubリポジトリを訪れてください。
詳細
🗄️ MongoDB MCP Server for LLMS
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
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}
Installing via Smithery
To install MongoDB MCP Server for Claude Desktop automatically via Smithery:
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
- Start MongoDB using Docker Compose:
docker-compose up -d
- Seed the database with test data:
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:
{
"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
"What collections are available in the database?"
"Show me the schema for the users collection"
"Find all users in San Francisco"
Advanced Queries
"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
"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
"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 projectionlistCollections
: List available collectionsinsertOne
: Insert a single documentupdateOne
: Update a single documentdeleteOne
: Delete a single document
Index Tools
createIndex
: Create a new indexdropIndex
: Remove an indexindexes
: List indexes for a collection
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
サーバー設定
{
"mcpServers": {
"mongo-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--quantgeekdev--mongo-mcp--mongo-mcp",
"node dist/index.js {{MONGODB_URI}}"
],
"env": {}
}
}
}