Database Connection
dsn
Database connection string (Data Source Name). Format: SSL/TLS Options
database_type://username:password@host:port/database_name?options- PostgreSQL
- MySQL
- MariaDB
- SQL Server
- SQLite
| Database | sslmode=disable | sslmode=require | Default |
|---|---|---|---|
| PostgreSQL | ✅ | ✅ | Certificate verification |
| MySQL | ✅ | ✅ | Certificate verification |
| MariaDB | ✅ | ✅ | Certificate verification |
| SQL Server | ✅ | ✅ | Certificate verification |
| SQLite | ❌ | ❌ | N/A (file-based) |
sslmode=disable: All SSL/TLS encryption is turned off. Data is transmitted in plaintext.sslmode=require: Connection is encrypted, but the server’s certificate is not verified.
Environment Variables
Recommended for databases with complex passwords containing special characters:Database type:
postgres, mysql, mariadb, sqlserver, sqliteDatabase server hostname (not needed for SQLite)
Database server port. Default: PostgreSQL (
5432), MySQL/MariaDB (3306), SQL Server (1433)Database username (not needed for SQLite)
Database password (not needed for SQLite). Supports special characters without URL encoding.
Database name or SQLite file path
Execution Controls
readonly
Restrict SQL execution to read-only operations.See Read-Only Mode for details on allowed operations.
max-rows
Limit the number of rows returned from SELECT queries.See Row Limiting for details on how limits are applied.
General
transport
Transport protocol for MCP communication.Options:
stdio- For desktop tools (Claude Desktop, Claude Code, Cursor with stdio config)http- For browser and network clients, streamable HTTP transport
port
HTTP server port. Only applicable when using
--transport=http.id
Instance identifier to suffix tool names. Useful when running multiple DBHub instances (e.g., in Cursor).Tools will be named Result:
execute_sql_{id} for each instance.execute_sql_prod and execute_sql_staging toolsconfig
Path to TOML configuration file for managing multiple database connections.Automatically loads See Multi-Database Setup for TOML configuration details.
./dbhub.toml if it exists in the current directory.demo
Run DBHub with a bundled SQLite sample “employee” database for testing.The demo database includes tables for employees, departments, salaries, titles, and more.
SSH Tunnel
ssh-host
SSH server hostname for tunnel connection. Can also use SSH config host aliases from See SSH Tunnel for detailed SSH configuration examples.
~/.ssh/config.ssh-port
SSH server port.
ssh-user
SSH username.
ssh-password
SSH password for password authentication.
ssh-key
Path to SSH private key file for key-based authentication.DBHub automatically tries common default locations (
~/.ssh/id_rsa, ~/.ssh/id_ed25519, etc.) if not specified.ssh-passphrase
Passphrase for encrypted SSH private key.
Configuration Priority
DBHub follows this priority order for configuration:- Command-line arguments (highest priority)
- TOML config file (if
--configis provided or./dbhub.tomlexists) - Environment variables
.envfiles (.env.localin development,.envin production)
--config (TOML) and --dsn (CLI) are mutually exclusive. If --config is provided, TOML configuration takes precedence. You cannot combine --dsn with TOML configuration.Quick Reference
| CLI Option | Env | Type | Default | Description |
|---|---|---|---|---|
--dsn | DSN | string | Required* | Database connection string |
| - | DB_TYPE | string | - | Database type: postgres, mysql, mariadb, sqlserver, sqlite |
| - | DB_HOST | string | - | Database hostname |
| - | DB_PORT | number | Varies | Database port |
| - | DB_USER | string | - | Database username |
| - | DB_PASSWORD | string | - | Database password |
| - | DB_NAME | string | - | Database name or SQLite file path |
--transport | TRANSPORT | string | stdio | Transport mode: stdio or http |
--port | PORT | number | 8080 | HTTP server port |
--readonly | READONLY | boolean | false | Restrict to read-only operations |
--max-rows | MAX_ROWS | number | - | Limit SELECT query results |
--demo | - | boolean | false | Use sample employee database |
--id | ID | string | - | Instance identifier for tool names |
--config | - | string | ./dbhub.toml | Path to TOML config file |
--ssh-host | SSH_HOST | string | - | SSH server hostname |
--ssh-port | SSH_PORT | number | 22 | SSH server port |
--ssh-user | SSH_USER | string | - | SSH username |
--ssh-password | SSH_PASSWORD | string | - | SSH password |
--ssh-key | SSH_KEY | string | - | Path to SSH private key |
--ssh-passphrase | SSH_PASSPHRASE | string | - | SSH key passphrase |
*Required unless using
--demo or --config