mcp-hydrolix 0.1.1__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  [*]
2
2
  trim_trailing_whitespace = true
3
- end_of_line = lf
3
+ end_of_line = lf
@@ -168,7 +168,7 @@ cython_debug/
168
168
  # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
169
169
  # and can be added to the global gitignore or merged into this file. For a more nuclear
170
170
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
171
- #.idea/
171
+ .idea/
172
172
 
173
173
  # PyPI configuration file
174
174
  .pypirc
@@ -0,0 +1,20 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: end-of-file-fixer
6
+ - id: trailing-whitespace
7
+ args: [--markdown-linebreak-ext=md]
8
+ - id: check-yaml
9
+ - id: check-json
10
+ - id: check-toml
11
+ - id: no-commit-to-branch
12
+
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ rev: v0.12.9
15
+ hooks:
16
+ - id: ruff
17
+ name: ruff lint
18
+ args: [--fix]
19
+ - id: ruff-format
20
+ name: ruff format
@@ -198,4 +198,4 @@
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-hydrolix
3
+ Version: 0.1.4
4
+ Summary: An MCP server for Hydrolix.
5
+ Project-URL: Home, https://github.com/hydrolix/mcp-hydrolix
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.13
9
+ Requires-Dist: clickhouse-connect>=0.8.16
10
+ Requires-Dist: fastmcp>=2.0.0
11
+ Requires-Dist: pip-system-certs>=4.0
12
+ Requires-Dist: python-dotenv>=1.0.1
13
+ Provides-Extra: dev
14
+ Requires-Dist: pre-commit; extra == 'dev'
15
+ Requires-Dist: pytest; extra == 'dev'
16
+ Requires-Dist: pytest-asyncio; extra == 'dev'
17
+ Requires-Dist: ruff; extra == 'dev'
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Hydrolix MCP Server
21
+
22
+ [![PyPI - Version](https://img.shields.io/pypi/v/mcp-hydrolix)](https://pypi.org/project/mcp-hydrolix)
23
+
24
+ An MCP server for Hydrolix.
25
+
26
+ ## Tools
27
+
28
+ * `run_select_query`
29
+ * Execute SQL queries on your Hydrolix cluster.
30
+ * Input: `sql` (string): The SQL query to execute.
31
+ * All Hydrolix queries are run with `readonly = 1` to ensure they are safe.
32
+
33
+ * `list_databases`
34
+ * List all databases on your Hydrolix cluster.
35
+
36
+ * `list_tables`
37
+ * List all tables in a database.
38
+ * Input: `database` (string): The name of the database.
39
+
40
+ ## Effective Usage
41
+
42
+ Due to the wide variety in LLM architectures, not all models will proactively use the tools above, and few will use them effectively without guidance, even with the carefully-constructed tool descriptions provided to the model. To get the best results out of your model while using the Hydrolix MCP server, we recommend the following:
43
+
44
+ * Refer to your Hydrolix database by name and request tool usage in your prompts (e.g., "Using MCP tools to access my Hydrolix database, please ...")
45
+ - This encourages the model to use the MCP tools available and minimizes hallucinations.
46
+ * Include time ranges in your prompts (e.g., "Between December 5 2023 and January 18 2024, ...") and specifically request that the output be ordered by timestamp.
47
+ - This prompts the model to write more efficient queries that take advantage of [primary key optimizations](https://hydrolix.io/blog/optimizing-latest-n-row-queries/)
48
+
49
+ ### Health Check Endpoint
50
+
51
+ When running with HTTP or SSE transport, a health check endpoint is available at `/health`. This endpoint:
52
+ - Returns `200 OK` with the Hydrolix query-head's Clickhouse version if the server is healthy and can connect to Hydrolix
53
+ - Returns `503 Service Unavailable` if the server cannot connect to the Hydrolix query-head
54
+
55
+ Example:
56
+ ```bash
57
+ curl http://localhost:8000/health
58
+ # Response: OK - Connected to Hydrolix compatible with ClickHouse 24.3.1
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ The Hydrolix MCP server is configured using a standard MCP server entry. Consult your client's documentation for specific instructions on where to find or declare MCP servers. An example setup using Claude Desktop is documented below.
64
+
65
+ The recommended way to launch the Hydrolix MCP server is via the [`uv` project manager](https://github.com/astral-sh/uv), which will manage installing all other dependencies in an isolated environment.
66
+
67
+ MCP Server definition using username and password (JSON):
68
+
69
+ ```json
70
+ {
71
+ "command": "uv",
72
+ "args": [
73
+ "run",
74
+ "--with",
75
+ "mcp-hydrolix",
76
+ "--python",
77
+ "3.13",
78
+ "mcp-hydrolix"
79
+ ],
80
+ "env": {
81
+ "HYDROLIX_HOST": "<hydrolix-host>",
82
+ "HYDROLIX_USER": "<hydrolix-user>",
83
+ "HYDROLIX_PASSWORD": "<hydrolix-password>"
84
+ }
85
+ }
86
+ ```
87
+
88
+ MCP Server definition using service account token (JSON):
89
+
90
+ ```json
91
+ {
92
+ "command": "uv",
93
+ "args": [
94
+ "run",
95
+ "--with",
96
+ "mcp-hydrolix",
97
+ "--python",
98
+ "3.13",
99
+ "mcp-hydrolix"
100
+ ],
101
+ "env": {
102
+ "HYDROLIX_HOST": "<hydrolix-host>",
103
+ "HYDROLIX_TOKEN": "<hydrolix-service-account-token>"
104
+ }
105
+ }
106
+ ```
107
+
108
+ MCP Server definition using username and password (YAML):
109
+
110
+ ```yaml
111
+ command: uv
112
+ args:
113
+ - run
114
+ - --with
115
+ - mcp-hydrolix
116
+ - --python
117
+ - "3.13"
118
+ - mcp-hydrolix
119
+ env:
120
+ HYDROLIX_HOST: <hydrolix-host>
121
+ HYDROLIX_USER: <hydrolix-user>
122
+ HYDROLIX_PASSWORD: <hydrolix-password>
123
+ ```
124
+
125
+ MCP Server definition using service account token (YAML):
126
+
127
+ ```yaml
128
+ command: uv
129
+ args:
130
+ - run
131
+ - --with
132
+ - mcp-hydrolix
133
+ - --python
134
+ - "3.13"
135
+ - mcp-hydrolix
136
+ env:
137
+ HYDROLIX_HOST: <hydrolix-host>
138
+ HYDROLIX_TOKEN: <hydrolix-service-account-token>
139
+ ```
140
+
141
+ ### Configuration Example (Claude Desktop)
142
+
143
+ 1. Open the Claude Desktop configuration file located at:
144
+ - On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
145
+ - On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
146
+
147
+ 2. Add a `mcp-hydrolix` server entry to the `mcpServers` config block to use username and password:
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "mcp-hydrolix": {
153
+ "command": "uv",
154
+ "args": [
155
+ "run",
156
+ "--with",
157
+ "mcp-hydrolix",
158
+ "--python",
159
+ "3.13",
160
+ "mcp-hydrolix"
161
+ ],
162
+ "env": {
163
+ "HYDROLIX_HOST": "<hydrolix-host>",
164
+ "HYDROLIX_USER": "<hydrolix-user>",
165
+ "HYDROLIX_PASSWORD": "<hydrolix-password>"
166
+ }
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ To leverage service account use the following config block:
173
+
174
+ ```json
175
+ {
176
+ "mcpServers": {
177
+ "mcp-hydrolix": {
178
+ "command": "uv",
179
+ "args": [
180
+ "run",
181
+ "--with",
182
+ "mcp-hydrolix",
183
+ "--python",
184
+ "3.13",
185
+ "mcp-hydrolix"
186
+ ],
187
+ "env": {
188
+ "HYDROLIX_HOST": "<hydrolix-host>",
189
+ "HYDROLIX_TOKEN": "<hydrolix-service-account-token>"
190
+ }
191
+ }
192
+ }
193
+ }
194
+ ```
195
+
196
+ 3. Update the environment variable definitions to point to your Hydrolix cluster.
197
+
198
+ 4. (Recommended) Locate the command entry for `uv` and replace it with the absolute path to the `uv` executable. This ensures that the correct version of `uv` is used when starting the server. You can find this path using `which uv` or `where.exe uv`.
199
+
200
+ 5. Restart Claude Desktop to apply the changes. If you are using Windows, ensure Claude is stopped completely by closing the client using the system tray icon.
201
+
202
+ ### Environment Variables
203
+
204
+ The following variables are used to configure the Hydrolix connection. These variables may be provided via the MCP config block (as shown above), a `.env` file, or traditional environment variables.
205
+
206
+ #### Required Variables
207
+ * `HYDROLIX_HOST`: The hostname of your Hydrolix server
208
+ * `HYDROLIX_TOKEN`: The Hydrolix service account token (omit if using username/password)
209
+ * `HYDROLIX_USER`: The username for authentication (omit if using service account)
210
+ * `HYDROLIX_PASSWORD`: The password for authentication (omit if using service account)
211
+
212
+ **Authentication precedence:** If both `HYDROLIX_TOKEN` and `HYDROLIX_USER`/`HYDROLIX_PASSWORD` are provided, the service account token takes precedence and username/password authentication will be ignored.
213
+
214
+ #### Optional Variables
215
+ * `HYDROLIX_PORT`: The port number of your Hydrolix server
216
+ * Default: `8088`
217
+ * Usually doesn't need to be set unless using a non-standard port
218
+ * `HYDROLIX_VERIFY`: Enable/disable SSL certificate verification
219
+ * Default: `"true"`
220
+ * Set to `"false"` to disable certificate verification (not recommended for production)
221
+ * `HYDROLIX_DATABASE`: Default database to use
222
+ *Default: None (uses server default)
223
+ * Set this to automatically connect to a specific database
224
+ * `HYDROLIX_MCP_SERVER_TRANSPORT`: Sets the transport method for the MCP server.
225
+ * Default: `"stdio"`
226
+ * Valid options: `"stdio"`, `"http"`, `"sse"`. This is useful for local development with tools like MCP Inspector.
227
+ * `HYDROLIX_MCP_BIND_HOST`: Host to bind the MCP server to when using HTTP or SSE transport
228
+ * Default: `"127.0.0.1"`
229
+ * Set to `"0.0.0.0"` to bind to all network interfaces (useful for Docker or remote access)
230
+ * Only used when transport is `"http"` or `"sse"`
231
+ * `HYDROLIX_MCP_BIND_PORT`: Port to bind the MCP server to when using HTTP or SSE transport
232
+ * Default: `"8000"`
233
+ * Only used when transport is `"http"` or `"sse"`
234
+
235
+
236
+ For MCP Inspector or remote access with HTTP transport:
237
+
238
+ ```env
239
+ HYDROLIX_HOST=localhost
240
+ HYDROLIX_USER=default
241
+ HYDROLIX_PASSWORD=myPassword
242
+ HYDROLIX_MCP_SERVER_TRANSPORT=http
243
+ HYDROLIX_MCP_BIND_HOST=0.0.0.0 # Bind to all interfaces
244
+ HYDROLIX_MCP_BIND_PORT=4200 # Custom port (default: 8000)
245
+ ```
246
+
247
+ When using HTTP transport, the server will run on the configured port (default 8000). For example, with the above configuration:
248
+ - MCP endpoint: `http://localhost:4200/mcp`
249
+ - Health check: `http://localhost:4200/health`
250
+
251
+ Note: The bind host and port settings are only used when transport is set to "http" or "sse".
@@ -0,0 +1,232 @@
1
+ # Hydrolix MCP Server
2
+
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/mcp-hydrolix)](https://pypi.org/project/mcp-hydrolix)
4
+
5
+ An MCP server for Hydrolix.
6
+
7
+ ## Tools
8
+
9
+ * `run_select_query`
10
+ * Execute SQL queries on your Hydrolix cluster.
11
+ * Input: `sql` (string): The SQL query to execute.
12
+ * All Hydrolix queries are run with `readonly = 1` to ensure they are safe.
13
+
14
+ * `list_databases`
15
+ * List all databases on your Hydrolix cluster.
16
+
17
+ * `list_tables`
18
+ * List all tables in a database.
19
+ * Input: `database` (string): The name of the database.
20
+
21
+ ## Effective Usage
22
+
23
+ Due to the wide variety in LLM architectures, not all models will proactively use the tools above, and few will use them effectively without guidance, even with the carefully-constructed tool descriptions provided to the model. To get the best results out of your model while using the Hydrolix MCP server, we recommend the following:
24
+
25
+ * Refer to your Hydrolix database by name and request tool usage in your prompts (e.g., "Using MCP tools to access my Hydrolix database, please ...")
26
+ - This encourages the model to use the MCP tools available and minimizes hallucinations.
27
+ * Include time ranges in your prompts (e.g., "Between December 5 2023 and January 18 2024, ...") and specifically request that the output be ordered by timestamp.
28
+ - This prompts the model to write more efficient queries that take advantage of [primary key optimizations](https://hydrolix.io/blog/optimizing-latest-n-row-queries/)
29
+
30
+ ### Health Check Endpoint
31
+
32
+ When running with HTTP or SSE transport, a health check endpoint is available at `/health`. This endpoint:
33
+ - Returns `200 OK` with the Hydrolix query-head's Clickhouse version if the server is healthy and can connect to Hydrolix
34
+ - Returns `503 Service Unavailable` if the server cannot connect to the Hydrolix query-head
35
+
36
+ Example:
37
+ ```bash
38
+ curl http://localhost:8000/health
39
+ # Response: OK - Connected to Hydrolix compatible with ClickHouse 24.3.1
40
+ ```
41
+
42
+ ## Configuration
43
+
44
+ The Hydrolix MCP server is configured using a standard MCP server entry. Consult your client's documentation for specific instructions on where to find or declare MCP servers. An example setup using Claude Desktop is documented below.
45
+
46
+ The recommended way to launch the Hydrolix MCP server is via the [`uv` project manager](https://github.com/astral-sh/uv), which will manage installing all other dependencies in an isolated environment.
47
+
48
+ MCP Server definition using username and password (JSON):
49
+
50
+ ```json
51
+ {
52
+ "command": "uv",
53
+ "args": [
54
+ "run",
55
+ "--with",
56
+ "mcp-hydrolix",
57
+ "--python",
58
+ "3.13",
59
+ "mcp-hydrolix"
60
+ ],
61
+ "env": {
62
+ "HYDROLIX_HOST": "<hydrolix-host>",
63
+ "HYDROLIX_USER": "<hydrolix-user>",
64
+ "HYDROLIX_PASSWORD": "<hydrolix-password>"
65
+ }
66
+ }
67
+ ```
68
+
69
+ MCP Server definition using service account token (JSON):
70
+
71
+ ```json
72
+ {
73
+ "command": "uv",
74
+ "args": [
75
+ "run",
76
+ "--with",
77
+ "mcp-hydrolix",
78
+ "--python",
79
+ "3.13",
80
+ "mcp-hydrolix"
81
+ ],
82
+ "env": {
83
+ "HYDROLIX_HOST": "<hydrolix-host>",
84
+ "HYDROLIX_TOKEN": "<hydrolix-service-account-token>"
85
+ }
86
+ }
87
+ ```
88
+
89
+ MCP Server definition using username and password (YAML):
90
+
91
+ ```yaml
92
+ command: uv
93
+ args:
94
+ - run
95
+ - --with
96
+ - mcp-hydrolix
97
+ - --python
98
+ - "3.13"
99
+ - mcp-hydrolix
100
+ env:
101
+ HYDROLIX_HOST: <hydrolix-host>
102
+ HYDROLIX_USER: <hydrolix-user>
103
+ HYDROLIX_PASSWORD: <hydrolix-password>
104
+ ```
105
+
106
+ MCP Server definition using service account token (YAML):
107
+
108
+ ```yaml
109
+ command: uv
110
+ args:
111
+ - run
112
+ - --with
113
+ - mcp-hydrolix
114
+ - --python
115
+ - "3.13"
116
+ - mcp-hydrolix
117
+ env:
118
+ HYDROLIX_HOST: <hydrolix-host>
119
+ HYDROLIX_TOKEN: <hydrolix-service-account-token>
120
+ ```
121
+
122
+ ### Configuration Example (Claude Desktop)
123
+
124
+ 1. Open the Claude Desktop configuration file located at:
125
+ - On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
126
+ - On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
127
+
128
+ 2. Add a `mcp-hydrolix` server entry to the `mcpServers` config block to use username and password:
129
+
130
+ ```json
131
+ {
132
+ "mcpServers": {
133
+ "mcp-hydrolix": {
134
+ "command": "uv",
135
+ "args": [
136
+ "run",
137
+ "--with",
138
+ "mcp-hydrolix",
139
+ "--python",
140
+ "3.13",
141
+ "mcp-hydrolix"
142
+ ],
143
+ "env": {
144
+ "HYDROLIX_HOST": "<hydrolix-host>",
145
+ "HYDROLIX_USER": "<hydrolix-user>",
146
+ "HYDROLIX_PASSWORD": "<hydrolix-password>"
147
+ }
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ To leverage service account use the following config block:
154
+
155
+ ```json
156
+ {
157
+ "mcpServers": {
158
+ "mcp-hydrolix": {
159
+ "command": "uv",
160
+ "args": [
161
+ "run",
162
+ "--with",
163
+ "mcp-hydrolix",
164
+ "--python",
165
+ "3.13",
166
+ "mcp-hydrolix"
167
+ ],
168
+ "env": {
169
+ "HYDROLIX_HOST": "<hydrolix-host>",
170
+ "HYDROLIX_TOKEN": "<hydrolix-service-account-token>"
171
+ }
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ 3. Update the environment variable definitions to point to your Hydrolix cluster.
178
+
179
+ 4. (Recommended) Locate the command entry for `uv` and replace it with the absolute path to the `uv` executable. This ensures that the correct version of `uv` is used when starting the server. You can find this path using `which uv` or `where.exe uv`.
180
+
181
+ 5. Restart Claude Desktop to apply the changes. If you are using Windows, ensure Claude is stopped completely by closing the client using the system tray icon.
182
+
183
+ ### Environment Variables
184
+
185
+ The following variables are used to configure the Hydrolix connection. These variables may be provided via the MCP config block (as shown above), a `.env` file, or traditional environment variables.
186
+
187
+ #### Required Variables
188
+ * `HYDROLIX_HOST`: The hostname of your Hydrolix server
189
+ * `HYDROLIX_TOKEN`: The Hydrolix service account token (omit if using username/password)
190
+ * `HYDROLIX_USER`: The username for authentication (omit if using service account)
191
+ * `HYDROLIX_PASSWORD`: The password for authentication (omit if using service account)
192
+
193
+ **Authentication precedence:** If both `HYDROLIX_TOKEN` and `HYDROLIX_USER`/`HYDROLIX_PASSWORD` are provided, the service account token takes precedence and username/password authentication will be ignored.
194
+
195
+ #### Optional Variables
196
+ * `HYDROLIX_PORT`: The port number of your Hydrolix server
197
+ * Default: `8088`
198
+ * Usually doesn't need to be set unless using a non-standard port
199
+ * `HYDROLIX_VERIFY`: Enable/disable SSL certificate verification
200
+ * Default: `"true"`
201
+ * Set to `"false"` to disable certificate verification (not recommended for production)
202
+ * `HYDROLIX_DATABASE`: Default database to use
203
+ *Default: None (uses server default)
204
+ * Set this to automatically connect to a specific database
205
+ * `HYDROLIX_MCP_SERVER_TRANSPORT`: Sets the transport method for the MCP server.
206
+ * Default: `"stdio"`
207
+ * Valid options: `"stdio"`, `"http"`, `"sse"`. This is useful for local development with tools like MCP Inspector.
208
+ * `HYDROLIX_MCP_BIND_HOST`: Host to bind the MCP server to when using HTTP or SSE transport
209
+ * Default: `"127.0.0.1"`
210
+ * Set to `"0.0.0.0"` to bind to all network interfaces (useful for Docker or remote access)
211
+ * Only used when transport is `"http"` or `"sse"`
212
+ * `HYDROLIX_MCP_BIND_PORT`: Port to bind the MCP server to when using HTTP or SSE transport
213
+ * Default: `"8000"`
214
+ * Only used when transport is `"http"` or `"sse"`
215
+
216
+
217
+ For MCP Inspector or remote access with HTTP transport:
218
+
219
+ ```env
220
+ HYDROLIX_HOST=localhost
221
+ HYDROLIX_USER=default
222
+ HYDROLIX_PASSWORD=myPassword
223
+ HYDROLIX_MCP_SERVER_TRANSPORT=http
224
+ HYDROLIX_MCP_BIND_HOST=0.0.0.0 # Bind to all interfaces
225
+ HYDROLIX_MCP_BIND_PORT=4200 # Custom port (default: 8000)
226
+ ```
227
+
228
+ When using HTTP transport, the server will run on the configured port (default 8000). For example, with the above configuration:
229
+ - MCP endpoint: `http://localhost:4200/mcp`
230
+ - Health check: `http://localhost:4200/health`
231
+
232
+ Note: The bind host and port settings are only used when transport is set to "http" or "sse".
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://glama.ai/mcp/schemas/server.json",
3
+ "maintainers": [
4
+ "aggarwaa",
5
+ "dsztykman",
6
+ "emanb29"
7
+ ]
8
+ }
@@ -0,0 +1,21 @@
1
+ from .mcp_server import mcp
2
+ from .mcp_env import get_config, TransportType
3
+
4
+
5
+ def main():
6
+ config = get_config()
7
+ transport = config.mcp_server_transport
8
+
9
+ # For HTTP and SSE transports, we need to specify host and port
10
+ http_transports = [TransportType.HTTP.value, TransportType.SSE.value]
11
+ if transport in http_transports:
12
+ # Use the configured bind host (defaults to 127.0.0.1, can be set to 0.0.0.0)
13
+ # and bind port (defaults to 8000)
14
+ mcp.run(transport=transport, host=config.mcp_bind_host, port=config.mcp_bind_port)
15
+ else:
16
+ # For stdio transport, no host or port is needed
17
+ mcp.run(transport=transport)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()