MongoDB MCP Server for LLMs

by vivek1612
Verified
MIT License
340
  • Apple

Integrations

  • Enables direct interaction with MongoDB databases, offering tools for collection schema inspection, document querying and filtering, index management, and document operations (insertion, updates, deletion).

🗄️ LLMS 向け MongoDB MCP サーバー

LLMがMongoDBデータベースと直接やり取りできるようにするモデルコンテキストプロトコル(MCP)サーバー。コレクションのクエリ、スキーマの検査、そして自然言語によるシームレスなデータ管理を実現します。

✨ 特徴

  • 🔍 コレクションスキーマ検査
  • 📊 ドキュメントのクエリとフィルタリング
  • 📈 インデックス管理
  • 📝 ドキュメント操作(挿入、更新、削除)

デモビデオ

https://github.com/user-attachments/assets/2389bf23-a10d-49f9-bca9-2b39a1ebe654

🚀 クイックスタート

開始するには、mongodb 接続 URL を見つけて、次の構成を Claude Desktop 構成ファイルに追加します。

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" ] } } }

Smithery経由でインストール

Smithery経由で Claude Desktop 用の MongoDB MCP Server を自動的にインストールするには:

npx -y @smithery/cli install mongo-mcp --client claude

前提条件

  • Node.js 18歳以上
  • npx
  • Docker および Docker Compose (ローカル サンドボックス テストのみ)
  • MCP クライアント (例: Claude デスクトップ アプリ)

テストサンドボックスのセットアップ

接続するmongo dbサーバーがなく、サンプルサンドボックスを作成したい場合は、次の手順に従ってください。

  1. Docker Compose を使用して MongoDB を起動します。
docker-compose up -d
  1. データベースにテストデータを入力します。
npm run seed

Claudeデスクトップの設定

この構成を Claude Desktop 構成ファイルに追加します。

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" ] } } }

テストサンドボックスのデータ構造

シード スクリプトは、サンプル データを含む 3 つのコレクションを作成します。

ユーザー

  • 個人情報(名前、メールアドレス、年齢)
  • 座標を含むネストされた住所
  • さまざまな興味
  • 会員期間

製品

  • 製品の詳細(名前、SKU、カテゴリ)
  • ネストされた仕様
  • 価格と在庫情報
  • タグと評価

注文

  • 注文の詳細と商品
  • ユーザーリファレンス
  • 配送と支払い情報
  • ステータス追跡

🎯 プロンプトの例

機能を確認するには、Claude と一緒に次のプロンプトを試してください。

基本操作

"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"

📝 利用可能なツール

サーバーは、データベースとの対話用に次のツールを提供します。

クエリツール

  • find : フィルタリングと投影によるドキュメントのクエリ
  • listCollections : 利用可能なコレクションを一覧表示する
  • insertOne : 単一のドキュメントを挿入する
  • updateOne : 単一のドキュメントを更新する
  • deleteOne : 1つのドキュメントを削除する

インデックスツール

  • createIndex : 新しいインデックスを作成する
  • dropIndex : インデックスを削除する
  • indexes : コレクションのインデックスを一覧表示する

📜 ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

LLM が MongoDB データベースと直接対話できるようにするモデル コンテキスト プロトコル サーバー。これにより、ユーザーはコレクションをクエリし、スキーマを検査し、自然言語でデータを管理できるようになります。

  1. ✨ Features
    1. Demo Video
      1. 🚀 Quick Start
        1. Installing via Smithery
        2. Prerequisites
        3. Test Sandbox Setup
        4. Configure Claude Desktop
        5. Test Sandbox Data Structure
      2. 🎯 Example Prompts
        1. Basic Operations
        2. Advanced Queries
        3. Index Management
        4. Document Operations
      3. 📝 Available Tools
        1. Query Tools
        2. Index Tools
      4. 📜 License
        ID: a5lx0dulpo