mcp-hydrolix 0.1.0__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- mcp_hydrolix/mcp_env.py +14 -2
- mcp_hydrolix/mcp_server.py +5 -3
- mcp_hydrolix-0.1.3.dist-info/METADATA +146 -0
- mcp_hydrolix-0.1.3.dist-info/RECORD +9 -0
- mcp_hydrolix-0.1.0.dist-info/METADATA +0 -106
- mcp_hydrolix-0.1.0.dist-info/RECORD +0 -9
- {mcp_hydrolix-0.1.0.dist-info → mcp_hydrolix-0.1.3.dist-info}/WHEEL +0 -0
- {mcp_hydrolix-0.1.0.dist-info → mcp_hydrolix-0.1.3.dist-info}/entry_points.txt +0 -0
- {mcp_hydrolix-0.1.0.dist-info → mcp_hydrolix-0.1.3.dist-info}/licenses/LICENSE +0 -0
mcp_hydrolix/mcp_env.py
CHANGED
|
@@ -127,5 +127,17 @@ class HydrolixConfig:
|
|
|
127
127
|
raise ValueError(f"Missing required environment variables: {', '.join(missing_vars)}")
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
# Global instance for
|
|
131
|
-
|
|
130
|
+
# Global instance placeholder for the singleton pattern
|
|
131
|
+
_CONFIG_INSTANCE = None
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def get_config():
|
|
135
|
+
"""
|
|
136
|
+
Gets the singleton instance of HydrolixConfig.
|
|
137
|
+
Instantiates it on the first call.
|
|
138
|
+
"""
|
|
139
|
+
global _CONFIG_INSTANCE
|
|
140
|
+
if _CONFIG_INSTANCE is None:
|
|
141
|
+
# Instantiate the config object here, ensuring load_dotenv() has likely run
|
|
142
|
+
_CONFIG_INSTANCE = HydrolixConfig()
|
|
143
|
+
return _CONFIG_INSTANCE
|
mcp_hydrolix/mcp_server.py
CHANGED
|
@@ -8,7 +8,7 @@ from clickhouse_connect.driver.binding import quote_identifier, format_query_val
|
|
|
8
8
|
from dotenv import load_dotenv
|
|
9
9
|
from mcp.server.fastmcp import FastMCP
|
|
10
10
|
|
|
11
|
-
from mcp_hydrolix.mcp_env import
|
|
11
|
+
from mcp_hydrolix.mcp_env import get_config
|
|
12
12
|
|
|
13
13
|
MCP_SERVER_NAME = "mcp-hydrolix"
|
|
14
14
|
|
|
@@ -56,10 +56,11 @@ def list_tables(database: str, like: str = None):
|
|
|
56
56
|
|
|
57
57
|
# Get all table comments in one query
|
|
58
58
|
table_comments_query = (
|
|
59
|
-
f"SELECT name, comment FROM system.tables WHERE database = {format_query_value(database)}"
|
|
59
|
+
f"SELECT name, comment, primary_key FROM system.tables WHERE database = {format_query_value(database)} and engine = 'TurbineStorage' and total_rows > 0"
|
|
60
60
|
)
|
|
61
61
|
table_comments_result = client.query(table_comments_query)
|
|
62
62
|
table_comments = {row[0]: row[1] for row in table_comments_result.result_rows}
|
|
63
|
+
primary_keys = {row[0]: row[2] for row in table_comments_result.result_rows}
|
|
63
64
|
|
|
64
65
|
# Get all column comments in one query
|
|
65
66
|
column_comments_query = f"SELECT table, name, comment FROM system.columns WHERE database = {format_query_value(database)}"
|
|
@@ -98,6 +99,7 @@ def list_tables(database: str, like: str = None):
|
|
|
98
99
|
"comment": table_comments.get(table),
|
|
99
100
|
"columns": columns,
|
|
100
101
|
"create_table_query": create_table_result,
|
|
102
|
+
"primary_key": primary_keys.get(table)
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
tables = []
|
|
@@ -212,7 +214,7 @@ def run_select_query(query: str):
|
|
|
212
214
|
|
|
213
215
|
|
|
214
216
|
def create_hydrolix_client():
|
|
215
|
-
client_config =
|
|
217
|
+
client_config = get_config().get_client_config()
|
|
216
218
|
logger.info(
|
|
217
219
|
f"Creating Hydrolix client connection to {client_config['host']}:{client_config['port']} "
|
|
218
220
|
f"as {client_config['username']} "
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-hydrolix
|
|
3
|
+
Version: 0.1.3
|
|
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: mcp[cli]>=1.3.0
|
|
11
|
+
Requires-Dist: pip-system-certs>=4.0
|
|
12
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
13
|
+
Requires-Dist: uvicorn>=0.34.0
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
16
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Hydrolix MCP Server
|
|
20
|
+
[](https://pypi.org/project/mcp-hydrolix)
|
|
21
|
+
|
|
22
|
+
An MCP server for Hydrolix.
|
|
23
|
+
|
|
24
|
+
## Tools
|
|
25
|
+
|
|
26
|
+
* `run_select_query`
|
|
27
|
+
- Execute SQL queries on your Hydrolix cluster.
|
|
28
|
+
- Input: `sql` (string): The SQL query to execute.
|
|
29
|
+
- All Hydrolix queries are run with `readonly = 1` to ensure they are safe.
|
|
30
|
+
|
|
31
|
+
* `list_databases`
|
|
32
|
+
- List all databases on your Hydrolix cluster.
|
|
33
|
+
|
|
34
|
+
* `list_tables`
|
|
35
|
+
- List all tables in a database.
|
|
36
|
+
- Input: `database` (string): The name of the database.
|
|
37
|
+
|
|
38
|
+
## Effective Usage
|
|
39
|
+
|
|
40
|
+
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:
|
|
41
|
+
|
|
42
|
+
* 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 ...")
|
|
43
|
+
- This encourages the model to use the MCP tools available and minimizes hallucinations.
|
|
44
|
+
* 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.
|
|
45
|
+
- 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/)
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
MCP Server definition (JSON):
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"command": "uv",
|
|
58
|
+
"args": [
|
|
59
|
+
"run",
|
|
60
|
+
"--with",
|
|
61
|
+
"mcp-hydrolix",
|
|
62
|
+
"--python",
|
|
63
|
+
"3.13",
|
|
64
|
+
"mcp-hydrolix"
|
|
65
|
+
],
|
|
66
|
+
"env": {
|
|
67
|
+
"HYDROLIX_HOST": "<hydrolix-host>",
|
|
68
|
+
"HYDROLIX_USER": "<hydrolix-user>",
|
|
69
|
+
"HYDROLIX_PASSWORD": "<hydrolix-password>"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
MCP Server definition (YAML):
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
command: uv
|
|
78
|
+
args:
|
|
79
|
+
- run
|
|
80
|
+
- --with
|
|
81
|
+
- mcp-hydrolix
|
|
82
|
+
- --python
|
|
83
|
+
- "3.13"
|
|
84
|
+
- mcp-hydrolix
|
|
85
|
+
env:
|
|
86
|
+
HYDROLIX_HOST: <hydrolix-host>
|
|
87
|
+
HYDROLIX_USER: <hydrolix-user>
|
|
88
|
+
HYDROLIX_PASSWORD: <hydrolix-password>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Configuration Example (Claude Desktop)
|
|
92
|
+
|
|
93
|
+
1. Open the Claude Desktop configuration file located at:
|
|
94
|
+
- On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
95
|
+
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
96
|
+
|
|
97
|
+
2. Add a `mcp-hydrolix` server entry to the `mcpServers` config block:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"mcp-hydrolix": {
|
|
103
|
+
"command": "uv",
|
|
104
|
+
"args": [
|
|
105
|
+
"run",
|
|
106
|
+
"--with",
|
|
107
|
+
"mcp-hydrolix",
|
|
108
|
+
"--python",
|
|
109
|
+
"3.13",
|
|
110
|
+
"mcp-hydrolix"
|
|
111
|
+
],
|
|
112
|
+
"env": {
|
|
113
|
+
"HYDROLIX_HOST": "<hydrolix-host>",
|
|
114
|
+
"HYDROLIX_USER": "<hydrolix-user>",
|
|
115
|
+
"HYDROLIX_PASSWORD": "<hydrolix-password>"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
3. Update the environment variable definitions to point to your Hydrolix cluster.
|
|
123
|
+
|
|
124
|
+
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`.
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
### Environment Variables
|
|
129
|
+
|
|
130
|
+
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.
|
|
131
|
+
|
|
132
|
+
#### Required Variables
|
|
133
|
+
* `HYDROLIX_HOST`: The hostname of your Hydrolix server
|
|
134
|
+
* `HYDROLIX_USER`: The username for authentication
|
|
135
|
+
* `HYDROLIX_PASSWORD`: The password for authentication
|
|
136
|
+
|
|
137
|
+
#### Optional Variables
|
|
138
|
+
* `HYDROLIX_PORT`: The port number of your Hydrolix server
|
|
139
|
+
- Default: `8088`
|
|
140
|
+
- Usually doesn't need to be set unless using a non-standard port
|
|
141
|
+
* `HYDROLIX_VERIFY`: Enable/disable SSL certificate verification
|
|
142
|
+
- Default: `"true"`
|
|
143
|
+
- Set to `"false"` to disable certificate verification (not recommended for production)
|
|
144
|
+
* `HYDROLIX_DATABASE`: Default database to use
|
|
145
|
+
- Default: None (uses server default)
|
|
146
|
+
- Set this to automatically connect to a specific database
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
mcp_hydrolix/__init__.py,sha256=DnAQkvoFf_QhrDNFLOmn-nHlldPUgtdN33k3xJWthgc,225
|
|
2
|
+
mcp_hydrolix/main.py,sha256=WTZcvpIas2mIjNd_em7KWlXI_6IXZAdtdlQ7czmX1cs,96
|
|
3
|
+
mcp_hydrolix/mcp_env.py,sha256=HPOPRdPm-YAxU3ygdZPoNT8Oc4CE-VWXF6mmton5mnU,4454
|
|
4
|
+
mcp_hydrolix/mcp_server.py,sha256=xzEILclKF88KE8OZljiaAHwPcfiyt5DE_amPnqVyMFQ,10017
|
|
5
|
+
mcp_hydrolix-0.1.3.dist-info/METADATA,sha256=EEc9-0SGJc6AGmSQHvrbki6unzxV7c1m2IoLJhMWBuo,5152
|
|
6
|
+
mcp_hydrolix-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
mcp_hydrolix-0.1.3.dist-info/entry_points.txt,sha256=vHa7F2rOCVu8lpsqR8BYbE1w8ugJSOYwX95w802Y5qE,56
|
|
8
|
+
mcp_hydrolix-0.1.3.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
9
|
+
mcp_hydrolix-0.1.3.dist-info/RECORD,,
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: mcp-hydrolix
|
|
3
|
-
Version: 0.1.0
|
|
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.0
|
|
10
|
-
Requires-Dist: mcp[cli]>=1.3.0
|
|
11
|
-
Requires-Dist: pip-system-certs>=4.0
|
|
12
|
-
Requires-Dist: python-dotenv>=1.0.1
|
|
13
|
-
Requires-Dist: uvicorn>=0.34.0
|
|
14
|
-
Provides-Extra: dev
|
|
15
|
-
Requires-Dist: pytest; extra == 'dev'
|
|
16
|
-
Requires-Dist: ruff; extra == 'dev'
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
|
|
19
|
-
# Hydrolix MCP Server
|
|
20
|
-
[](https://pypi.org/project/mcp-hydrolix)
|
|
21
|
-
|
|
22
|
-
An MCP server for Hydrolix.
|
|
23
|
-
|
|
24
|
-
## Features
|
|
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
|
-
## Configuration
|
|
41
|
-
|
|
42
|
-
1. Open the Claude Desktop configuration file located at:
|
|
43
|
-
- On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
44
|
-
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
45
|
-
|
|
46
|
-
2. Add the following:
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"mcpServers": {
|
|
51
|
-
"mcp-hydrolix": {
|
|
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_PORT": "<hydrolix-port>",
|
|
64
|
-
"HYDROLIX_USER": "<hydrolix-user>",
|
|
65
|
-
"HYDROLIX_PASSWORD": "<hydrolix-password>",
|
|
66
|
-
"HYDROLIX_SECURE": "true",
|
|
67
|
-
"HYDROLIX_VERIFY": "true",
|
|
68
|
-
"HYDROLIX_CONNECT_TIMEOUT": "30",
|
|
69
|
-
"HYDROLIX_SEND_RECEIVE_TIMEOUT": "30"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Update the environment variables to point to your own Hydrolix service.
|
|
77
|
-
|
|
78
|
-
3. 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. On a mac, you can find this path using `which uv`.
|
|
79
|
-
|
|
80
|
-
4. Restart Claude Desktop to apply the changes.
|
|
81
|
-
|
|
82
|
-
### Environment Variables
|
|
83
|
-
|
|
84
|
-
The following environment variables are used to configure the Hydrolix connection:
|
|
85
|
-
|
|
86
|
-
#### Required Variables
|
|
87
|
-
* `HYDROLIX_HOST`: The hostname of your Hydrolix server
|
|
88
|
-
* `HYDROLIX_USER`: The username for authentication
|
|
89
|
-
* `HYDROLIX_PASSWORD`: The password for authentication
|
|
90
|
-
|
|
91
|
-
#### Optional Variables
|
|
92
|
-
* `HYDROLIX_PORT`: The port number of your Hydrolix server
|
|
93
|
-
- Default: `8088`
|
|
94
|
-
- Usually doesn't need to be set unless using a non-standard port
|
|
95
|
-
* `HYDROLIX_VERIFY`: Enable/disable SSL certificate verification
|
|
96
|
-
- Default: `"true"`
|
|
97
|
-
- Set to `"false"` to disable certificate verification (not recommended for production)
|
|
98
|
-
* `HYDROLIX_CONNECT_TIMEOUT`: Connection timeout in seconds
|
|
99
|
-
- Default: `"30"`
|
|
100
|
-
- Increase this value if you experience connection timeouts
|
|
101
|
-
* `HYDROLIX_SEND_RECEIVE_TIMEOUT`: Send/receive timeout in seconds
|
|
102
|
-
- Default: `"300"`
|
|
103
|
-
- Increase this value for long-running queries
|
|
104
|
-
* `HYDROLIX_DATABASE`: Default database to use
|
|
105
|
-
- Default: None (uses server default)
|
|
106
|
-
- Set this to automatically connect to a specific database
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
mcp_hydrolix/__init__.py,sha256=DnAQkvoFf_QhrDNFLOmn-nHlldPUgtdN33k3xJWthgc,225
|
|
2
|
-
mcp_hydrolix/main.py,sha256=WTZcvpIas2mIjNd_em7KWlXI_6IXZAdtdlQ7czmX1cs,96
|
|
3
|
-
mcp_hydrolix/mcp_env.py,sha256=PIMxbhImiSGs4PaqrvEFXjA7wkr2AwEMkjCnKPyMEZg,4091
|
|
4
|
-
mcp_hydrolix/mcp_server.py,sha256=EFkFy0658H0Fspo0e7oHiQNsWzBcP7tAcU0fo11iHz8,9813
|
|
5
|
-
mcp_hydrolix-0.1.0.dist-info/METADATA,sha256=KZRd6hGV42Hcx_DIM6TGbbzkEaSLP2ovHtHpuyO-0aY,3368
|
|
6
|
-
mcp_hydrolix-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
mcp_hydrolix-0.1.0.dist-info/entry_points.txt,sha256=vHa7F2rOCVu8lpsqR8BYbE1w8ugJSOYwX95w802Y5qE,56
|
|
8
|
-
mcp_hydrolix-0.1.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
9
|
-
mcp_hydrolix-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|