DBHub

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides Docker container deployment options for running the DBHub server with configurable database connections and transport options.

  • Supports connecting to DuckDB databases to explore tables, access schema information, and perform read-only SQL queries with safety measures.

  • Provides access to MySQL databases for browsing tables, viewing schema information, and executing read-only SQL queries with safety protections.

DBHub is a universal database gateway implementing the Model Context Protocol (MCP) server interface. This gateway allows MCP-compatible clients to connect to and explore different databases.

+------------------+ +--------------+ +------------------+ | | | | | | | | | | | | | Claude Desktop +--->+ +--->+ PostgreSQL | | | | | | | | Cursor +--->+ DBHub +--->+ SQL Server | | | | | | | | Other MCP +--->+ +--->+ SQLite | | Clients | | | | | | | | +--->+ MySQL | | | | | | | | | | +--->+ Other Databases | | | | | | | +------------------+ +--------------+ +------------------+ MCP Clients MCP Server Databases

Supported Matrix

Database Resources

ResourceURI FormatPostgreSQLMySQLSQL ServerSQLite
Tablesdb://tables
Schemadb://schema/{tableName}

Database Tools

ToolCommand NamePostgreSQLMySQLSQL ServerSQLite
Execute Queryrun_query
List Connectorslist_connectors

Prompt Capabilities

PromptCommand NamePostgreSQLMySQLSQL ServerSQLite
Generate SQLgenerate_sql
Explain DB Elementsexplain_db

Installation

Docker

# 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

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

Claude Desktop

// 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:password@host.docker.internal: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" ] } } }

Cursor

Usage

Configure your database connection

You can use DBHub in demo mode with a sample employee database for testing:

pnpm dev --demo

For real databases, a Database Source Name (DSN) is required. You can provide this in several ways:

  • Command line argument (highest priority):
    pnpm dev --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • Environment variable (second priority):
    export DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" pnpm dev
  • Environment file (third priority):
    • For development: Create .env.local with your DSN
    • For production: Create .env with your DSN
    DSN=postgres://user:password@localhost:5432/dbname?sslmode=disable

DBHub supports the following database connection string formats:

DatabaseDSN FormatExample
PostgreSQLpostgres://[user]:[password]@[host]:[port]/[database]postgres://user:password@localhost:5432/dbname?sslmode=disable
SQLitesqlite:///[path/to/file] or sqlite::memory:sqlite:///path/to/database.db or sqlite::memory:
SQL Serversqlserver://[user]:[password]@[host]:[port]/[database]sqlserver://user:password@localhost:1433/dbname
MySQLmysql://[user]:[password]@[host]:[port]/[database]mysql://user:password@localhost:3306/dbname

Transport

  • stdio (default) - for direct integration with tools like Claude Desktop:
    npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • sse - for browser and network clients:
    npx @bytebase/dbhub --transport sse --port 5678 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

Command line options

OptionDescriptionDefault
demoRun in demo mode with sample employee databasefalse
dsnDatabase connection stringRequired if not in demo mode
transportTransport mode: stdio or ssestdio
portHTTP server port (only applicable when using --transport=sse)8080

Development

  1. Install dependencies:
    pnpm install
  2. Run in development mode:
    pnpm dev
  3. Build for production:
    pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

Debug with MCP Inspector

stdio

# PostgreSQL example TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js

SSE

# 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

-
security - not tested
A
license - permissive license
-
quality - not tested

Universal database MCP server connecting to MySQL, PostgreSQL, SQLite, DuckDB and etc.

  1. Database Resources
    1. Database Tools
      1. Prompt Capabilities
        1. Installation
          1. Docker
            1. NPM
              1. Claude Desktop
                1. Cursor
                2. Usage
                  1. Configure your database connection
                    1. Transport
                      1. Command line options
                      2. Development
                        1. Debug with MCP Inspector
                          1. stdio
                            1. SSE