devray-datalab-mcp 0.1.0__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.
- devray_datalab_mcp-0.1.0/LICENSE +21 -0
- devray_datalab_mcp-0.1.0/PKG-INFO +476 -0
- devray_datalab_mcp-0.1.0/README.md +434 -0
- devray_datalab_mcp-0.1.0/pyproject.toml +51 -0
- devray_datalab_mcp-0.1.0/setup.cfg +4 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/__init__.py +3 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/config.py +72 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/__init__.py +1 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/evaluator.py +145 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/hardware.py +104 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/loader.py +71 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/preprocessing.py +115 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/core/trainer.py +384 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/server.py +364 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/__init__.py +1 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/analysis.py +212 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/datasets.py +133 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/models.py +254 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/storage.py +53 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/system.py +83 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/tools/training.py +334 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/utils/__init__.py +1 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/utils/errors.py +59 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab/utils/validation.py +142 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/PKG-INFO +476 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/SOURCES.txt +35 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/dependency_links.txt +1 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/entry_points.txt +2 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/requires.txt +11 -0
- devray_datalab_mcp-0.1.0/src/devray_datalab_mcp.egg-info/top_level.txt +1 -0
- devray_datalab_mcp-0.1.0/tests/test_analysis.py +82 -0
- devray_datalab_mcp-0.1.0/tests/test_e2e.py +95 -0
- devray_datalab_mcp-0.1.0/tests/test_loader.py +51 -0
- devray_datalab_mcp-0.1.0/tests/test_models.py +137 -0
- devray_datalab_mcp-0.1.0/tests/test_system.py +31 -0
- devray_datalab_mcp-0.1.0/tests/test_trainer.py +144 -0
- devray_datalab_mcp-0.1.0/tests/test_validation.py +75 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DevRay DataLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devray-datalab-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first data science and machine learning MCP server
|
|
5
|
+
Author: DevRay DataLab
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 DevRay DataLab
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: mcp<3,>=2.0
|
|
32
|
+
Requires-Dist: pandas>=2.0
|
|
33
|
+
Requires-Dist: numpy>=1.26
|
|
34
|
+
Requires-Dist: scikit-learn>=1.3
|
|
35
|
+
Requires-Dist: scipy>=1.9
|
|
36
|
+
Requires-Dist: joblib>=1.3
|
|
37
|
+
Requires-Dist: psutil>=5.9
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
40
|
+
Requires-Dist: ruff>=0.10; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# DevRay DataLab MCP
|
|
44
|
+
|
|
45
|
+
<!-- mcp-name: io.github.rayklanderman/devray-datalab-mcp -->
|
|
46
|
+
|
|
47
|
+
A local-first, open-source Model Context Protocol (MCP) server for data science
|
|
48
|
+
and machine learning. It lets AI assistants (Claude, Cursor, Cline, Kilo Code,
|
|
49
|
+
and other MCP-compatible clients) perform real exploratory data analysis and
|
|
50
|
+
train/evaluate machine learning models entirely on the user's own computer --
|
|
51
|
+
no cloud services, API keys, or paid subscriptions required.
|
|
52
|
+
|
|
53
|
+
## Status
|
|
54
|
+
|
|
55
|
+
Working local MCP server over stdio transport. All dataset processing and model
|
|
56
|
+
training run locally via scikit-learn, pandas, and numpy.
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
**Dataset tools**
|
|
61
|
+
- `list_datasets` -- list CSV datasets in the configured workspace (filename,
|
|
62
|
+
format, size).
|
|
63
|
+
- `inspect_dataset` -- load a CSV and report rows, columns, data types, missing
|
|
64
|
+
values, duplicate rows, numerical statistics, categorical summaries, and a
|
|
65
|
+
configurable preview.
|
|
66
|
+
- `analyze_correlations` -- Pearson/Spearman correlations among numerical
|
|
67
|
+
variables, strongest positive/negative pairs, constant/unsuitable columns.
|
|
68
|
+
- `analyze_data_quality` -- missing values, duplicates, constant columns,
|
|
69
|
+
suspected outliers (IQR), and preprocessing recommendations without modifying
|
|
70
|
+
the original data.
|
|
71
|
+
|
|
72
|
+
**Machine learning tools**
|
|
73
|
+
- `prepare_dataset` -- define target + task type; fit scikit-learn preprocessing
|
|
74
|
+
(imputation, encoding, scaling) on training data only; preserve the fitted
|
|
75
|
+
transform for prediction.
|
|
76
|
+
- `train_baseline` -- train logistic regression, decision tree, random forest
|
|
77
|
+
(classification) or linear/ridge regression, decision tree, random forest
|
|
78
|
+
(regression); train/test split with optional stratification; evaluation
|
|
79
|
+
metrics.
|
|
80
|
+
- `compare_models` -- train and compare multiple algorithms on consistent
|
|
81
|
+
splits; select the best by a user-specified metric (not accuracy by default
|
|
82
|
+
for every dataset).
|
|
83
|
+
- `export_model` -- save a fitted model with its preprocessing pipeline,
|
|
84
|
+
metadata, feature schema, hyperparameters, metrics, and package versions.
|
|
85
|
+
- `predict` -- load a previously exported local model, validate features,
|
|
86
|
+
generate predictions (+ probabilities where supported), handle schema
|
|
87
|
+
mismatches.
|
|
88
|
+
|
|
89
|
+
**System tools**
|
|
90
|
+
- `system_info` -- OS, CPU cores, RAM, storage, GPU detection, and whether a
|
|
91
|
+
GPU training backend is installed. scikit-learn runs on CPU by default.
|
|
92
|
+
|
|
93
|
+
## Supported algorithms
|
|
94
|
+
|
|
95
|
+
Classification: Logistic Regression, Decision Tree, Random Forest.
|
|
96
|
+
Regression: Linear Regression, Ridge Regression, Decision Tree, Random Forest.
|
|
97
|
+
|
|
98
|
+
## Architecture
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
devray-datalab-mcp/
|
|
102
|
+
├── src/devray_datalab/
|
|
103
|
+
│ ├── server.py # MCP stdio server, tool registry
|
|
104
|
+
│ ├── config.py # runtime configuration (env overridable)
|
|
105
|
+
│ ├── core/
|
|
106
|
+
│ │ ├── loader.py # CSV loading, dataset listing
|
|
107
|
+
│ │ ├── preprocessing.py # scikit-learn ColumnTransformer pipelines
|
|
108
|
+
│ │ ├── trainer.py # model training, job/resource constraints
|
|
109
|
+
│ │ ├── evaluator.py # classification/regression metrics
|
|
110
|
+
│ │ └── hardware.py # CPU/RAM/storage/GPU detection (psutil)
|
|
111
|
+
│ ├── tools/
|
|
112
|
+
│ │ ├── datasets.py # list_datasets, inspect_dataset
|
|
113
|
+
│ │ ├── analysis.py # correlations, data quality
|
|
114
|
+
│ │ ├── training.py # prepare_dataset, train_baseline, compare_models
|
|
115
|
+
│ │ ├── models.py # export_model, predict
|
|
116
|
+
│ │ ├── storage.py # joblib artifact persistence
|
|
117
|
+
│ │ └── system.py # system_info
|
|
118
|
+
│ └── utils/
|
|
119
|
+
│ ├── validation.py # path traversal protection, input validation
|
|
120
|
+
│ └── errors.py # structured error types
|
|
121
|
+
├── datasets/ # configured workspace (datasets)
|
|
122
|
+
├── artifacts/ # trained model artifacts
|
|
123
|
+
├── examples/ # example datasets
|
|
124
|
+
└── tests/ # pytest suite incl. stdio e2e
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- **Local only**: stdio transport; no network, no cloud.
|
|
128
|
+
- **Security**: all file access is confined to the workspace; path traversal is
|
|
129
|
+
blocked; file extensions/sizes validated; only artifacts created by this app
|
|
130
|
+
are loaded for prediction.
|
|
131
|
+
- **Resource management**: configurable CPU thread limits, training memory
|
|
132
|
+
budget, single concurrent training job, training timeouts, cooperative
|
|
133
|
+
cancellation.
|
|
134
|
+
- **No GPU deps**: PyTorch/TensorFlow/CUDA are not required or installed.
|
|
135
|
+
|
|
136
|
+
## Installation
|
|
137
|
+
|
|
138
|
+
### Prerequisites
|
|
139
|
+
|
|
140
|
+
Python 3.11+ (tested with 3.15).
|
|
141
|
+
|
|
142
|
+
### Installation methods
|
|
143
|
+
|
|
144
|
+
Choose one of the following:
|
|
145
|
+
|
|
146
|
+
#### Option A: Run directly with `uvx` (no install)
|
|
147
|
+
|
|
148
|
+
```powershell
|
|
149
|
+
uvx devray-datalab-mcp
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Option B: Install from PyPI into a virtual environment (recommended)
|
|
153
|
+
|
|
154
|
+
```powershell
|
|
155
|
+
# Windows PowerShell
|
|
156
|
+
python -m venv .venv
|
|
157
|
+
.venv\Scripts\Activate.ps1
|
|
158
|
+
pip install devray-datalab-mcp
|
|
159
|
+
devray-datalab-mcp
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Linux / macOS
|
|
164
|
+
python3 -m venv .venv
|
|
165
|
+
source .venv/bin/activate
|
|
166
|
+
pip install devray-datalab-mcp
|
|
167
|
+
devray-datalab-mcp
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Option C: Install from GitHub source
|
|
171
|
+
|
|
172
|
+
```powershell
|
|
173
|
+
# Windows PowerShell
|
|
174
|
+
python -m venv .venv
|
|
175
|
+
.venv\Scripts\Activate.ps1
|
|
176
|
+
pip install git+https://github.com/rayklanderman/devray-datalab-mcp.git
|
|
177
|
+
devray-datalab-mcp
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Linux / macOS
|
|
182
|
+
python3 -m venv .venv
|
|
183
|
+
source .venv/bin/activate
|
|
184
|
+
pip install git+https://github.com/rayklanderman/devray-datalab-mcp.git
|
|
185
|
+
devray-datalab-mcp
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### Option D: Editable install from a local clone (development)
|
|
189
|
+
|
|
190
|
+
```powershell
|
|
191
|
+
# Windows PowerShell
|
|
192
|
+
git clone https://github.com/rayklanderman/devray-datalab-mcp.git
|
|
193
|
+
cd devray-datalab-mcp
|
|
194
|
+
python -m venv .venv
|
|
195
|
+
.venv\Scripts\Activate.ps1
|
|
196
|
+
pip install -e .
|
|
197
|
+
pip install pytest ruff
|
|
198
|
+
devray-datalab-mcp --workspace ./datasets --artifacts ./artifacts
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Linux / macOS
|
|
203
|
+
git clone https://github.com/rayklanderman/devray-datalab-mcp.git
|
|
204
|
+
cd devray-datalab-mcp
|
|
205
|
+
python3 -m venv .venv
|
|
206
|
+
source .venv/bin/activate
|
|
207
|
+
pip install -e .
|
|
208
|
+
pip install pytest ruff
|
|
209
|
+
devray-datalab-mcp --workspace ./datasets --artifacts ./artifacts
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Exact Windows PowerShell installation commands
|
|
213
|
+
|
|
214
|
+
```powershell
|
|
215
|
+
python -m venv .venv
|
|
216
|
+
.venv\Scripts\Activate.ps1
|
|
217
|
+
pip install devray-datalab-mcp
|
|
218
|
+
devray-datalab-mcp
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Configuration via environment variables (see `.env.example`):
|
|
222
|
+
|
|
223
|
+
| Variable | Default | Meaning |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| `DEVRAY_WORKSPACE_DIR` | `datasets` | Dataset workspace directory |
|
|
226
|
+
| `DEVRAY_ARTIFACTS_DIR` | `artifacts` | Model artifacts directory |
|
|
227
|
+
| `DEVRAY_MAX_DATASET_SIZE_BYTES` | `209715200` (200 MB) | Max dataset upload size |
|
|
228
|
+
| `DEVRAY_MAX_PREVIEW_ROWS` | `25` | Max preview rows |
|
|
229
|
+
| `DEVRAY_MAX_CPU_THREADS` | (unset) | CPU thread limit for training |
|
|
230
|
+
| `DEVRAY_TRAINING_MEMORY_BUDGET_MB` | (unset) | Training memory budget |
|
|
231
|
+
| `DEVRAY_MAX_CONCURRENT_JOBS` | `1` | Max concurrent training jobs |
|
|
232
|
+
| `DEVRAY_TRAINING_TIMEOUT_SECONDS` | `1800` | Training timeout |
|
|
233
|
+
| `DEVRAY_LOG_LEVEL` | `INFO` | Log level (logs to stderr) |
|
|
234
|
+
|
|
235
|
+
## MCP client setup
|
|
236
|
+
|
|
237
|
+
The server speaks MCP over stdio. Logging/diagnostics go to stderr, so stdout
|
|
238
|
+
is reserved for MCP protocol messages.
|
|
239
|
+
|
|
240
|
+
### Example client configuration
|
|
241
|
+
|
|
242
|
+
The server speaks MCP over stdio. Logging/diagnostics go to stderr, so stdout
|
|
243
|
+
is reserved for MCP protocol messages. Replace `C:\path\to\project` with your
|
|
244
|
+
actual project directory, or use the published `devray-datalab-mcp` command
|
|
245
|
+
when installed from PyPI.
|
|
246
|
+
|
|
247
|
+
#### Kilo Code
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"mcpServers": {
|
|
252
|
+
"devray-datalab": {
|
|
253
|
+
"command": "C:\\path\\to\\project\\.venv\\Scripts\\python.exe",
|
|
254
|
+
"args": ["-m", "devray_datalab.server"],
|
|
255
|
+
"cwd": "C:\\path\\to\\project",
|
|
256
|
+
"env": {
|
|
257
|
+
"DEVRAY_WORKSPACE_DIR": "C:\\path\\to\\project\\datasets",
|
|
258
|
+
"DEVRAY_ARTIFACTS_DIR": "C:\\path\\to\\project\\artifacts"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### Cline / Cursor / Claude Desktop
|
|
266
|
+
|
|
267
|
+
These clients use the same `mcpServers` JSON structure:
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"mcpServers": {
|
|
272
|
+
"devray-datalab": {
|
|
273
|
+
"command": "devray-datalab-mcp",
|
|
274
|
+
"args": [],
|
|
275
|
+
"env": {
|
|
276
|
+
"DEVRAY_WORKSPACE_DIR": "C:\\path\\to\\project\\datasets",
|
|
277
|
+
"DEVRAY_ARTIFACTS_DIR": "C:\\path\\to\\project\\artifacts"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
When using the published `devray-datalab-mcp` command (installed from PyPI or
|
|
285
|
+
`uvx`), omit `cwd` and let the client resolve the executable from PATH. Set
|
|
286
|
+
`DEVRAY_WORKSPACE_DIR`/`DEVRAY_ARTIFACTS_DIR` to absolute paths outside the
|
|
287
|
+
project if you prefer dedicated dataset/artifact directories.
|
|
288
|
+
|
|
289
|
+
#### VS Code MCP-compatible tooling
|
|
290
|
+
|
|
291
|
+
Add the server to your VS Code MCP settings (`settings.json`):
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"mcp.servers": {
|
|
296
|
+
"devray-datalab": {
|
|
297
|
+
"command": "devray-datalab-mcp",
|
|
298
|
+
"args": [],
|
|
299
|
+
"env": {
|
|
300
|
+
"DEVRAY_WORKSPACE_DIR": "${workspaceFolder}/datasets",
|
|
301
|
+
"DEVRAY_ARTIFACTS_DIR": "${workspaceFolder}/artifacts"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### MCP Inspector
|
|
309
|
+
|
|
310
|
+
The official MCP Inspector can be used to test the server:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
npx @modelcontextprotocol/inspector
|
|
314
|
+
# Connect to: devray-datalab-mcp (stdio)
|
|
315
|
+
# Command: devray-datalab-mcp
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Dataset workspace configuration
|
|
319
|
+
|
|
320
|
+
Designate authorized local directories for datasets and model artifacts using
|
|
321
|
+
environment variables:
|
|
322
|
+
|
|
323
|
+
- `DEVRAY_WORKSPACE_DIR` -- directory containing CSV datasets (default: `datasets`).
|
|
324
|
+
- `DEVRAY_ARTIFACTS_DIR` -- directory where trained model artifacts are stored (default: `artifacts`).
|
|
325
|
+
|
|
326
|
+
Both directories are created automatically if missing. All file access is
|
|
327
|
+
confined to these directories; path traversal is blocked. Point them at absolute
|
|
328
|
+
paths outside your project if you want a shared workspace across clients.
|
|
329
|
+
|
|
330
|
+
Example (PowerShell):
|
|
331
|
+
|
|
332
|
+
```powershell
|
|
333
|
+
$env:DEVRAY_WORKSPACE_DIR="C:\ml-data\datasets"
|
|
334
|
+
$env:DEVRAY_ARTIFACTS_DIR="C:\ml-data\artifacts"
|
|
335
|
+
devray-datalab-mcp
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
## Available tools and example arguments
|
|
340
|
+
|
|
341
|
+
| Tool | Example arguments |
|
|
342
|
+
|---|---|
|
|
343
|
+
| `list_datasets` | `{}` |
|
|
344
|
+
| `inspect_dataset` | `{"name": "sample_classification.csv", "max_rows": 10}` |
|
|
345
|
+
| `analyze_correlations` | `{"name": "sample_classification.csv", "method": "pearson", "top_n": 5}` |
|
|
346
|
+
| `analyze_data_quality` | `{"name": "sample_classification.csv"}` |
|
|
347
|
+
| `prepare_dataset` | `{"name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification"}` |
|
|
348
|
+
| `train_baseline` | `{"name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification", "model_name": "random_forest", "random_state": 42}` |
|
|
349
|
+
| `compare_models` | `{"name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification", "models": ["logistic_regression", "random_forest"], "metric": "f1"}` |
|
|
350
|
+
| `export_model` | `{"artifact_name": "my_model", "name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification", "model_name": "random_forest"}` |
|
|
351
|
+
| `predict` | `{"artifact_name": "my_model", "features": {"age": 40, "income": 80000, "credit_score": 720, "category": "electronics", "region": "east"}}` |
|
|
352
|
+
| `system_info` | `{}` |
|
|
353
|
+
|
|
354
|
+
## Example machine learning workflow
|
|
355
|
+
|
|
356
|
+
Using `sample_classification.csv` (target `purchased`, binary classification):
|
|
357
|
+
|
|
358
|
+
1. **Inspect** the dataset:
|
|
359
|
+
`inspect_dataset` with `{"name": "sample_classification.csv"}`.
|
|
360
|
+
|
|
361
|
+
2. **Check data quality**:
|
|
362
|
+
`analyze_data_quality` with `{"name": "sample_classification.csv"}`.
|
|
363
|
+
|
|
364
|
+
3. **Check correlations**:
|
|
365
|
+
`analyze_correlations` with `{"name": "sample_classification.csv", "method": "pearson"}`.
|
|
366
|
+
|
|
367
|
+
4. **Train & compare** models:
|
|
368
|
+
`compare_models` with `{"name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification", "metric": "f1"}`.
|
|
369
|
+
|
|
370
|
+
5. **Export** the best model:
|
|
371
|
+
`export_model` with `{"artifact_name": "churn_model", "name": "sample_classification.csv", "target_column": "purchased", "task_type": "classification", "model_name": "random_forest"}`.
|
|
372
|
+
|
|
373
|
+
6. **Predict** on new data:
|
|
374
|
+
`predict` with `{"artifact_name": "churn_model", "features": {...}}`.
|
|
375
|
+
|
|
376
|
+
### Example regression workflow
|
|
377
|
+
|
|
378
|
+
Using `sample_regression.csv` (target `spend`, numeric target):
|
|
379
|
+
|
|
380
|
+
1. **Inspect** the dataset:
|
|
381
|
+
`inspect_dataset` with `{"name": "sample_regression.csv"}`.
|
|
382
|
+
2. **Check data quality**:
|
|
383
|
+
`analyze_data_quality` with `{"name": "sample_regression.csv"}`.
|
|
384
|
+
3. **Check correlations**:
|
|
385
|
+
`analyze_correlations` with `{"name": "sample_regression.csv", "method": "pearson"}`.
|
|
386
|
+
4. **Train & compare** models:
|
|
387
|
+
`compare_models` with `{"name": "sample_regression.csv", "target_column": "spend", "task_type": "regression", "metric": "r2"}`.
|
|
388
|
+
5. **Export** the best model:
|
|
389
|
+
`export_model` with `{"artifact_name": "spend_model", "name": "sample_regression.csv", "target_column": "spend", "task_type": "regression", "model_name": "random_forest"}`.
|
|
390
|
+
6. **Predict** spend on new data:
|
|
391
|
+
`predict` with `{"artifact_name": "spend_model", "features": {...}}`.
|
|
392
|
+
|
|
393
|
+
## Release links
|
|
394
|
+
|
|
395
|
+
- **GitHub repository:** https://github.com/rayklanderman/devray-datalab-mcp
|
|
396
|
+
- **GitHub releases:** https://github.com/rayklanderman/devray-datalab-mcp/releases
|
|
397
|
+
- **PyPI package:** https://pypi.org/project/devray-datalab-mcp/
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
## Example prompts
|
|
401
|
+
|
|
402
|
+
- "Inspect the sample_classification.csv dataset and tell me about missing values and column types."
|
|
403
|
+
- "Analyze correlations in sample_regression.csv between income and spend."
|
|
404
|
+
- "Train a random forest to predict 'purchased' from sample_classification.csv and compare it against logistic regression using F1."
|
|
405
|
+
- "Export the trained model as 'churn_model' and predict purchased for a 40-year-old in the east region with income 80000 and credit score 720."
|
|
406
|
+
- "Show me the CPU, RAM, and storage available for local training."
|
|
407
|
+
|
|
408
|
+
## Hardware requirements
|
|
409
|
+
|
|
410
|
+
- Designed for modest hardware (older Windows laptops with 8-16 GB RAM).
|
|
411
|
+
- CPU training is the default; scikit-learn does not use GPU acceleration by
|
|
412
|
+
default.
|
|
413
|
+
- No PyTorch, TensorFlow, or CUDA required.
|
|
414
|
+
- Dataset size limit defaults to 200 MB.
|
|
415
|
+
|
|
416
|
+
## Security and privacy
|
|
417
|
+
|
|
418
|
+
- All processing is local; no data leaves your machine.
|
|
419
|
+
- Datasets and artifacts are confined to the configured workspace/artifacts
|
|
420
|
+
directories.
|
|
421
|
+
- Path traversal and unauthorized filesystem access are blocked.
|
|
422
|
+
- Only CSV datasets are accepted; file size and extensions are validated.
|
|
423
|
+
- No arbitrary code or shell execution; no external downloads; no uploads to
|
|
424
|
+
third parties.
|
|
425
|
+
- Uploaded datasets and model artifacts are treated as untrusted; only artifacts
|
|
426
|
+
created and validated by this application are loaded for prediction.
|
|
427
|
+
- Original datasets are never overwritten without explicit permission.
|
|
428
|
+
|
|
429
|
+
## Limitations
|
|
430
|
+
|
|
431
|
+
- Single concurrent training job by default.
|
|
432
|
+
- scikit-learn models run on CPU; no GPU acceleration in this release.
|
|
433
|
+
- Classification stratification requires at least 2 samples per class.
|
|
434
|
+
- ROC-AUC is reported only for binary classification.
|
|
435
|
+
- CSV is the only supported dataset format.
|
|
436
|
+
- No built-in job queue/status polling tool; training runs within the tool call
|
|
437
|
+
with a configurable timeout.
|
|
438
|
+
- Cancellation is cooperative (checked during iterative training loops).
|
|
439
|
+
|
|
440
|
+
## Roadmap
|
|
441
|
+
|
|
442
|
+
- Optional GPU-accelerated backend plug-in (without redesigning MCP tools).
|
|
443
|
+
- Training job status/polling and cancellation via MCP progress mechanisms.
|
|
444
|
+
- Additional models (SVM, k-NN, gradient boosting).
|
|
445
|
+
- More preprocessing options and feature selection.
|
|
446
|
+
- Dataset profiling and automated preprocessing recommendations.
|
|
447
|
+
|
|
448
|
+
## Versioning and release notes
|
|
449
|
+
|
|
450
|
+
The project follows [semantic versioning](https://semver.org/). The current
|
|
451
|
+
release is `v0.1.0`. Releases are published to PyPI as
|
|
452
|
+
`devray-datalab-mcp` and registered in the MCP Registry as
|
|
453
|
+
`io.github.rayklanderman/devray-datalab-mcp`.
|
|
454
|
+
|
|
455
|
+
### v0.1.0 (initial release)
|
|
456
|
+
|
|
457
|
+
- Ten MCP tools: list_datasets, inspect_dataset, analyze_correlations,
|
|
458
|
+
analyze_data_quality, prepare_dataset, train_baseline, compare_models,
|
|
459
|
+
export_model, predict, system_info.
|
|
460
|
+
- Local-first stdio transport; scikit-learn CPU training.
|
|
461
|
+
- Path-traversal protection, dataset size/extension validation.
|
|
462
|
+
- 31 automated tests including a stdio end-to-end client test.
|
|
463
|
+
- GitHub Actions CI/CD and PyPI Trusted Publishing workflows.
|
|
464
|
+
|
|
465
|
+
## Contributing
|
|
466
|
+
|
|
467
|
+
1. Fork the repository.
|
|
468
|
+
2. Create a feature branch (`git checkout -b feature/...`).
|
|
469
|
+
3. Install dev dependencies: `pip install -e . pytest ruff`.
|
|
470
|
+
4. Run tests: `pytest` (or `.venv\Scripts\python.exe -m pytest` on Windows).
|
|
471
|
+
5. Run lint: `ruff check src/ tests/` and `ruff format src/ tests/`.
|
|
472
|
+
6. Commit with a concise message and open a pull request.
|
|
473
|
+
|
|
474
|
+
## License
|
|
475
|
+
|
|
476
|
+
MIT License. See `LICENSE`.
|