@iyulab/mloop-mcp 0.1.0 → 0.3.0
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.
- package/README.md +179 -178
- package/build/executor.d.ts.map +1 -1
- package/build/executor.js +6 -2
- package/build/executor.js.map +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +33 -2
- package/build/server.js.map +1 -1
- package/build/tools/analyze.d.ts +69 -0
- package/build/tools/analyze.d.ts.map +1 -0
- package/build/tools/analyze.js +103 -0
- package/build/tools/analyze.js.map +1 -0
- package/build/tools/auto-train.d.ts +63 -0
- package/build/tools/auto-train.d.ts.map +1 -0
- package/build/tools/auto-train.js +108 -0
- package/build/tools/auto-train.js.map +1 -0
- package/build/tools/evaluate.d.ts.map +1 -1
- package/build/tools/evaluate.js +8 -9
- package/build/tools/evaluate.js.map +1 -1
- package/build/tools/feedback.d.ts +64 -0
- package/build/tools/feedback.d.ts.map +1 -0
- package/build/tools/feedback.js +76 -0
- package/build/tools/feedback.js.map +1 -0
- package/build/tools/index.d.ts +44 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +28 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/info.d.ts +28 -0
- package/build/tools/info.d.ts.map +1 -1
- package/build/tools/info.js +35 -2
- package/build/tools/info.js.map +1 -1
- package/build/tools/init.d.ts +43 -0
- package/build/tools/init.d.ts.map +1 -0
- package/build/tools/init.js +58 -0
- package/build/tools/init.js.map +1 -0
- package/build/tools/logs.d.ts +49 -0
- package/build/tools/logs.d.ts.map +1 -0
- package/build/tools/logs.js +63 -0
- package/build/tools/logs.js.map +1 -0
- package/build/tools/predict.d.ts +8 -0
- package/build/tools/predict.d.ts.map +1 -1
- package/build/tools/predict.js +10 -1
- package/build/tools/predict.js.map +1 -1
- package/build/tools/prep.d.ts +42 -0
- package/build/tools/prep.d.ts.map +1 -0
- package/build/tools/prep.js +56 -0
- package/build/tools/prep.js.map +1 -0
- package/build/tools/project-overview.d.ts +42 -0
- package/build/tools/project-overview.d.ts.map +1 -0
- package/build/tools/project-overview.js +65 -0
- package/build/tools/project-overview.js.map +1 -0
- package/build/tools/quick-start.d.ts +64 -0
- package/build/tools/quick-start.d.ts.map +1 -0
- package/build/tools/quick-start.js +103 -0
- package/build/tools/quick-start.js.map +1 -0
- package/build/tools/sample.d.ts +64 -0
- package/build/tools/sample.d.ts.map +1 -0
- package/build/tools/sample.js +77 -0
- package/build/tools/sample.js.map +1 -0
- package/build/tools/train.d.ts +28 -0
- package/build/tools/train.d.ts.map +1 -1
- package/build/tools/train.js +30 -2
- package/build/tools/train.js.map +1 -1
- package/build/tools/trigger.d.ts +42 -0
- package/build/tools/trigger.d.ts.map +1 -0
- package/build/tools/trigger.js +56 -0
- package/build/tools/trigger.js.map +1 -0
- package/build/tools/validate.d.ts +35 -0
- package/build/tools/validate.d.ts.map +1 -0
- package/build/tools/validate.js +48 -0
- package/build/tools/validate.js.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,178 +1,179 @@
|
|
|
1
|
-
# mloop-mcp
|
|
2
|
-
|
|
3
|
-
MCP (Model Context Protocol) server for [MLoop](https://github.com/iyulab/MLoop) CLI.
|
|
4
|
-
|
|
5
|
-
Enables AI clients (Claude, Cursor, ironhive-cli) to perform MLOps tasks using MLoop's AutoML capabilities.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install -g @iyulab/mloop-mcp
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or run directly with npx:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx @iyulab/mloop-mcp
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Prerequisites
|
|
20
|
-
|
|
21
|
-
- Node.js 18+
|
|
22
|
-
- MLoop CLI installed and available in PATH
|
|
23
|
-
```bash
|
|
24
|
-
dotnet tool install -g mloop
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Custom MLoop Path
|
|
28
|
-
|
|
29
|
-
If MLoop is not in PATH, set the `MLOOP_PATH` environment variable:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Windows
|
|
33
|
-
set MLOOP_PATH=D:\lib\mloop.exe
|
|
34
|
-
|
|
35
|
-
# Linux/macOS
|
|
36
|
-
export MLOOP_PATH=/usr/local/bin/mloop
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Configuration
|
|
40
|
-
|
|
41
|
-
### For Claude Desktop
|
|
42
|
-
|
|
43
|
-
Add to your `claude_desktop_config.json`:
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"mcpServers": {
|
|
48
|
-
"mloop": {
|
|
49
|
-
"command": "npx",
|
|
50
|
-
"args": ["@iyulab/mloop-mcp"]
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### For ironhive-cli
|
|
57
|
-
|
|
58
|
-
Add to `.ironhive/plugins.yaml`:
|
|
59
|
-
|
|
60
|
-
```yaml
|
|
61
|
-
plugins:
|
|
62
|
-
mloop:
|
|
63
|
-
transport: stdio
|
|
64
|
-
command: npx
|
|
65
|
-
args:
|
|
66
|
-
- "@iyulab/mloop-mcp"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Available Tools
|
|
70
|
-
|
|
71
|
-
| Tool | Description |
|
|
72
|
-
|------|-------------|
|
|
73
|
-
| `mloop_train` | Train ML models using AutoML |
|
|
74
|
-
| `mloop_predict` | Run predictions with trained models |
|
|
75
|
-
| `mloop_list` | List experiments and their metrics |
|
|
76
|
-
| `mloop_promote` | Promote an experiment to production |
|
|
77
|
-
| `mloop_info` | Analyze and profile datasets |
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
# mloop-mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [MLoop](https://github.com/iyulab/MLoop) CLI.
|
|
4
|
+
|
|
5
|
+
Enables AI clients (Claude, Cursor, ironhive-cli) to perform MLOps tasks using MLoop's AutoML capabilities.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @iyulab/mloop-mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run directly with npx:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @iyulab/mloop-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js 18+
|
|
22
|
+
- MLoop CLI installed and available in PATH
|
|
23
|
+
```bash
|
|
24
|
+
dotnet tool install -g mloop
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Custom MLoop Path
|
|
28
|
+
|
|
29
|
+
If MLoop is not in PATH, set the `MLOOP_PATH` environment variable:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Windows
|
|
33
|
+
set MLOOP_PATH=D:\lib\mloop.exe
|
|
34
|
+
|
|
35
|
+
# Linux/macOS
|
|
36
|
+
export MLOOP_PATH=/usr/local/bin/mloop
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
### For Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to your `claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"mloop": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["@iyulab/mloop-mcp"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### For ironhive-cli
|
|
57
|
+
|
|
58
|
+
Add to `.ironhive/plugins.yaml`:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
plugins:
|
|
62
|
+
mloop:
|
|
63
|
+
transport: stdio
|
|
64
|
+
command: npx
|
|
65
|
+
args:
|
|
66
|
+
- "@iyulab/mloop-mcp"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Available Tools
|
|
70
|
+
|
|
71
|
+
| Tool | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| `mloop_train` | Train ML models using AutoML |
|
|
74
|
+
| `mloop_predict` | Run predictions with trained models |
|
|
75
|
+
| `mloop_list` | List experiments and their metrics |
|
|
76
|
+
| `mloop_promote` | Promote an experiment to production |
|
|
77
|
+
| `mloop_info` | Analyze and profile datasets |
|
|
78
|
+
| `mloop_analyze` | Run one read-only EDA aspect (profile/correlation/importance/outliers/distribution) as structured JSON |
|
|
79
|
+
| `mloop_status` | Show project status |
|
|
80
|
+
| `mloop_compare` | Compare multiple experiments |
|
|
81
|
+
| `mloop_evaluate` | Evaluate model performance |
|
|
82
|
+
| `mloop_serve` | Start REST API server |
|
|
83
|
+
|
|
84
|
+
## Tool Examples
|
|
85
|
+
|
|
86
|
+
### Train a model
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"tool": "mloop_train",
|
|
91
|
+
"arguments": {
|
|
92
|
+
"projectPath": "/path/to/project",
|
|
93
|
+
"dataFile": "datasets/train.csv",
|
|
94
|
+
"label": "target",
|
|
95
|
+
"task": "binary-classification",
|
|
96
|
+
"time": 60
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Run predictions
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"tool": "mloop_predict",
|
|
106
|
+
"arguments": {
|
|
107
|
+
"projectPath": "/path/to/project",
|
|
108
|
+
"dataFile": "datasets/test.csv",
|
|
109
|
+
"output": "predictions/output.csv"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### List experiments
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"tool": "mloop_list",
|
|
119
|
+
"arguments": {
|
|
120
|
+
"projectPath": "/path/to/project",
|
|
121
|
+
"showAll": true
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Promote to production
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"tool": "mloop_promote",
|
|
131
|
+
"arguments": {
|
|
132
|
+
"projectPath": "/path/to/project",
|
|
133
|
+
"experimentId": "exp-003",
|
|
134
|
+
"force": true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Analyze dataset
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"tool": "mloop_info",
|
|
144
|
+
"arguments": {
|
|
145
|
+
"dataFile": "datasets/train.csv",
|
|
146
|
+
"projectPath": "/path/to/project"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Install dependencies
|
|
155
|
+
npm install
|
|
156
|
+
|
|
157
|
+
# Build
|
|
158
|
+
npm run build
|
|
159
|
+
|
|
160
|
+
# Run locally
|
|
161
|
+
npm start
|
|
162
|
+
|
|
163
|
+
# Test with MCP Inspector
|
|
164
|
+
npx @modelcontextprotocol/inspector node build/index.js
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Architecture
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
ironhive-cli ──[MCP/STDIO]──> mloop-mcp ──[subprocess]──> mloop CLI ──> ML.NET
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
- **Pure Bridge Pattern**: 1:1 CLI mapping, no business logic, stateless
|
|
174
|
+
- **STDIO Transport**: Simple process communication
|
|
175
|
+
- **Subprocess Execution**: Each tool call spawns `mloop` CLI
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
package/build/executor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAYD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAYD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAmExB;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,EAAE,CAmBV;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAAE,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,EAAE,CAkBV"}
|
package/build/executor.js
CHANGED
|
@@ -24,10 +24,14 @@ export async function executeMloop(args, options = {}) {
|
|
|
24
24
|
const { cwd, timeout = DEFAULT_TIMEOUT, env } = options;
|
|
25
25
|
const mloopPath = getMloopPath();
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
|
-
|
|
27
|
+
// Build single command string for shell execution
|
|
28
|
+
// This avoids DEP0190 (passing args array with shell: true)
|
|
29
|
+
const quotedArgs = args.map(arg => arg.includes(' ') ? `"${arg}"` : arg);
|
|
30
|
+
const command = `${mloopPath} ${quotedArgs.join(' ')}`;
|
|
31
|
+
const proc = spawn(command, [], {
|
|
28
32
|
cwd,
|
|
29
33
|
env: { ...process.env, ...env },
|
|
30
|
-
shell: true, // Required for Windows
|
|
34
|
+
shell: true, // Required for Windows PATH resolution
|
|
31
35
|
windowsHide: true,
|
|
32
36
|
});
|
|
33
37
|
let stdout = '';
|
package/build/executor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBpE,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,YAAY;AAE7C;;;GAGG;AACH,SAAS,YAAY;IACnB,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC;AAC9C,CAAC;AAED;;;;;;;;GAQG;AACH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,MAA+B;IAE/B,MAAM,IAAI,GAAa,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;IAEhD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YAC7D,SAAS;QACX,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/build/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CA6KxC"}
|
package/build/server.js
CHANGED
|
@@ -2,15 +2,22 @@
|
|
|
2
2
|
* MCP Server for MLoop CLI
|
|
3
3
|
*/
|
|
4
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
// Existing tools
|
|
7
|
+
trainTool, train, trainSchema, predictTool, predict, predictSchema, listTool, list, listSchema, promoteTool, promote, promoteSchema, infoTool, info, infoSchema, statusTool, status, statusSchema, compareTool, compare, compareSchema, evaluateTool, evaluate, evaluateSchema, serveTool, serve, serveSchema,
|
|
8
|
+
// New basic tools
|
|
9
|
+
initTool, init, initSchema, validateTool, validate, validateSchema, prepTool, prep, prepSchema, logsTool, logs, logsSchema, feedbackTool, feedback, feedbackSchema, sampleTool, sample, sampleSchema, triggerTool, trigger, triggerSchema, analyzeTool, analyze, analyzeSchema,
|
|
10
|
+
// Composite workflow tools
|
|
11
|
+
quickStartTool, quickStart, quickStartSchema, autoTrainTool, autoTrain, autoTrainSchema, projectOverviewTool, projectOverview, projectOverviewSchema, } from './tools/index.js';
|
|
6
12
|
/**
|
|
7
13
|
* Create and configure the MCP server
|
|
8
14
|
*/
|
|
9
15
|
export function createServer() {
|
|
10
16
|
const server = new McpServer({
|
|
11
17
|
name: 'mloop-mcp',
|
|
12
|
-
version: '0.
|
|
18
|
+
version: '0.3.0',
|
|
13
19
|
});
|
|
20
|
+
// === Existing tools ===
|
|
14
21
|
// Register mloop_train
|
|
15
22
|
server.tool(trainTool.name, trainTool.description, trainSchema.shape, async (params) => train(params));
|
|
16
23
|
// Register mloop_predict
|
|
@@ -29,6 +36,30 @@ export function createServer() {
|
|
|
29
36
|
server.tool(evaluateTool.name, evaluateTool.description, evaluateSchema.shape, async (params) => evaluate(params));
|
|
30
37
|
// Register mloop_serve
|
|
31
38
|
server.tool(serveTool.name, serveTool.description, serveSchema.shape, async (params) => serve(params));
|
|
39
|
+
// === New basic tools ===
|
|
40
|
+
// Register mloop_init
|
|
41
|
+
server.tool(initTool.name, initTool.description, initSchema.shape, async (params) => init(params));
|
|
42
|
+
// Register mloop_validate
|
|
43
|
+
server.tool(validateTool.name, validateTool.description, validateSchema.shape, async (params) => validate(params));
|
|
44
|
+
// Register mloop_prep
|
|
45
|
+
server.tool(prepTool.name, prepTool.description, prepSchema.shape, async (params) => prep(params));
|
|
46
|
+
// Register mloop_logs
|
|
47
|
+
server.tool(logsTool.name, logsTool.description, logsSchema.shape, async (params) => logs(params));
|
|
48
|
+
// Register mloop_feedback
|
|
49
|
+
server.tool(feedbackTool.name, feedbackTool.description, feedbackSchema.shape, async (params) => feedback(params));
|
|
50
|
+
// Register mloop_sample
|
|
51
|
+
server.tool(sampleTool.name, sampleTool.description, sampleSchema.shape, async (params) => sample(params));
|
|
52
|
+
// Register mloop_trigger
|
|
53
|
+
server.tool(triggerTool.name, triggerTool.description, triggerSchema.shape, async (params) => trigger(params));
|
|
54
|
+
// Register mloop_analyze
|
|
55
|
+
server.tool(analyzeTool.name, analyzeTool.description, analyzeSchema.shape, async (params) => analyze(params));
|
|
56
|
+
// === Composite workflow tools ===
|
|
57
|
+
// Register mloop_quick_start
|
|
58
|
+
server.tool(quickStartTool.name, quickStartTool.description, quickStartSchema.shape, async (params) => quickStart(params));
|
|
59
|
+
// Register mloop_auto_train
|
|
60
|
+
server.tool(autoTrainTool.name, autoTrainTool.description, autoTrainSchema.shape, async (params) => autoTrain(params));
|
|
61
|
+
// Register mloop_project_overview
|
|
62
|
+
server.tool(projectOverviewTool.name, projectOverviewTool.description, projectOverviewSchema.shape, async (params) => projectOverview(params));
|
|
32
63
|
return server;
|
|
33
64
|
}
|
|
34
65
|
//# sourceMappingURL=server.js.map
|
package/build/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO;AACL,iBAAiB;AACjB,SAAS,EAAE,KAAK,EAAE,WAAW,EAC7B,W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
* 1:1 bridge to the `mloop analyze <aspect>` CLI command group. Each aspect is computed
|
|
5
|
+
* in isolation and returned as a structured JSON envelope ({aspect, available, summary,
|
|
6
|
+
* data, flags}) so an agent/LLM can read one analysis dimension at a time. Read-only:
|
|
7
|
+
* never mutates the data file or mloop.yaml.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const analyzeSchema: z.ZodObject<{
|
|
11
|
+
aspect: z.ZodEnum<["profile", "correlation", "importance", "outliers", "distribution"]>;
|
|
12
|
+
dataFile: z.ZodString;
|
|
13
|
+
projectPath: z.ZodOptional<z.ZodString>;
|
|
14
|
+
label: z.ZodOptional<z.ZodString>;
|
|
15
|
+
modelName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
dataFile: string;
|
|
18
|
+
aspect: "profile" | "correlation" | "importance" | "outliers" | "distribution";
|
|
19
|
+
projectPath?: string | undefined;
|
|
20
|
+
label?: string | undefined;
|
|
21
|
+
modelName?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
dataFile: string;
|
|
24
|
+
aspect: "profile" | "correlation" | "importance" | "outliers" | "distribution";
|
|
25
|
+
projectPath?: string | undefined;
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
modelName?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type AnalyzeParams = z.infer<typeof analyzeSchema>;
|
|
30
|
+
export declare function analyze(params: AnalyzeParams): Promise<{
|
|
31
|
+
content: Array<{
|
|
32
|
+
type: 'text';
|
|
33
|
+
text: string;
|
|
34
|
+
}>;
|
|
35
|
+
isError?: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const analyzeTool: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: string;
|
|
42
|
+
properties: {
|
|
43
|
+
aspect: {
|
|
44
|
+
type: string;
|
|
45
|
+
enum: string[];
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
dataFile: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
projectPath: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
label: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
modelName: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
required: string[];
|
|
66
|
+
};
|
|
67
|
+
handler: typeof analyze;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAoBxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAsB,OAAO,CAC3B,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAsChF;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_analyze tool - Granular, read-only EDA aspects for feature-engineering decisions.
|
|
3
|
+
*
|
|
4
|
+
* 1:1 bridge to the `mloop analyze <aspect>` CLI command group. Each aspect is computed
|
|
5
|
+
* in isolation and returned as a structured JSON envelope ({aspect, available, summary,
|
|
6
|
+
* data, flags}) so an agent/LLM can read one analysis dimension at a time. Read-only:
|
|
7
|
+
* never mutates the data file or mloop.yaml.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { executeMloop, buildArgsWithPositional } from '../executor.js';
|
|
11
|
+
import { parseCliOutput } from '../utils/parser.js';
|
|
12
|
+
import { formatError } from '../utils/errors.js';
|
|
13
|
+
export const analyzeSchema = z.object({
|
|
14
|
+
aspect: z
|
|
15
|
+
.enum(['profile', 'correlation', 'importance', 'outliers', 'distribution'])
|
|
16
|
+
.describe('EDA aspect to compute: "profile" (column types, null %, cardinality, constant columns), ' +
|
|
17
|
+
'"correlation" (high-correlation pairs + multicollinearity), ' +
|
|
18
|
+
'"importance" (feature-importance ranking, requires a label), ' +
|
|
19
|
+
'"outliers" (count/rate/isolation-forest threshold), ' +
|
|
20
|
+
'"distribution" (skewness/kurtosis/normality tests)'),
|
|
21
|
+
dataFile: z.string().describe('Path to the CSV dataset to analyze'),
|
|
22
|
+
projectPath: z.string().optional().describe('MLoop project path (for resolving relative paths)'),
|
|
23
|
+
label: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Label/target column name (overrides mloop.yaml; required for the "importance" aspect)'),
|
|
27
|
+
modelName: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Model name to read label configuration from mloop.yaml (default: "default")'),
|
|
31
|
+
});
|
|
32
|
+
export async function analyze(params) {
|
|
33
|
+
try {
|
|
34
|
+
const { aspect, dataFile, projectPath, label, modelName } = params;
|
|
35
|
+
const cliParams = {};
|
|
36
|
+
if (label)
|
|
37
|
+
cliParams['label'] = label;
|
|
38
|
+
if (modelName)
|
|
39
|
+
cliParams['name'] = modelName;
|
|
40
|
+
// Always emit the structured JSON envelope for LLM consumption.
|
|
41
|
+
cliParams['json'] = true;
|
|
42
|
+
const args = buildArgsWithPositional('analyze', [aspect, dataFile], cliParams);
|
|
43
|
+
const result = await executeMloop(args, {
|
|
44
|
+
cwd: projectPath,
|
|
45
|
+
timeout: 600_000, // 10 minutes: importance/distribution can run statistical analysis
|
|
46
|
+
});
|
|
47
|
+
const output = parseCliOutput(result.stdout);
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: output || `No ${aspect} analysis available.`,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: formatError(error),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
isError: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const analyzeTool = {
|
|
70
|
+
name: 'mloop_analyze',
|
|
71
|
+
description: 'Run a single, read-only exploratory-data-analysis (EDA) aspect on a dataset and return a ' +
|
|
72
|
+
'structured JSON envelope for feature-engineering decisions. Aspects: profile, correlation, ' +
|
|
73
|
+
'importance (needs a label), outliers, distribution. Never mutates the data file or mloop.yaml.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
aspect: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
enum: ['profile', 'correlation', 'importance', 'outliers', 'distribution'],
|
|
80
|
+
description: 'EDA aspect: "profile" (types/null%/cardinality/constant), "correlation" (high-correlation pairs + multicollinearity), "importance" (feature ranking, requires a label), "outliers" (count/rate/isolation-forest threshold), "distribution" (skewness/kurtosis/normality).',
|
|
81
|
+
},
|
|
82
|
+
dataFile: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Path to the CSV dataset to analyze',
|
|
85
|
+
},
|
|
86
|
+
projectPath: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'MLoop project path for resolving relative paths',
|
|
89
|
+
},
|
|
90
|
+
label: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'Label/target column name (overrides mloop.yaml; required for the "importance" aspect)',
|
|
93
|
+
},
|
|
94
|
+
modelName: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
description: 'Model name to read label configuration from mloop.yaml (default: "default")',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
required: ['aspect', 'dataFile'],
|
|
100
|
+
},
|
|
101
|
+
handler: analyze,
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=analyze.js.map
|