Skip to main content
Glama

MCP Database Server

MCP データベース サーバー

大規模言語モデル(LLM)が自然言語を介して様々なデータベースと対話できるようにする、モデルコンテキストプロトコル(MCP)サーバー実装。現在MongoDBをサポートしており、今後以下のデータベースへのサポートも予定されています。

  • PostgreSQL
  • コックローチDB
  • レディス
  • さらに…

特徴

  • 自然言語によるデータベース操作
  • 現在、以下の機能を備えた MongoDB をサポートしています:
    • すべてのコレクションを一覧表示する
    • フィルタリングと投影によるドキュメントのクエリ
    • ドキュメントを挿入する
    • ドキュメントを削除する
    • 集約パイプライン操作
  • 他のデータベースの将来のサポート:
    • PostgreSQL: SQLクエリ、テーブル操作
    • CockroachDB: 分散SQL操作
    • Redis: キー値操作、キャッシュ

前提条件

  • Node.js v20.12.2 以上
  • データベース(現在は MongoDB、他のデータベースも近日中に提供予定)
  • クロードデスクトップアプリケーション

インストール

  1. リポジトリをクローンします。
git clone https://github.com/manpreet2000/mcp-database-server.git cd mcp-database-server
  1. 依存関係をインストールします:
npm install
  1. TypeScript コードをビルドします。
npm run build

構成

開始するには、Claude Desktop 構成ファイルでデータベース接続を構成する必要があります。

macOS

~/Library/Application\ Support/Claude/claude_desktop_config.json

ウィンドウズ

%APPDATA%/Claude/claude_desktop_config.json

claude_desktop_config.jsonに次の構成を追加します。

{ "mcpServers": { "database": { "command": "/path/to/node", "args": ["/path/to/mcp-database/dist/index.js"], "env": { "MONGODB_URI": "your-mongodb-connection-string" } } } }

交換する:

  • /path/to/nodeをNode.js実行ファイルのパスに置き換えるか、単にnodeを使用します。
  • /path/to/mcp-databaseにこのリポジトリへの絶対パスを記述します
  • your-mongodb-connection-string MongoDB 接続 URL に置き換えます。

使用例

MongoDBの例

  1. データベース内のすべてのコレクションを一覧表示します。
Can you show me all the collections in my database?
  1. コレクションから特定のレコードを取得します。
Give me 2 records from the chargers collection
  1. フィルターを使用したクエリ:
Show me all documents in the users collection where status is active
  1. ドキュメントを挿入します:
Add a new user to the users collection with name John and email john@example.com
  1. ドキュメントを削除します。
Remove the user with email john@example.com from the users collection
  1. 集計データ:
Show me the total count of users by status in the users collection

利用可能なツール

1. getCollections

接続されたデータベース内のすべてのコレクションを一覧表示します。

2. getCollection

オプションのクエリ パラメータを使用してコレクションからドキュメントを取得します。

  • collectionName : コレクションの名前
  • limit : 返されるドキュメントの最大数(デフォルト: 10、最大: 1000)
  • query : MongoDBクエリオブジェクト
  • projection : 含める/除外するフィールド

3. 挿入One

コレクションに単一のドキュメントを挿入します。

  • collectionName : コレクションの名前
  • document : 挿入するドキュメントオブジェクト

4. 1つ削除

コレクションから単一のドキュメントを削除します。

  • collectionName : コレクションの名前
  • query : 削除する文書に一致するクエリ

5. 集計

集計パイプラインを実行します。

  • collectionName : コレクションの名前
  • pipeline : 集約ステージの配列
  • options : オプションの集計オプション

将来のデータベースサポート

PostgreSQL

  • SQLクエリ実行
  • テーブル操作
  • スキーマ管理
  • 取引サポート

コックローチDB

  • 分散SQL操作
  • マルチリージョンサポート
  • トランザクション管理
  • スキーマ操作

レディス

  • キー値操作
  • キャッシュメカニズム
  • パブリッシュ/サブスクライブ操作
  • データ構造操作

安全

  • データベース接続文字列をバージョン管理にコミットしないでください
  • 機密情報には環境変数を使用する
  • データベース固有のセキュリティのベストプラクティスに従う

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。大きな変更については、まずIssueを開いて、変更したい点について議論してください。

ライセンス

MITライセンス - 詳細はライセンスをご覧ください

-
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. 特徴
    1. 前提条件
      1. インストール
        1. 構成
          1. macOS
          2. ウィンドウズ
        2. 使用例
          1. MongoDBの例
        3. 利用可能なツール
          1. getCollections
          2. getCollection
          3. 挿入One
          4. 1つ削除
          5. 集計
        4. 将来のデータベースサポート
          1. PostgreSQL
          2. コックローチDB
          3. レディス
        5. 安全
          1. 貢献
            1. ライセンス

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                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.
                Last updated -
                340
                75
                TypeScript
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.
                Last updated -
                8
                817
                217
                TypeScript
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and various API operations including record management.
                Last updated -
                10
                77
                Python
                MIT License
              • -
                security
                A
                license
                -
                quality
                A 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 -
                340
                TypeScript
                MIT License
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/manpreet2000/mcp-database-server'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server