# ============================================================================
# HybridHub Multi-Source Configuration Example
# ============================================================================
# Save this file as 'hybridhub.toml' in your project directory
# Or use '--config=path/to/your/config.toml' to specify a custom location
# ============================================================================
# Database Sources (Structured Data) - [[databases]]
# ============================================================================
# Define multiple database sources using [[databases]] array syntax
# Each source requires a unique 'id' field for identification
## Example 1: PostgreSQL with DSN (recommended)
[[databases]]
id = "prod_pg" # Required: Unique identifier
dsn = "postgres://user:password@localhost:5432/production?sslmode=require"
readonly = false # Optional: Limit to read-only operations (default: false)
max_rows = 1000 # Optional: Maximum rows to return per query
## Example 2: MySQL with individual parameters
[[databases]]
id = "staging_mysql"
type = "mysql"
host = "localhost"
port = 3306
database = "staging"
user = "root"
password = "secret"
max_rows = 500
## Example 3: MariaDB with SSH tunnel
[[databases]]
id = "remote_mariadb"
dsn = "mariadb://dbuser:dbpass@10.0.0.5:3306/mydb"
ssh_host = "bastion.example.com"
ssh_port = 22
ssh_user = "ubuntu"
ssh_key = "~/.ssh/id_rsa"
## Example 4: SQL Server with timeouts
[[databases]]
id = "analytics_sqlserver"
type = "sqlserver"
host = "sqlserver.example.com"
port = 1433
database = "analytics"
user = "sa"
password = "YourStrong@Passw0rd"
max_rows = 2000
connection_timeout = 30
request_timeout = 120
## Example 5: SQLite local file
[[databases]]
id = "local_sqlite"
type = "sqlite"
database = "/path/to/database.db"
readonly = true
# ============================================================================
# Storage Sources (Unstructured Data) - [[storages]]
# ============================================================================
# Define multiple object storage sources using [[storages]] array syntax
# Supported types: obs, oss, s3, cos, minio
## Example 1: Huawei Cloud OBS
[[storages]]
id = "huawei_obs" # Required: Unique identifier
type = "obs" # Required: Provider type
endpoint = "https://obs.cn-east-2.myhuaweicloud.com"
access_key = "your-access-key-id"
secret_key = "your-secret-access-key"
region = "cn-east-2"
default_bucket = "my-bucket"
connection_timeout = 60
ssl = true
## Example 2: Alibaba Cloud OSS
[[storages]]
id = "aliyun_oss"
type = "oss"
endpoint = "https://oss-cn-hangzhou.aliyuncs.com"
access_key = "your-access-key-id"
secret_key = "your-secret-access-key"
region = "cn-hangzhou"
## Example 3: AWS S3
[[storages]]
id = "aws_s3"
type = "s3"
endpoint = "https://s3.amazonaws.com"
access_key = "AKIAIOSFODNN7EXAMPLE"
secret_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
region = "us-east-1"
path_style = false
## Example 4: MinIO (S3-Compatible)
[[storages]]
id = "local_minio"
type = "s3"
endpoint = "http://localhost:9000"
access_key = "minioadmin"
secret_key = "minioadmin"
path_style = true # Required for MinIO
# ============================================================================
# Database Custom Tools - [[database_tools]]
# ============================================================================
# Define custom SQL-based tools that are automatically registered as MCP tools
## Example 1: Simple query with single parameter
[[database_tools]]
name = "get_user_by_email"
description = "Retrieve user details by email address"
source = "prod_pg" # Must reference a valid database source ID
statement = "SELECT id, name, email, created_at FROM users WHERE email = $1"
[[database_tools.parameters]]
name = "email"
type = "string"
description = "The email address to search for"
required = true
## Example 2: Query with multiple parameters
[[database_tools]]
name = "search_orders"
description = "Search orders by customer ID and optional status filter"
source = "prod_pg"
statement = "SELECT * FROM orders WHERE customer_id = $1 AND ($2::text IS NULL OR status = $2)"
[[database_tools.parameters]]
name = "customer_id"
type = "integer"
description = "The customer ID to search orders for"
required = true
[[database_tools.parameters]]
name = "status"
type = "string"
description = "Optional order status filter"
required = false
allowed_values = ["pending", "completed", "cancelled"]
# ============================================================================
# Storage Custom Tools - [[storage_tools]]
# ============================================================================
# Configure built-in storage tools or define custom storage operations
## Example 1: Limit list_objects results
[[storage_tools]]
name = "list_objects"
source = "huawei_obs"
max_keys = 500
## Example 2: Limit get_object size
[[storage_tools]]
name = "get_object"
source = "huawei_obs"
max_size = 5242880 # 5MB
## Example 3: Limit search results
[[storage_tools]]
name = "search_objects"
source = "aliyun_oss"
max_results = 50
# ============================================================================
# Configuration Reference
# ============================================================================
# DATABASE SOURCE FIELDS:
# -----------------------
# REQUIRED:
# - id: Unique identifier (string)
# - One of:
# * dsn: Connection string (e.g., "postgres://user:pass@host:port/db")
# * type + connection params (type, host, port, database, user, password)
#
# OPTIONAL:
# - readonly: Limit to read-only operations (default: false)
# - max_rows: Maximum rows per query (default: unlimited)
# - connection_timeout: Connection timeout in seconds
# - request_timeout: Query timeout in seconds (SQL Server only)
# - instanceName: SQL Server named instance
#
# SSH TUNNEL (optional):
# - ssh_host, ssh_port, ssh_user
# - ssh_password OR ssh_key (+ ssh_passphrase)
# STORAGE SOURCE FIELDS:
# ----------------------
# REQUIRED:
# - id: Unique identifier (string)
# - type: Provider type (obs, oss, s3, cos, minio)
# - endpoint: Service endpoint URL
# - access_key: Access Key ID
# - secret_key: Secret Access Key
#
# OPTIONAL:
# - region: Region identifier
# - default_bucket: Default bucket name
# - connection_timeout: Timeout in seconds (default: 60)
# - security_token: STS token for temporary credentials
# - ssl: Enable SSL/TLS (default: true)
# - path_style: Use path-style URLs (required for MinIO)
# SUPPORTED PROVIDERS:
# --------------------
# Databases: postgres, mysql, mariadb, sqlserver, sqlite
# Storages: obs (Huawei), oss (Aliyun), s3 (AWS/S3-compatible), cos (Tencent)
# DEFAULT PORTS:
# --------------
# PostgreSQL: 5432
# MySQL/MariaDB: 3306
# SQL Server: 1433
# SQLite: N/A (file-based)
# USAGE NOTES:
# ------------
# 1. The first source in each section is the default
# 2. Source IDs must be unique across ALL sources (databases + storages)
# 3. Tools reference sources by their ID
# 4. Paths starting with ~/ are expanded to home directory
# 5. For security, consider using environment variables for sensitive data