# DBHub — Token-Efficient Database MCP Server > Database MCP server for Postgres/MySQL/MariaDB/SQL Server/SQLite. Includes execute_sql + schema search with guardrails: read-only, row limits, timeouts. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```bash # Demo mode (README) npx @bytebase/dbhub@latest --transport http --port 8080 --demo # Or connect to a DB via DSN (README example) npx @bytebase/dbhub@latest --transport http --port 8080 \ --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable" ``` ## Intro DBHub is a token-efficient database MCP server: connect MCP clients to multiple databases and run safe queries with built-in guardrails. **Best for:** Agent builders who need a safer, maintainable database tool surface via MCP **Works with:** MCP clients (Claude Desktop/Code, Cursor, VS Code, Copilot CLI) and DB DSNs (see README) **Setup time:** 10–30 minutes ### Key facts (verified) - README lists multiple databases: PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite. - Quick start includes both Docker and NPM (`npx @bytebase/dbhub@latest ...`) install paths (README). - GitHub: 2,744 stars · 232 forks; pushed 2026-04-21 (GitHub API verified). ## Main ### Database MCP without tool sprawl If you want agents to work with data, you usually need two safe primitives: - **Search schema** (tables/columns/indexes) before writing SQL - **Execute SQL** with strict limits DBHub ships both and adds guardrails (read-only mode, row limits, query timeouts). For production, start read-only and gate write access behind explicit review or separate credentials. ### README excerpt (verbatim) > [!NOTE] > Brought to you by [Bytebase](https://www.bytebase.com/), open-source database DevSecOps platform.

DBHub Logo

```bash +------------------+ +--------------+ +------------------+ | | | | | | | | | | | | | Claude Desktop +--->+ +--->+ PostgreSQL | | | | | | | | Claude Code +--->+ +--->+ SQL Server | | | | | | | | Cursor +--->+ DBHub +--->+ SQLite | | | | | | | | VS Code +--->+ +--->+ MySQL | | | | | | | | Copilot CLI +--->+ +--->+ MariaDB | | | | | | | | | | | | | +------------------+ +--------------+ +------------------+ MCP Clients MCP Server Databases ``` DBHub is a zero-dependency, token efficient MCP server implementing the Model Context Protocol (MCP) server interface. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases: - **Local Development First**: Zero dependency, token efficient with just two MCP tools to maximize context window - **Multi-Database**: PostgreSQL, MySQL, MariaDB, SQL Server, 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 ## Supported Databases ### FAQ **Q: Can it connect to multiple DBs?** A: Yes—README mentions multi-connection support via TOML configuration. **Q: Is it safe by default?** A: README describes guardrails like read-only mode, row limiting, and query timeouts—still review before production use. **Q: How do I try it quickly?** A: Use the README demo mode: run with `--demo` and then connect an MCP client to the server. ## Source & Thanks > Source: https://github.com/bytebase/dbhub > License: MIT > GitHub stars: 2,744 · forks: 232 --- ## 快速使用 ```bash # Demo 模式(README) npx @bytebase/dbhub@latest --transport http --port 8080 --demo # 或通过 DSN 连接数据库(README 示例) npx @bytebase/dbhub@latest --transport http --port 8080 \ --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable" ``` ## 简介 DBHub 是一个 token 高效的数据库 MCP server:让 MCP 客户端连接多种数据库,并在 guardrails 约束下安全地查询与探索结构。 **最适合:** 希望通过 MCP 提供更安全、可维护数据库工具面的 agent 开发者 **适配:** MCP 客户端(Claude Desktop/Code、Cursor、VS Code、Copilot CLI)+ 数据库 DSN(README 有说明) **配置时间:** 10–30 分钟 ### 关键事实(已验证) - README 列出支持的数据库:PostgreSQL、MySQL、MariaDB、SQL Server、SQLite。 - Quick Start 同时提供 Docker 与 NPM(`npx @bytebase/dbhub@latest ...`)方式(README)。 - GitHub:2,744 stars · 232 forks;最近更新 2026-04-21(GitHub API 验证)。 ## 正文 ### 避免“数据库工具面膨胀” 让 agent 做数据工作时,最安全的两类能力通常是: - **先看结构**(表/列/索引)再写 SQL - **带限制地执行 SQL** DBHub 把两者做成 MCP 工具,并加上 guardrails(只读、行数限制、超时)。生产环境建议先只读,写入能力单独用凭证/流程隔离并做审计。 ### README 原文节选(verbatim) > [!NOTE] > Brought to you by [Bytebase](https://www.bytebase.com/), open-source database DevSecOps platform.

DBHub Logo

```bash +------------------+ +--------------+ +------------------+ | | | | | | | | | | | | | Claude Desktop +--->+ +--->+ PostgreSQL | | | | | | | | Claude Code +--->+ +--->+ SQL Server | | | | | | | | Cursor +--->+ DBHub +--->+ SQLite | | | | | | | | VS Code +--->+ +--->+ MySQL | | | | | | | | Copilot CLI +--->+ +--->+ MariaDB | | | | | | | | | | | | | +------------------+ +--------------+ +------------------+ MCP Clients MCP Server Databases ``` DBHub is a zero-dependency, token efficient MCP server implementing the Model Context Protocol (MCP) server interface. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases: - **Local Development First**: Zero dependency, token efficient with just two MCP tools to maximize context window - **Multi-Database**: PostgreSQL, MySQL, MariaDB, SQL Server, 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 ## Supported Databases ### FAQ **能同时连多个数据库吗?** 答:可以。README 提到可通过 TOML 配置实现 multi-connection。 **默认安全吗?** 答:README 描述了只读/行数限制/超时等 guardrails;但上生产前仍建议审计与最小权限。 **怎么最快试用?** 答:用 README 的 demo 模式:`--demo` 启动后再让 MCP 客户端连接。 ## 来源与感谢 > Source: https://github.com/bytebase/dbhub > License: MIT > GitHub stars: 2,744 · forks: 232 --- Source: https://tokrepo.com/en/workflows/dbhub-token-efficient-database-mcp-server Author: MCP Hub