sql-talk
Version:
SQL Talk - 自然言語をSQLに変換するMCPサーバー(安全性保護・SSHトンネル対応) / SQL Talk - MCP Server for Natural Language to SQL conversion with safety guards and SSH tunnel support
120 lines (108 loc) • 3.59 kB
YAML
# SSHトンネル経由でのデータベース接続設定サンプル
# SSH Tunnel Database Connection Configuration Sample
engine: postgres
connections:
read_only:
host: localhost # SSHトンネル経由の場合はlocalhost
port: 5432 # ローカルポート
user: db_ro
password: ${DB_RO_PASSWORD}
database: myapp
ssl: false
ssh_tunnel:
enabled: true
host: ssh-server.example.com # SSHサーバーのホスト名
port: 22 # SSHポート
username: ssh_user # SSHユーザー名
password: ${SSH_PASSWORD} # SSHパスワード(オプション)
# private_key_path: ~/.ssh/id_rsa # 秘密鍵ファイルパス(オプション)
# passphrase: ${SSH_KEY_PASSPHRASE} # 秘密鍵のパスフレーズ(オプション)
remote_host: db-server.example.com # データベースサーバーのホスト名
remote_port: 5432 # データベースサーバーのポート
local_port: 5432 # ローカルポート(省略時は自動割当)
keep_alive: true # 接続を維持するか
retry_attempts: 3 # リトライ回数
retry_delay: 1000 # リトライ間隔(ミリ秒)
ddl_comment:
host: localhost
port: 5433 # 別のローカルポート
user: db_comment
password: ${DB_COMMENT_PASSWORD}
database: myapp
ssl: false
ssh_tunnel:
enabled: true
host: ssh-server.example.com
port: 22
username: ssh_user
private_key_path: ~/.ssh/id_rsa
passphrase: ${SSH_KEY_PASSPHRASE}
remote_host: db-server.example.com
remote_port: 5432
local_port: 5433
keep_alive: true
retry_attempts: 3
retry_delay: 1000
limits:
default_limit: 200
max_limit: 10000
timeout_ms: 5000
max_result_bytes: 16777216 # 16MB
pii:
column_patterns:
- "name|氏名|名前"
- "address|住所|所在地"
- "tel|phone|電話|携帯"
- "dob|birth|生年月日|誕生日"
- "insur|保険|被保険者"
- "email|メール"
- "ssn|社会保障|マイナンバー"
masking:
enabled: true
strategy: partial # partial | hash | redact
schema_cache:
path: ./.cache/schema_cache.json
refresh_on_start: true
comment_infer:
style: concise # concise | verbose
dictionary_paths:
- ./domain_dict/kaigo.yml
- ./domain_dict/common.yml
audit:
sink: file # file | stdout
path: ./logs/audit.ndjson
approval:
provider: file_token # file_token | http_webhook
token_file: ./.secrets/approval.token
# 使用例:
# 1. パスワード認証の場合:
# ssh_tunnel:
# enabled: true
# host: ssh.example.com
# username: myuser
# password: mypassword
# remote_host: db.internal.com
# remote_port: 5432
#
# 2. 秘密鍵認証の場合:
# ssh_tunnel:
# enabled: true
# host: ssh.example.com
# username: myuser
# private_key_path: ~/.ssh/id_rsa
# passphrase: mypassphrase
# remote_host: db.internal.com
# remote_port: 5432
#
# 3. 秘密鍵を直接指定する場合:
# ssh_tunnel:
# enabled: true
# host: ssh.example.com
# username: myuser
# private_key: |
# -----BEGIN OPENSSH PRIVATE KEY-----
# b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
# ...
# -----END OPENSSH PRIVATE KEY-----
# remote_host: db.internal.com
# remote_port: 5432