Universal database MCP server supporting mainstream databases.
DBHub is a versatile database gateway meticulously engineered to implement the Model Context Protocol (MCP) server interface. This strategic implementation empowers MCP-compatible clients with the ability to seamlessly connect to and explore a diverse range of databases, unlocking new possibilities for AI-driven data interaction.
+------------------+ +--------------+ +------------------+ | | | | | | | | | | | | | Claude Desktop +--->+ +--->+ PostgreSQL | | | | | | | | Cursor +--->+ DBHub +--->+ SQL Server | | | | | | | | Other MCP +--->+ +--->+ SQLite | | Clients | | | | | | | | +--->+ MySQL | | | | | | | | | | +--->+ MariaDB | | | | | | | +------------------+ +--------------+ +------------------+ MCP Clients MCP Server Databases
Experience DBHub in action through our live demo SSE endpoint: https://demo.dbhub.ai/sse. This endpoint is pre-configured with a sample employee database, allowing you to immediately test its capabilities with tools like Cursor or the MCP Inspector.
DBHub boasts an extensive support matrix, ensuring compatibility and feature parity across various database systems.
Resource Name | URI Format | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
schemas | db://schemas | ✅ | ✅ | ✅ | ✅ | ✅ |
tables_in_schema | db://schemas/{schemaName}/tables | ✅ | ✅ | ✅ | ✅ | ✅ |
table_structure_in_schema | db://schemas/{schemaName}/tables/{tableName} | ✅ | ✅ | ✅ | ✅ | ✅ |
indexes_in_table | db://schemas/{schemaName}/tables/{tableName}/indexes | ✅ | ✅ | ✅ | ✅ | ✅ |
procedures_in_schema | db://schemas/{schemaName}/procedures | ✅ | ✅ | ✅ | ✅ | ❌ |
procedure_details_in_schema | db://schemas/{schemaName}/procedures/{procedureName} | ✅ | ✅ | ✅ | ✅ | ❌ |
Tool | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
Execute Query | run_query | ✅ | ✅ | ✅ | ✅ | ✅ |
List Connectors | list_connectors | ✅ | ✅ | ✅ | ✅ | ✅ |
Prompt | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
Generate SQL | generate_sql | ✅ | ✅ | ✅ | ✅ | ✅ |
Explain DB Elements | explain_db | ✅ | ✅ | ✅ | ✅ | ✅ |
DBHub offers flexible installation options to suit your environment.
Leverage Docker for containerized deployment:
# PostgreSQL example docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# Demo mode with sample employee database docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --demo
Install and run DBHub using NPM:
# PostgreSQL example npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
# Demo mode with sample employee database npx @bytebase/dbhub --transport sse --port 8080 --demo
Note: The demo mode includes a pre-configured SQLite database named "employee" containing tables for employees, departments, salaries, and more.
stdio
transport (see discussion).// claude_desktop_config.json { "mcpServers": { "dbhub-postgres-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "bytebase/dbhub", "--transport", "stdio", "--dsn", // Use host.docker.internal as the host if connecting to the local db "postgres://user:[email protected]:5432/dbname?sslmode=disable" ] }, "dbhub-postgres-npx": { "command": "npx", "args": [ "-y", "@bytebase/dbhub", "--transport", "stdio", "--dsn", "postgres://user:password@localhost:5432/dbname?sslmode=disable" ] }, "dbhub-demo": { "command": "npx", "args": ["-y", "@bytebase/dbhub", "--transport", "stdio", "--demo"] } } }
stdio
and sse
transports.DBHub can be launched in demo mode with a sample employee database for initial exploration:
npx @bytebase/dbhub --demo
For connecting to real databases, a Database Source Name (DSN) is mandatory. The DSN can be provided via:
Command line argument (highest precedence):
npx @bytebase/dbhub --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
Environment variable (medium precedence):
export DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @bytebase/dbhub
Environment file (lowest precedence):
.env.local
with your DSN.env
with your DSNDSN=postgres://user:password@localhost:5432/dbname?sslmode=disable
Warning: When running DBHub within Docker, use
host.docker.internal
instead oflocalhost
to connect to databases running on your host machine. Example:mysql://user:[email protected]:3306/dbname
DBHub supports the following database connection string formats:
Database | DSN Format | Example |
---|---|---|
MySQL | mysql://[user]:[password]@[host]:[port]/[database] | mysql://user:password@localhost:3306/dbname |
MariaDB | mariadb://[user]:[password]@[host]:[port]/[database] | mariadb://user:password@localhost:3306/dbname |
PostgreSQL | postgres://[user]:[password]@[host]:[port]/[database] | postgres://user:password@localhost:5432/dbname?sslmode=disable |
SQL Server | sqlserver://[user]:[password]@[host]:[port]/[database] | sqlserver://user:password@localhost:1433/dbname |
SQLite | sqlite:///[path/to/file] or sqlite::memory: | sqlite:///path/to/database.db , sqlite:C:/Users/YourName/data/database.db (windows) or sqlite::memory: |
Extra query parameters:
authentication=azure-active-directory-access-token
. Only applicable when running from Azure. See DefaultAzureCredential.stdio (default): Ideal for direct integration with tools like Claude Desktop.
npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
sse: Suited for browser-based and network clients.
npx @bytebase/dbhub --transport sse --port 5678 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
Option | Description | Default |
---|---|---|
demo | Run in demo mode with sample employee database | false |
dsn | Database connection string | Required if not in demo mode |
transport | Transport mode: stdio or sse | stdio |
port | HTTP server port (only applicable when using --transport=sse ) | 8080 |
The demo mode utilizes an in-memory SQLite database pre-loaded with the sample employee database, featuring tables for employees, departments, titles, salaries, department employees, and department managers. The sample database includes SQL scripts for table creation, data loading, and testing.
Install dependencies:
pnpm install
Run in development mode:
pnpm dev
Build for production:
pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# PostgreSQL example TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js
# Start DBHub with SSE transport pnpm dev --transport=sse --port=8080 # Start the MCP Inspector in another terminal npx @modelcontextprotocol/inspector
Connect to the DBHub server /sse
endpoint.
🐍 ☁️ Biomedical research server providing access to PubMed, ClinicalTrials.gov, and MyVariant.info.
🐍 MCP server that provides SQL analysis, linting, and dialect conversion using [SQLGlot](https://github.com/tobymao/sqlglot)
🐍 🏠 All-in-one MCP server for Postgres development and operations, with tools for performance analysis, tuning, and health checks
Supabase MCP Server with support for SQL query execution and database exploration tools