Skip to content

Commit 21e6cb2

Browse files
switch os truststore libraries (#91)
* switch os truststore libraries * Update README.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 9f91105 commit 21e6cb2

File tree

5 files changed

+538
-426
lines changed

5 files changed

+538
-426
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ The following environment variables are used to configure the ClickHouse and chD
295295
* `CLICKHOUSE_VERIFY`: Enable/disable SSL certificate verification
296296
* Default: `"true"`
297297
* Set to `"false"` to disable certificate verification (not recommended for production)
298+
* TLS certificates: The package uses your operating system trust store for TLS certificate verification via `truststore`. We call `truststore.inject_into_ssl()` at startup to ensure proper certificate handling. Python’s default SSL behavior is used as a fallback only if an unexpected error occurs.
298299
* `CLICKHOUSE_CONNECT_TIMEOUT`: Connection timeout in seconds
299300
* Default: `"30"`
300301
* Increase this value if you experience connection timeouts

fastmcp.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"dependencies": [
99
"clickhouse-connect",
1010
"python-dotenv",
11-
"pip-system-certs",
11+
"truststore",
1212
"chdb"
1313
]
1414
}
1515
}
16-

mcp_clickhouse/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from .mcp_server import (
24
create_clickhouse_client,
35
list_databases,
@@ -8,6 +10,14 @@
810
chdb_initial_prompt,
911
)
1012

13+
14+
if os.getenv("MCP_CLICKHOUSE_TRUSTSTORE_DISABLE", None) != "1":
15+
try:
16+
import truststore
17+
truststore.inject_into_ssl()
18+
except Exception:
19+
pass
20+
1121
__all__ = [
1222
"list_databases",
1323
"list_tables",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies = [
1010
"fastmcp>=2.0.0",
1111
"python-dotenv>=1.0.1",
1212
"clickhouse-connect>=0.8.16",
13-
"pip-system-certs>=4.0",
13+
"truststore>=0.10",
1414
"chdb>=3.3.0",
1515
]
1616

0 commit comments

Comments
 (0)