MCP MongoDB サーバー
LLMがMongoDBデータベースとやり取りできるようにするモデルコンテキストプロトコルサーバー。このサーバーは、標準化されたインターフェースを介してコレクションスキーマを検査し、MongoDB操作を実行する機能を提供します。
デモ
主な特徴
スマートなオブジェクトID処理
文字列IDとMongoDB ObjectId間のインテリジェントな変換
objectIdMode
パラメータで設定可能:"auto"
: フィールド名に基づいて変換します(デフォルト)"none"
: 変換なし"force"
: すべての文字列IDフィールドをObjectIdに強制する
柔軟な構成
環境変数:
MCP_MONGODB_URI
: MongoDB 接続 URIMCP_MONGODB_READONLY
: 「true」に設定すると読み取り専用モードが有効になります
コマンドラインオプション:
--read-only
または-r
: 読み取り専用モードで接続する
読み取り専用モード
書き込み操作(更新、挿入、インデックス作成)に対する保護
最適なパフォーマンスを得るために MongoDB のセカンダリ読み取り設定を使用します
実稼働データベースに安全に接続するのに最適
MongoDB 操作
読み取り操作:
オプションの実行プラン分析によるドキュメントのクエリ
集計パイプラインを実行する
条件に一致するドキュメントをカウントする
コレクションスキーマ情報を取得する
書き込み操作(読み取り専用モードではない場合):
ドキュメントの更新
新しいドキュメントを挿入する
インデックスを作成する
LLM統合
LLMインタラクション強化のためのコレクション完了
コンテキスト理解を向上させるスキーマ推論
データの洞察を得るための収集分析
インストール
グローバルインストール
開発のために
使用法
基本的な使い方
環境変数
環境変数を使用してサーバーを構成できます。これは、CI/CD パイプライン、Docker コンテナ、またはコマンド引数で接続の詳細を公開したくない場合に特に便利です。
Claude Desktop 構成で環境変数を使用する:
Docker で環境変数を使用する:
Claude Desktopとの統合
手動設定
Claude Desktop の設定ファイルにサーバー設定を追加します。
MacOS : ~/Library/Application Support/Claude/claude_desktop_config.json
Windows : %APPDATA%/Claude/claude_desktop_config.json
コマンドライン引数のアプローチ:
環境変数アプローチ:
GitHub パッケージの使用法:
WindsurfとCursorとの統合
MCP MongoDB サーバーは、Claude Desktop と同様に Windsurf および Cursor で使用できます。
ウィンドサーフィンの構成
Windsurf 構成にサーバーを追加します。
カーソルの設定
カーソルの場合は、設定にサーバー構成を追加します。
Claude Desktop 構成に示されているのと同じパターンに従って、Windsurf と Cursor の両方で環境変数アプローチを使用することもできます。
自動インストール
Smitheryの使用:
mcp-get の使用:
利用可能なツール
クエリ操作
query : MongoDBクエリを実行する
{ collection: "users", filter: { age: { $gt: 30 } }, projection: { name: 1, email: 1 }, limit: 20, explain: "executionStats" // Optional }集計: 集計パイプラインを実行する
{ collection: "orders", pipeline: [ { $match: { status: "completed" } }, { $group: { _id: "$customerId", total: { $sum: "$amount" } } } ], explain: "queryPlanner" // Optional }count : 一致する文書を数える
{ collection: "products", query: { category: "electronics" } }
書き込み操作
更新: ドキュメントを変更する
{ collection: "posts", filter: { _id: "60d21b4667d0d8992e610c85" }, update: { $set: { title: "Updated Title" } }, upsert: false, multi: false }挿入: 新しいドキュメントを追加する
{ collection: "comments", documents: [ { author: "user123", text: "Great post!" }, { author: "user456", text: "Thanks for sharing" } ] }createIndex : コレクションのインデックスを作成する
{ collection: "users", indexes: [ { key: { email: 1 }, unique: true, name: "email_unique_idx" } ] }
システム操作
serverInfo : MongoDB サーバーの詳細を取得する
{ includeDebugInfo: true // Optional }
デバッグ
MCPサーバーはstdio経由で通信するため、デバッグが困難になる場合があります。MCPインスペクターを使用すると、より詳細な情報を得ることができます。
これにより、ブラウザでデバッグ ツールにアクセスするための URL が提供されます。
ライセンス
このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
LLMがMongoDBデータベースとやり取りできるようにするモデルコンテキストプロトコルサーバー。このサーバーは、標準化されたインターフェースを介してコレクションスキーマを検査し、MongoDB操作を実行する機能を提供します。
Related MCP Servers
- -securityAlicense-qualityA 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.Last updated -109169MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated -1091MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated -109MIT License
- -securityAlicense-qualityA Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases, allowing them to query collections, inspect schemas, and manage data seamlessly through natural language.