execute_sqlLABSCO SUMMARY
Two tools at 1.4k tokens is the pitch, and the guardrails are per source.
The measured comparison in the README puts its default configuration at 1.4k tokens against 19.0k for MCP Toolbox — 13-14x fewer, self-reported but checkable. What makes it usable in production is that restrictions are per database source: production can expose search_objects only, with SQL execution simply absent, while analytics keeps full access in the same process.
What it is
A deliberately minimal database gateway. It connects to five database engines through one interface, supports several connections at once via TOML configuration, and exposes just two tools unless you opt into more — the design goal is to leave the context window for your actual work.
What you get
- SQL executed with transaction support, single or multiple statements separated by semicolons —
execute_sql - Schemas, tables, columns, indexes and procedures searched with pattern matching and progressive disclosure —
search_objects - Opt-in extras: a query's execution plan without running it, and connection pool state plus buffer cache hit ratio on PostgreSQL, MySQL, MariaDB and SQL Server —
explain_sql,health_check - Custom tools defined in
dbhub.tomlas named, parameterised SQL statements, so you can hand out specific safe operations instead of open SQL - Per-source tool control: list only
search_objectson production for read-only schema exploration, and full access on analytics - Per-tool settings including
readonly, which allows only SELECT, SHOW, DESCRIBE and EXPLAIN, andmax_rowsto cap results - Multi-database naming that keeps tools distinct —
execute_sql_prodfor a single database with an id,execute_sql_prod_pgandexecute_sql_staging_mysqlacross several - A built-in web workbench for running queries and viewing request traces without an MCP client
Requirements
A database connection string. Run it with npx @bytebase/dbhub@latest plus --transport and --dsn, or from the Docker image, the MCP Bundle for one-click read-only install, or the Claude Code plugin. Connection settings can come from DSN, or from DB_TYPE, DB_HOST, DB_PORT, DB_USER and DB_PASSWORD separately. Node.js >= 22.5.0 if you build from source, since it uses the built-in node:sqlite module. SSH tunnelling and SSL/TLS are supported. The published package is @bytebase/dbhub 1.2.1.
Setup effort
One command — npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>?sslmode=disable"
USE CASES
Exploring a schema you did not design
Search the objects with a pattern and let progressive disclosure widen only where you look, instead of dumping every table into the conversation.
Letting an agent near production safely
Configure that source with search_objects only, or with execute_sql in readonly mode and a row cap — the restriction lives in the config, not in the prompt.
Replacing one MCP server per database
Declare every source in dbhub.toml; tool names carry the source id, so execute_sql_prod_pg and execute_sql_staging_mysql cannot be confused for one another.
Giving non-technical people a safe query
Define a custom tool with a fixed statement and typed parameters, and leave general SQL execution off for that source entirely.
Finding out why a query is slow
Enable the opt-in plan tool to read the execution plan without running it, and the health check for pool state and cache hit ratio.
4 tools
Listed in project docs. Your client may show a different list.
search_objectsexplain_sqlhealth_checkBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
npx on PATH
INSTALLATION
Connect your client
Server setup
npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>?sslmode=disable"MCP Clients
Claude Code
{
"mcpServers": {
"dbhub": {
"type": "stdio",
"command": "npx",
"args": [
"@bytebase/dbhub@latest",
"--transport",
"stdio",
"--dsn",
"postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>"
]
}
}
}Claude Desktop, Cursor, GitHub Copilot
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"@bytebase/dbhub@latest",
"--transport",
"stdio",
"--dsn",
"postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>"
]
}
}
}VS Code
{
"servers": {
"dbhub": {
"type": "stdio",
"command": "npx",
"args": [
"@bytebase/dbhub@latest",
"--transport",
"stdio",
"--dsn",
"postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>"
]
}
}
}Codex
codex mcp add dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@localhost:5432/<YOUR_DB_NAME>"HTTP server for Dify
DBHub must be running as an HTTP server for Dify to connect: start it with the command under Installation.
In Dify, navigate to Tools → MCP
Click Add MCP Server (HTTP)
Server URL: http://localhost:8080/mcp (or your DBHub host). Name: DBHub. Server Identifier: dbhub (permanent, max 24 characters)
Click save. Dify will automatically discover DBHub's tools.