Skip to main content
DBHub can be installed and run in multiple ways depending on your environment and preferences.

Installation methods

The easiest way to run DBHub is using the official Docker image:
docker run --rm --init \
  --name dbhub \
  --publish 8080:8080 \
  bytebase/dbhub \
  --transport http \
  --port 8080 \
  --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
The --init flag ensures proper signal handling for graceful shutdowns.

With TOML configuration

For multi-database setups, mount your dbhub.toml configuration file:
docker run --rm --init \
  --name dbhub \
  --publish 8080:8080 \
  --volume $(pwd)/dbhub.toml:/app/dbhub.toml \
  bytebase/dbhub \
  --transport http \
  --port 8080 \
  --config /app/dbhub.toml

Demo mode

Try DBHub with a bundled SQLite employee database:
docker run --rm --init \
  --name dbhub \
  --publish 8080:8080 \
  bytebase/dbhub \
  --transport http \
  --port 8080 \
  --demo

Configure MCP clients

Once DBHub is installed, configure your MCP client to connect to it.
Add DBHub to your Claude Desktop configuration file:
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "@bytebase/dbhub@latest",
        "--dsn",
        "postgres://user:password@localhost:5432/dbname?sslmode=disable"
      ]
    }
  }
}
Claude Desktop uses stdio transport by default. Do not specify --transport http in the configuration.

With TOML configuration

{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "@bytebase/dbhub@latest",
        "--config",
        "/path/to/dbhub.toml"
      ]
    }
  }
}

With demo mode

{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "@bytebase/dbhub@latest",
        "--demo"
      ]
    }
  }
}

DSN formats

DBHub supports standard connection string formats for all databases:
postgres://user:password@localhost:5432/dbname?sslmode=disable
postgres://user:password@localhost:5432/dbname?sslmode=require
If your password contains special characters like @, :, /, or #, use environment variables or TOML configuration with individual parameters instead of a DSN string.

SSL modes

  • sslmode=disable: No SSL encryption (default)
  • sslmode=require: SSL encryption without certificate verification
For production databases, always use sslmode=require to encrypt your connection.

Command-line options

DBHub accepts the following command-line arguments:
OptionDescriptionDefault
--dsnDatabase connection string-
--transportTransport protocol: stdio or httpstdio
--portHTTP server port8080
--configPath to TOML configuration file./dbhub.toml
--demoUse bundled SQLite employee databasefalse
--readonlyRestrict to read-only operations (deprecated, use TOML)false
--max-rowsLimit rows returned from SELECT (deprecated, use TOML)unlimited
--ssh-hostSSH tunnel hostname-
--ssh-portSSH tunnel port22
--ssh-userSSH tunnel username-
--ssh-passwordSSH tunnel password-
--ssh-keyPath to SSH private key-
--ssh-passphraseSSH key passphrase-
Command-line arguments have the highest priority and will override environment variables and TOML configuration.

Environment variables

Alternatively, configure DBHub using environment variables:
.env
# Connection string
DSN=postgres://user:password@localhost:5432/dbname

# Or individual parameters
DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=my@password:with/special#chars
DB_NAME=mydatabase

# Transport and port
TRANSPORT=stdio
PORT=8080

# SSH tunnel (optional)
SSH_HOST=bastion.example.com
SSH_PORT=22
SSH_USER=ubuntu
SSH_KEY=~/.ssh/id_rsa
Supported DB_TYPE values: postgres, mysql, mariadb, sqlserver, sqlite

Verify installation

After installation, verify DBHub is working:
1

Start DBHub in HTTP mode

npx @bytebase/dbhub@latest --transport http --port 8080 --demo
2

Open the workbench

Navigate to http://localhost:8080 in your browser.
3

Test a query

Use the execute_sql tool to run a simple query:
SELECT * FROM employee LIMIT 5;
If you see query results, DBHub is installed correctly!

Troubleshooting

  • Verify your database is running and accessible
  • Check that the hostname, port, and credentials are correct
  • For remote databases, ensure firewall rules allow connections
  • Try connecting with a database client (psql, mysql, etc.) using the same credentials
  • For development, use ?sslmode=disable in your DSN
  • For production, ensure SSL certificates are properly configured
  • Some cloud providers (AWS RDS, Azure) require sslmode=require
If your password contains @, :, /, or #, use environment variables with individual parameters:
DB_TYPE=postgres
DB_HOST=localhost
DB_PORT=5432
DB_USER=myuser
DB_PASSWORD=my@complex:password/123
DB_NAME=mydb
  • Restart your MCP client after updating the configuration
  • Check that the DBHub process is running (look for the dbhub process)
  • Verify the configuration file path is correct
  • Check MCP client logs for connection errors
  • Ensure the SQLite file path is absolute, not relative
  • Check file permissions allow read/write access
  • For demo mode, no file path is needed (uses in-memory database)

Next steps

Quick start

Execute your first SQL query in minutes

Multi-database setup

Configure multiple database connections with TOML

SSH tunnels

Connect securely through bastion hosts

Command-line options

Full reference of all CLI arguments

Build docs developers (and LLMs) love