CM

cuongtl1992/mcp-dbs

Database management

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

21 stars 6 forks 品質 65 トレンド 0MIT

MCP Server は、LLM を SQL データベース (SQLite、SQL Server、Postgres SQL) と統合します

概要

さまざまなデータベースシステムに接続し、作業するためのモデルコンテキストプロトコル(MCP)の実装。 - SQLite - PostgreSQL - マイクロソフトSQLサーバー - MongoDB MCP データベース サーバーは、2 つのモードで使用できます。 デフォルトでは、サーバーはポート3001のSSE(Server-Sent Events)モードで動作します。 [http://localhost:3001/mcp. で SSE エンドポイントで HTTP サーバを起動します。 --port オプションを使用してカスタムポートを指定できます。 標準入力/出力を通信するツールでは、 --stdio オプションを使用できます。 Claude 設定ファイルに追加することで、mcp-dbs を Claude デスクトップと統合できます.

概要(AI 翻訳)

さまざまなデータベースシステムに接続し、作業するためのモデルコンテキストプロトコル(MCP)の実装。

サポートされているデータベース

  • SQLite
  • PostgreSQLの
  • マイクロソフトSQLサーバー
  • モンゴDB

インストール

使用法

MCP データベース サーバーは、2 つのモードで使用できます。

##SSEモード(デフォルト)

デフォルトでは、サーバーはポート3001のSSE(Server-Sent Events)モードで動作します。

[http://localhost:3001/mcp] で SSE エンドポイントで HTTP サーバを起動します。

カスタムポート

[--port]オプションを使用してカスタムポートを指定できます。

STDIO モード

標準入力/出力を通信するツールでは、[[--stdio]]]オプションを使用します。

#Claudeデスクトップの統合

Claude 設定ファイルに追加することで、mcp-dbs を Claude デスクトップと統合できます。

設定手順

1。 Claudeデスクトップ設定ファイルを開きますか、作成します 2. mcp-dbs の設定を mcpServers セクションに追加します。

独自のデータベース接続の詳細で環境変数を置き換えます。

ノート

  • [command]は[node]でなければなりません
  • [args では、mcp-dbs インストールで cli.js ファイルに絶対パスを提供します

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

MCP Database Server

A Model Context Protocol (MCP) implementation for connecting to and working with various database systems.

Supported Databases

  • SQLite
  • PostgreSQL
  • Microsoft SQL Server
  • MongoDB

Installation

npm install -g mcp-dbs

Usage

The MCP Database Server can be used in two modes:

SSE Mode (Default)

By default, the server runs in SSE (Server-Sent Events) mode on port 3001:

npx mcp-dbs

This will start an HTTP server with an SSE endpoint at http://localhost:3001/mcp.

Custom Port

You can specify a custom port using the --port option:

npx mcp-dbs --port 8080

STDIO Mode

For tools that communicate over standard input/output, you can use the --stdio option:

npx mcp-dbs --stdio

Claude Desktop Integration

You can integrate mcp-dbs with Claude Desktop by adding it to your Claude configuration file.

Configuration Steps

  1. Open or create your Claude Desktop configuration file
  2. Add the mcp-dbs configuration to the mcpServers section:
{
  "mcpServers": {
    "mcp-dbs": {
      "command": "node",
      "args": [
        "/path/to/your/mcp-dbs/dist/cli.js",
        "--stdio"
      ],
      "env": {
        "MCP_MONGODB_URI": "mongodb://localhost:27017",
        "MCP_MONGODB_DATABASE": "your-database-name"
      }
    }
  }
}

Replace the environment variables with your own database connection details.

Notes

  • The command should be node
  • In args, provide the absolute path to the cli.js file in your mcp-dbs installation
  • Configure the appropriate environment variables for your database type (see the environment variables section below)
  • You can use environment variables for any of the supported databases (SQLite, PostgreSQL, SQL Server, or MongoDB)

Using with Claude

Once configured, Claude will be able to access your database using the MCP tools described below. You can ask Claude to:

  • Connect to your database
  • Execute queries and get results
  • Explore your database schema
  • Work with tables and data

Tools

  • connect-database: Connect to a database
  • disconnect-database: Disconnect from a database
  • execute-query: Execute a query and return results
  • execute-update: Execute a query without returning results

Resources

  • database-schema: Get the full database schema
  • table-schema: Get the schema for a specific table
  • tables-list: Get a list of all tables

Using environment variables for configuration

You can configure your database connections using environment variables:

SQLite

# Set these environment variables before connecting
export MCP_SQLITE_FILENAME="path/to/database.db"
GitHub で README 全文を見る

インストール

npx mcp-dbs
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "mcp-dbs": { "command": "node", "args": [ "/path/to/your/mcp-dbs/dist/cli.js", "--stdio" ], "env": { "MCP_MONGODB_URI": "mongodb://localhost:27017", "MCP_MONGODB_DATABASE": "your-database-name" } } } }