Skip to content

Commit 6cb8eaa

Browse files
authored
Add environment variable for proxy path (#52)
1 parent 19b4e7d commit 6cb8eaa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mcp_clickhouse/mcp_env.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class ClickHouseConfig:
2828
CLICKHOUSE_CONNECT_TIMEOUT: Connection timeout in seconds (default: 30)
2929
CLICKHOUSE_SEND_RECEIVE_TIMEOUT: Send/receive timeout in seconds (default: 300)
3030
CLICKHOUSE_DATABASE: Default database to use (default: None)
31+
CLICKHOUSE_PROXY_PATH: Path to be added to the host URL. For instance, for servers behind an HTTP proxy (default: None)
3132
"""
3233

3334
def __init__(self):
@@ -96,6 +97,10 @@ def send_receive_timeout(self) -> int:
9697
Default: 300 (ClickHouse default)
9798
"""
9899
return int(os.getenv("CLICKHOUSE_SEND_RECEIVE_TIMEOUT", "300"))
100+
101+
@property
102+
def proxy_path(self) -> str:
103+
return os.getenv("CLICKHOUSE_PROXY_PATH")
99104

100105
def get_client_config(self) -> dict:
101106
"""Get the configuration dictionary for clickhouse_connect client.
@@ -118,6 +123,9 @@ def get_client_config(self) -> dict:
118123
# Add optional database if set
119124
if self.database:
120125
config["database"] = self.database
126+
127+
if self.proxy_path:
128+
config["proxy_path"] = self.proxy_path
121129

122130
return config
123131

0 commit comments

Comments
 (0)