feat: optionally read connection settings from clickhouse-client config.yaml - #204
Open
costela wants to merge 1 commit into
Open
feat: optionally read connection settings from clickhouse-client config.yaml#204costela wants to merge 1 commit into
costela wants to merge 1 commit into
Conversation
…ig.yaml Add an opt-in fallback that reads ClickHouse connection settings from a clickhouse-client config.yaml pointed at by CLICKHOUSE_CONFIG_FILE, so users don't have to duplicate auth into CLICKHOUSE_* env vars. Env vars always take precedence; only host/user/password/database/secure are read. The native-TCP port is intentionally ignored since this server uses the HTTP interface. Supports both top-level keys and connections_credentials named profiles (selected via CLICKHOUSE_CONNECTION). The parsed file is cached and re-read when its mtime changes, so edits are picked up without a restart. Closes ClickHouse#203 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
costela
marked this pull request as ready for review
June 18, 2026 08:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #203
Adds an opt-in fallback that reads ClickHouse connection settings from a
clickhouse-clientconfig.yaml, so users who already runclickhouse-clientdon't have to duplicate auth intoCLICKHOUSE_*env vars.Behavior
CLICKHOUSE_CONFIG_FILEpoints at a YAML file. Env vars always take precedence.host,user,password,database, andsecure.portis intentionally ignored —clickhouse-clientports are native TCP (9000/9440), but this server uses the HTTP interface (8123/8443). SetCLICKHOUSE_PORTexplicitly if needed.connections_credentialsnamed profiles, selected viaCLICKHOUSE_CONNECTION.Changes
mcp_clickhouse/mcp_env.py: env-then-file resolution in the config accessors + a_file_settings()loader.pyproject.toml: addpyyamldependency.README.md: document the two new env vars + a "Config file fallback" section.tests/test_client_config_file.py: cover precedence, named connections, port exclusion, mtime invalidation, and error paths.Disclaimer: 🤖 Generated with help from Claude Code