Execute SQL queries against the connected database
List available database connectors and their status
Generate SQL queries based on natural language descriptions
Explain database elements and structures
DBHub is a universal database gateway that implements the Model Context Protocol (MCP) server interface. It enables MCP-compatible clients like Claude Desktop and Cursor to connect to and explore different database systems including PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, and Oracle. This gateway allows AI assistants to directly query databases, explore schema information, and execute SQL commands.
DBHub serves as a bridge between MCP-compatible clients and various database systems. It allows AI assistants to interact with databases directly, providing capabilities for schema exploration, SQL execution, and database structure analysis.
The easiest way to run DBHub is using Docker:
# Basic example for PostgreSQL
docker run --rm --init \
--name dbhub \
--publish 8080:8080 \
bytebase/dbhub \
--transport sse \
--database-url "postgresql://username:password@host:port/database"
For other database types, use the appropriate connection string format:
mysql://username:password@host:port/database
sqlserver://username:password@host:port/database
sqlite:///path/to/database.db
oracle://username:password@host:port/service
Clone the repository:
git clone https://github.com/bytebase/dbhub.git
cd dbhub
Install dependencies:
npm install
# or
pnpm install
Create a .env
file based on the example:
cp .env.example .env
# Edit the .env file with your database connection details
Start the server:
npm start
# or
pnpm start
DBHub supports several configuration options:
--port
: Port to listen on (default: 8080)--host
: Host to bind to (default: 0.0.0.0)--transport
: Transport protocol (sse or websocket, default: sse)--database-url
: Database connection string--database-type
: Database type (postgresql, mysql, mariadb, sqlserver, sqlite, oracle)--debug
: Enable debug loggingOnce DBHub is running, you can connect to it from any MCP-compatible client:
The default endpoint will be: http://localhost:8080/sse
for SSE transport or ws://localhost:8080/ws
for WebSocket transport.
For testing purposes, you can use the demo endpoint at https://demo.dbhub.ai/sse
which connects to a sample employee database.