Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mcp_clickhouse/mcp_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ClickHouseConfig:
CLICKHOUSE_CONNECT_TIMEOUT: Connection timeout in seconds (default: 30)
CLICKHOUSE_SEND_RECEIVE_TIMEOUT: Send/receive timeout in seconds (default: 300)
CLICKHOUSE_DATABASE: Default database to use (default: None)
CLICKHOUSE_PROXY_PATH: Path to be added to the host URL. For instance, for servers behind an HTTP proxy (default: None)
"""

def __init__(self):
Expand Down Expand Up @@ -96,6 +97,10 @@ def send_receive_timeout(self) -> int:
Default: 300 (ClickHouse default)
"""
return int(os.getenv("CLICKHOUSE_SEND_RECEIVE_TIMEOUT", "300"))

@property
def proxy_path(self) -> str:
return os.getenv("CLICKHOUSE_PROXY_PATH")

def get_client_config(self) -> dict:
"""Get the configuration dictionary for clickhouse_connect client.
Expand All @@ -118,6 +123,9 @@ def get_client_config(self) -> dict:
# Add optional database if set
if self.database:
config["database"] = self.database

if self.proxy_path:
config["proxy_path"] = self.proxy_path

return config

Expand Down