DBHub

io.github.bytebase由 GitHub 帳號 bytebase 發布v1.6.0更新於 Nov 7, 2026

Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite

已驗證STDIO僅桌面資料庫開發者工具

概覽

AI 產生的概覽

輕量級 MCP 伺服器,讓助理在 PostgreSQL、MySQL、MariaDB、SQL Server、Oracle 與 SQLite 上執行 SQL 並瀏覽資料庫結構。

可以做什麼
  • 執行 SQL 查詢,支援交易與安全控管
  • 搜尋並瀏覽結構、資料表、欄位、索引與預存程序
  • 在不執行的情況下檢視查詢執行計畫(選用)
  • 回報連線池狀態與緩衝區快取命中率(選用)
  • 執行在 TOML 設定中定義的可重複使用參數化 SQL 操作
  • 透過內建網頁工作台執行查詢並檢視請求追蹤
適用情境
適合需要讓助理在開發過程中檢視或查詢一個或多個關聯式資料庫、驗證 SQL、除錯資料,或為非技術使用者提供受控唯讀存取的情境。單一程序即可取代為每個資料庫分別部署的伺服器。
執行需求
以 npm 套件形式在本機執行(需 Node.js 22.5.0 或更新版本),也可使用 Docker。需要目標資料庫的連線資訊,可透過 DSN 或 DB_TYPE、DB_HOST、DB_PORT、DB_NAME、DB_USER、DB_PASSWORD 提供。選用的 SSH 通道需要 SSH_HOST、SSH_USER、SSH_PORT 以及金鑰、密碼或 agent socket。預設傳輸為 stdio,HTTP 模式使用 PORT。
安裝前請注意
此伺服器持有資料庫憑證(DSN、DB_PASSWORD、SSH_PASSWORD、SSH_PASSPHRASE、SSH_KEY),並可執行任意 SQL,除非啟用唯讀模式,否則包含寫入與刪除。連接正式環境資料前應啟用唯讀模式、列數限制與查詢逾時,並注意查詢結果會傳送給 MCP 用戶端。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 DBHub,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[!NOTE]
If you need an enterprise-level database MCP server with built-in guardrails like approval flow, access control, data masking, and audit logging beyond what DBHub offers, check out Bytebase.

[GitHub Trending Repository of the Day]

[DBHub Logo]

bash
            +------------------+    +--------------+    +------------------+            |                  |    |              |    |                  |            |  Claude Desktop  +--->+              +--->+    PostgreSQL    |            |                  |    |              |    |                  |            |  Claude Code     +--->+              +--->+    SQL Server    |            |                  |    |              |    |                  |            |  Cursor          +--->+    DBHub     +--->+    Oracle        |            |                  |    |              |    |                  |            |  VS Code         +--->+              +--->+    SQLite        |            |                  |    |              |    |                  |            |  Copilot CLI     +--->+              +--->+    MySQL         |            |                  |    |              |    |                  |            |                  |    |              +--->+    MariaDB       |            |                  |    |              |    |                  |            +------------------+    +--------------+    +------------------+                 MCP Clients           MCP Server             Databases

DBHub is a minimal MCP server: token-efficient, zero-dependency, and just two tools by default with opt-in extras. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases:

  • Minimal: Zero dependency, token efficient with a minimal set of MCP tools to maximize context window
  • Multi-Database: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, and SQLite through a single interface
  • Multi-Connection: Connect to multiple databases simultaneously with TOML configuration
  • Guardrails: Read-only mode, row limiting, and query timeout to prevent runaway operations
  • Secure Access: SSH tunneling and SSL/TLS encryption

DBHub is the official example in the Claude Code docs for connecting to PostgreSQL via MCP.

Token Efficiency

DBHub loads just 2 tools by default at 1.4k tokens — 13-14x fewer than alternatives — keeping the context window open for your actual work.

MCP ServerDefault ConfigDefault Tools
DBHub1.4k2 (execute_sql, search_objects)
MCP Toolbox19.0k28
Supabase MCP19.3kall

Use Cases

  • Local Development: Schema exploration, query validation, and data debugging with Claude Code, VS Code, Cursor, etc.
  • Non-Technical Access: Expose curated, read-only views to non-technical staff via Claude Desktop, VS Code, Cursor, etc.
  • Multi-Database Consolidation: Replace separate MCP servers for each database with a single DBHub process
  • Production Troubleshooting: Read-only diagnostics with guardrails against runaway queries

Supported Databases

PostgreSQL, MySQL, SQL Server, MariaDB, Oracle, and SQLite.

MCP Tools

DBHub implements MCP tools for database operations:

  • execute_sql: Execute SQL queries with transaction support and safety controls
  • search_objects: Search and explore database schemas, tables, columns, indexes, and procedures with progressive disclosure
  • explain_sql (opt-in): Show a query's execution plan without running it
  • health_check (opt-in): Report connection pool state and buffer cache hit ratio
  • Custom Tools: Define reusable, parameterized SQL operations in your dbhub.toml configuration file

Workbench

DBHub includes a built-in web interface for interacting with your database tools. It provides a visual way to execute queries, run custom tools, and view request traces without requiring an MCP client.

[workbench]

Installation

bash
npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

Also available as:

See the Installation Guide for all options, Command-Line Options for parameters, and Multi-Database Configuration for connecting several databases at once.

Development

Requires Node.js >= 22.5.0 (DBHub uses the built-in node:sqlite module).

bash
# Install dependenciespnpm install
# Run in development modepnpm dev
# Build and run for productionpnpm build && pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"

See Testing and Debug.

Contributors

[圖片]

Star History

[Star History Chart]

來源:README.md,提交 8c09c86

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

7
  1. v1.6.0最新Nov 7, 2026
  2. v1.5.1Nov 3, 2026
  3. v1.5.0Oct 9, 2026
  4. v1.4.0Sep 29, 2026
  5. v1.3.1Sep 21, 2026
  6. v1.3.0Sep 19, 2026
  7. v1.2.3Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分