dbhub
Zero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, SQLite.
claude mcp add --transport stdio bytebase-dbhub npx -y @bytebase/dbhub@latest --transport http --port 8080 --dsn postgres://user:password@localhost:5432/dbname?sslmode=disable
How to use
DBHub is a zero-dependency MCP server that acts as a gateway to multiple databases via the MCP (Model Context Protocol) interface. It exposes tools for executing SQL, exploring database schemas, and running custom, parameterized operations defined in your dbhub.toml configuration. With DBHub, you can connect to PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite through a single interface, while applying guardrails such as read-only mode, row limits, and query timeouts to prevent runaway queries. The built-in workbench provides a web UI to execute queries, run custom tools, and inspect request traces without needing a separate MCP client.
To get started, run the server using the suggested npx command (or Docker/NPM alternatives shown in the installation guide). Once running, you can use the MCP tools available at the configured endpoint to execute SQL against your databases, search objects across schemas, and define reusable tasks in dbhub.toml. The system supports SSH tunneling and SSL/TLS for secure access and can manage multiple database connections concurrently via TOML configuration.
How to install
Prerequisites:
- Node.js installed (for npx usage) or Docker if you prefer containerized runs
- Access to a PostgreSQL/MySQL/MariaDB/SQL Server or SQLite database(s) you want to connect to
Installation options:
-
Quick start with Docker (recommended for isolation):
- docker run --rm --init
--name dbhub
--publish 8080:8080
bytebase/dbhub
--transport http
--port 8080
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
- docker run --rm --init
-
Run with NPM / NPX (no Docker required):
- npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
-
Demo mode (no real DB connection):
- npx @bytebase/dbhub@latest --transport http --port 8080 --demo
Configuration:
- If you plan to use multiple databases, provide a TOML configuration file (dbhub.toml) as described in the Multi-Database Configuration guide, then start DBHub with the appropriate --toml or --config flag as supported by your setup.
Notes:
- Ensure the DSN (data source name) is correctly formatted for your database type and includes authentication details.
- Open necessary ports in your firewall to access http://<host>:8080.
- Consider enabling SSL/TLS and SSH tunneling for secure remote access.
Additional notes
Tips and common issues:
- If the server fails to start, verify that the DSN is reachable and credentials are correct. Check logs for connection or authentication errors.
- For production, prefer Docker or a properly packaged Node.js deployment to simplify dependency management.
- When using TOML configuration, ensure syntax is valid and that each database connection uses a unique nickname to avoid collisions.
- If you enable read-only mode, write operations will be blocked by design; use this for development or auditing environments.
- Adjust query timeouts and row limits to prevent expensive or long-running queries from impacting other connections.
- If you encounter TLS errors with SSL, verify certificate paths and that the target database accepts TLS connections as configured.
Related MCP Servers
git
Put an end to code hallucinations! GitMCP is a free, open-source, remote MCP server for any GitHub project
unity
Unity MCP acts as a bridge, allowing AI assistants (like Claude, Cursor) to interact directly with your Unity Editor via a local MCP (Model Context Protocol) Client. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.
mcp-telegram
MCP Server for Telegram
memov
Give git-like & traceable memory to OpenClaw and any coding agents. By https://memov.ai/ aka Entire CLI for every coding agents by MCP.
coplay-unity-plugin
Unity plugin for Coplay
prism -rs
Enterprise-grade Rust implementation of Anthropic's MCP protocol