Overview
TOML configuration enables:- Multi-database support: Connect to multiple databases from a single DBHub instance
- Per-source settings: Configure timeouts, SSL, and SSH tunnels individually per database
- Per-tool settings: Apply different restrictions (readonly, max_rows) per tool
- Custom tools: Define reusable, parameterized SQL operations as MCP tools
Configuration Structure
A TOML configuration file has two main sections:[[sources]]- Database connection definitions[[tools]]- Tool configuration (execution settings, custom tools)
dbhub.toml in your project directory:
dbhub.toml
Source Options
Sources define database connections. Each source represents a database that DBHub can connect to.id
Required. Unique identifier for this data source. Used for routing tool calls and in tool names.
dsn
Required. Database connection string. Same format as command-line
--dsn.- Using DSN
- Individual Parameters
connection_timeout
Connection timeout in seconds. The maximum time to wait when establishing a database connection.Supported databases: PostgreSQL, MySQL, MariaDB, SQL Server (not applicable to SQLite).
This option is only available via TOML. There is no CLI flag for connection timeout.
query_timeout
Query timeout in seconds. The maximum time to wait for a query to complete before timing out.Supported databases: PostgreSQL, MySQL, MariaDB, SQL Server (not applicable to SQLite).
This option is only available via TOML. There is no CLI flag for query timeout.
sslmode
SSL/TLS mode for database connections.Options:
disable- No SSL/TLS encryption. Data is transmitted in plaintext.require- SSL/TLS encryption enabled, but server certificate is not verified.
instanceName
SQL Server named instance. Use when connecting to a specific SQL Server instance (e.g., SQLEXPRESS, ENV1).SQL Server only.
authentication
SQL Server authentication method. SQL Server only.Options:
ntlm- Windows/NTLM authentication. Requiresdomainparameter.azure-active-directory-access-token- Azure AD authentication. Token is fetched automatically using Azure SDK.
domain
Windows domain for NTLM authentication. Required when
authentication=ntlm. SQL Server only.SSH Tunnel Options
SSH tunnel configuration for connecting to databases through bastion/jump hosts. Available fields: See Command-Line Options - SSH Tunnel for complete documentation and examples.
ssh_host, ssh_port, ssh_user, ssh_password, ssh_key, ssh_passphrase, ssh_proxy_jump.Tool Options
Tools define MCP tools (likeexecute_sql) with specific execution settings. Tool options control how tools execute queries, not what databases they connect to.
name
Required. Tool name. Currently, the primary tool is
execute_sql.source
Required. The source ID this tool should use. Must match an
id from the [[sources]] section.readonly
Restrict SQL execution to read-only operations (SELECT, SHOW, DESCRIBE, EXPLAIN, PRAGMA). Write operations like INSERT, UPDATE, DELETE are blocked.See Execute SQL documentation for more details.
This is a tool-level setting, not a source-level setting. Configure it in the
[[tools]] section, not in [[sources]].max_rows
Maximum number of rows to return from SELECT queries. Queries returning more rows will be truncated.See Execute SQL documentation for more details.
This is a tool-level setting, not a source-level setting. Configure it in the
[[tools]] section, not in [[sources]].statement
Optional predefined SQL statement for custom tools. Enables creating reusable, parameterized database operations that are automatically registered as MCP tools.See Custom Tools documentation for examples and patterns.
description
Required for custom tools. Human-readable description of the tool’s purpose. Helps AI models understand when and how to use the tool.
parameters
Parameter definitions for custom tools. Each parameter defines a typed input that will be validated before execution.Parameter Fields:
Parameter Placeholders by Database:
Basic Parameter:Optional Parameter with Default:Constrained Parameter (Enum):Optional Parameter (Nullable):
| Field | Type | Required | Description |
|---|---|---|---|
name | string | ✅ | Parameter name (must match SQL placeholder order) |
type | string | ✅ | Data type: string, integer, float, boolean, array |
description | string | ✅ | Description of the parameter’s purpose |
required | boolean | ❌ | Whether the parameter is required (default: true) |
default | any | ❌ | Default value if parameter not provided |
allowed_values | array | ❌ | List of allowed values (creates enum validation) |
| Database | Syntax | Example |
|---|---|---|
| PostgreSQL | $1, $2, $3 | WHERE id = $1 AND status = $2 |
| MySQL | ?, ?, ? | WHERE id = ? AND status = ? |
| MariaDB | ?, ?, ? | WHERE id = ? AND status = ? |
| SQLite | ?, ?, ? | WHERE id = ? AND status = ? |
| SQL Server | @p1, @p2, @p3 | WHERE id = @p1 AND status = @p2 |
Complete Example
dbhub.toml
Quick Reference
Source Options
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Unique source identifier |
dsn | string | ✅ | Database connection string |
connection_timeout | number | ❌ | Connection timeout (seconds) |
query_timeout | number | ❌ | Query timeout (seconds) |
sslmode | string | ❌ | SSL mode: disable, require |
instanceName | string | ❌ | SQL Server named instance |
authentication | string | ❌ | SQL Server auth method |
domain | string | ❌ | Windows domain (NTLM) |
ssh_host | string | ❌ | SSH server hostname |
ssh_port | number | ❌ | SSH server port (default: 22) |
ssh_user | string | ❌ | SSH username |
ssh_password | string | ❌ | SSH password |
ssh_key | string | ❌ | SSH private key path |
ssh_passphrase | string | ❌ | SSH key passphrase |
ssh_proxy_jump | string | ❌ | ProxyJump hosts |
Tool Options
| Field | Type | Required | Description |
|---|---|---|---|
name | string | ✅ | Tool name (e.g., execute_sql) |
source | string | ✅ | Source ID to use |
description | string | ✅* | Tool description (*required for custom tools) |
statement | string | ❌ | Predefined SQL for custom tools |
parameters | array | ❌ | Parameter definitions for custom tools |
readonly | boolean | ❌ | Read-only mode (default: false) |
max_rows | number | ❌ | Max rows limit (default: unlimited) |