DBHub

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides Docker container deployment options for running the DBHub server with configurable database connections and transport options.

  • Supports connecting to DuckDB databases to explore tables, access schema information, and perform read-only SQL queries with safety measures.

  • Provides access to MySQL databases for browsing tables, viewing schema information, and executing read-only SQL queries with safety protections.

DBHubは、モデルコンテキストプロトコル(MCP)サーバーインターフェースを実装した汎用データベースゲートウェイです。このゲートウェイにより、MCP対応クライアントは様々なデータベースに接続し、情報を参照することができます。

+------------------+ +--------------+ +------------------+ | | | | | | | | | | | | | Claude Desktop +--->+ +--->+ PostgreSQL | | | | | | | | Cursor +--->+ DBHub +--->+ SQL Server | | | | | | | | Other MCP +--->+ +--->+ SQLite | | Clients | | | | | | | | +--->+ MySQL | | | | | | | | | | +--->+ Other Databases | | | | | | | +------------------+ +--------------+ +------------------+ MCP Clients MCP Server Databases

デモ SSE エンドポイント

https://demo.dbhub.ai/sse はサンプルの従業員データベースに接続します。Cursor または MCP Inspector でデータベースを指定して、実際の動作を確認できます。

サポートされているマトリックス

データベースリソース

リソース名URI形式PostgreSQLMySQLSQL サーバーSQLite
スキーマdb://schemas
スキーマ内のテーブルdb://schemas/{schemaName}/tables
スキーマ内のテーブル構造db://schemas/{schemaName}/tables/{tableName}
テーブル内のインデックスdb://schemas/{schemaName}/tables/{tableName}/indexes
スキーマ内の手順db://schemas/{schemaName}/procedures
スキーマ内の手順の詳細db://schemas/{schemaName}/procedures/{procedureName}

データベースツール

道具コマンド名PostgreSQLMySQLSQL サーバーSQLite
クエリを実行run_query
リストコネクタlist_connectors

プロンプト機能

プロンプトコマンド名PostgreSQLMySQLSQL サーバーSQLite
SQLを生成するgenerate_sql
DB要素を説明するexplain_db

インストール

ドッカー

# PostgreSQL example docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# Demo mode with sample employee database docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --demo

国立博物館

# PostgreSQL example npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
# Demo mode with sample employee database npx @bytebase/dbhub --transport sse --port 8080 --demo

注: デモ モードには、従業員、部門、給与などのテーブルを含むバンドルされた SQLite サンプル「従業員」データベースが含まれています。

クロードデスクトップ

// claude_desktop_config.json { "mcpServers": { "dbhub-postgres-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "bytebase/dbhub", "--transport", "stdio", "--dsn", // Use host.docker.internal as the host if connecting to the local db "postgres://user:password@host.docker.internal:5432/dbname?sslmode=disable" ] }, "dbhub-postgres-npx": { "command": "npx", "args": [ "-y", "@bytebase/dbhub", "--transport", "stdio", "--dsn", "postgres://user:password@localhost:5432/dbname?sslmode=disable" ] }, "dbhub-demo": { "command": "npx", "args": ["-y", "@bytebase/dbhub", "--transport", "stdio", "--demo"] } } }

カーソル

使用法

データベース接続を構成する

テスト用にサンプル従業員データベースを使用して、DBHub をデモ モードで使用できます。

npx @bytebase/dbhub --demo

実際のデータベースでは、データベースソース名(DSN)が必要です。これはいくつかの方法で指定できます。

  • コマンドライン引数(最高優先度):
    npx @bytebase/dbhub --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • 環境変数(第2優先度):
    export DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @bytebase/dbhub
  • 環境ファイル(優先度3):
    • 開発の場合: DSNで.env.localを作成します
    • 本番環境用: DSN GXP10で.envを作成

[!警告] Dockerで実行する場合、ホストマシンで実行されているデータベースに接続するには、 localhostではなくhost.docker.internalを使用してください。例: mysql://user:password@host.docker.internal:3306/dbname

DBHub は次のデータベース接続文字列形式をサポートしています。

データベースDSNフォーマット
PostgreSQLpostgres://[user]:[password]@[host]:[port]/[database]postgres://user:password@localhost:5432/dbname?sslmode=disable
SQLitesqlite:///[path/to/file]またはsqlite::memory:sqlite:///path/to/database.dbまたはsqlite::memory:
SQL サーバーsqlserver://[user]:[password]@[host]:[port]/[database]sqlserver://user:password@localhost:1433/dbname
MySQLmysql://[user]:[password]@[host]:[port]/[database]mysql://user:password@localhost:3306/dbname

輸送

  • stdio (デフォルト) - Claude Desktop などのツールと直接統合する場合:
    npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • sse - ブラウザおよびネットワーククライアントの場合:
    npx @bytebase/dbhub --transport sse --port 5678 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

コマンドラインオプション

オプション説明デフォルト
デモサンプル従業員データベースを使用してデモモードで実行するfalse
dsnデータベース接続文字列デモモードでない場合は必須
輸送トランスポートモード: stdioまたはssestdio
ポートHTTP サーバー ポート ( --transport=sseを使用する場合にのみ適用されます)8080

デモモードでは、従業員、部門、役職、給与、部門従業員、部門マネージャーのテーブルを含むサンプル従業員データベースがロードされたインメモリSQLiteデータベースを使用します。サンプルデータベースには、テーブル作成、データロード、テスト用のSQLスクリプトが含まれています。

発達

  1. 依存関係をインストールします:
    pnpm install
  2. 開発モードで実行:
    pnpm dev
  3. 生産用にビルド:
    pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

MCP Inspectorでデバッグする

標準入出力

# PostgreSQL example TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js

南南東

# Start DBHub with SSE transport pnpm dev --transport=sse --port=8080 # Start the MCP Inspector in another terminal npx @modelcontextprotocol/inspector

DBHubサーバーの/sseエンドポイントに接続する

スターの歴史

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

MySQL、PostgreSQL、SQLite、DuckDB などに接続するユニバーサル データベース MCP サーバー。

  1. Supported Matrix
    1. Database Resources
    2. Database Tools
    3. Prompt Capabilities
  2. Installation
    1. Docker
    2. NPM
    3. Claude Desktop
    4. Cursor
  3. Usage
    1. Configure your database connection
    2. Transport
    3. Command line options
  4. Development
    1. Debug with MCP Inspector
  5. Star History
    ID: a01xnguu8x