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 分