-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(tools/Clickhouse): configurable connection pool settings #2244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ankurg03
wants to merge
9
commits into
googleapis:main
Choose a base branch
from
ankurg03:clickhouse_config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
191d538
updated clickhouse config
ankurg03 a93ff4b
updated clickhouse config
ankurg03 8b3f240
chore(deps): update github actions (major) (#1905)
renovate-bot a8abcb7
chore(deps): bump golang.org/x/crypto from 0.43.0 to 0.45.0 in /docs/…
dependabot[bot] 32ba5df
chore(deps): update github actions (#2096)
renovate-bot 7a284fb
docs(clickhouse): add configurable connection pool settings
ankurg03 8afc0fc
feat(clickhouse): add validation for connection pool settings
ankurg03 955bb87
refactor(clickhouse): simplify initClickHouseConnectionPool to accept…
ankurg03 92935ad
Merge branch 'main' into clickhouse_config
ankurg03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # ClickHouse MCP Server | ||
|
|
||
| The ClickHouse Model Context Protocol (MCP) Server enables AI-powered development tools to seamlessly connect, interact, and generate data insights with your ClickHouse databases using natural language commands. | ||
|
|
||
| ## Features | ||
|
|
||
| An editor configured to use the ClickHouse MCP server can use its AI capabilities to help you: | ||
|
|
||
| - **Natural Language to Data Analytics:** Easily find required ClickHouse tables and ask analytical questions in plain English. | ||
| - **Seamless Workflow:** Stay within your CLI, eliminating the need to constantly switch to the ClickHouse console for generating analytical insights. | ||
| - **Execute SQL Queries:** Run parameterized SQL queries and prepared statements against your ClickHouse databases. | ||
|
|
||
|
|
||
| ## Server Capabilities | ||
|
|
||
| The ClickHouse MCP server provides the following tools: | ||
|
|
||
| | Tool Name | Description | | ||
| |:-----------------------|:----------------------------------------------------------------| | ||
| | `execute_sql` | Executes a SQL query against ClickHouse. | | ||
| | `list_databases` | Lists all databases in the ClickHouse instance. | | ||
| | `list_tables` | Lists all tables in a specific ClickHouse database. | | ||
|
|
||
| ## Custom MCP Server Configuration | ||
|
|
||
| The ClickHouse MCP server is configured using environment variables. | ||
|
|
||
| ```bash | ||
| export CLICKHOUSE_HOST="<your-clickhouse-host>" | ||
| export CLICKHOUSE_PORT="<your-clickhouse-port>" # e.g., "8123" for HTTP, "9000" for native | ||
| export CLICKHOUSE_USER="<your-clickhouse-user>" | ||
| export CLICKHOUSE_PASSWORD="<your-clickhouse-password>" | ||
| export CLICKHOUSE_DATABASE="<your-database-name>" | ||
| export CLICKHOUSE_PROTOCOL="https" # Optional: "http" or "https" (default: "https") | ||
| ``` | ||
|
|
||
| Add the following configuration to your MCP client (e.g., `settings.json` for Gemini CLI, `mcp_config.json` for Antigravity): | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "clickhouse": { | ||
| "command": "npx", | ||
| "args": ["-y", "@toolbox-sdk/server", "--prebuilt", "clickhouse", "--stdio"], | ||
| "env": { | ||
| "CLICKHOUSE_HOST": "<your-clickhouse-host>", | ||
| "CLICKHOUSE_PORT": "<your-clickhouse-port>", | ||
| "CLICKHOUSE_USER": "<your-clickhouse-user>", | ||
| "CLICKHOUSE_PASSWORD": "<your-clickhouse-password>", | ||
| "CLICKHOUSE_DATABASE": "<your-database-name>", | ||
| "CLICKHOUSE_PROTOCOL": "https" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Advanced Configuration | ||
|
|
||
| You can also configure connection pool settings in your `tools.yaml` file: | ||
|
|
||
|
|
||
| ```yaml | ||
| sources: | ||
| my-clickhouse-source: | ||
| kind: clickhouse | ||
| host: ${CLICKHOUSE_HOST} | ||
| port: ${CLICKHOUSE_PORT} | ||
| database: ${CLICKHOUSE_DATABASE} | ||
| user: ${CLICKHOUSE_USER} | ||
| password: ${CLICKHOUSE_PASSWORD} | ||
| protocol: https # Optional: http or https (default: https) | ||
| secure: true # Optional: boolean (default: false) | ||
| # Optional connection pool settings | ||
| maxOpenConns: 50 # Optional: Maximum number of open connections (default: 25) | ||
| maxIdleConns: 10 # Optional: Maximum number of idle connections (default: 5) | ||
| connMaxLifetime: 10m # Optional: Maximum connection lifetime (default: 5m) | ||
| # Accepts duration strings like "30s", "5m", "1h", etc. | ||
| ``` |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file might not be necessary. It was created for use with GeminiCLI or Antigravity.