@iyulab/mloop-mcp 0.11.2 → 0.12.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.
Files changed (150) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +28 -3
  3. package/build/executor.d.ts +27 -2
  4. package/build/executor.d.ts.map +1 -1
  5. package/build/executor.js +105 -22
  6. package/build/executor.js.map +1 -1
  7. package/build/index.js +10 -16
  8. package/build/index.js.map +1 -1
  9. package/build/package-info.js.map +1 -1
  10. package/build/server.d.ts +1 -1
  11. package/build/server.d.ts.map +1 -1
  12. package/build/server.js +40 -67
  13. package/build/server.js.map +1 -1
  14. package/build/tools/analyze.d.ts +2 -29
  15. package/build/tools/analyze.d.ts.map +1 -1
  16. package/build/tools/analyze.js +0 -28
  17. package/build/tools/analyze.js.map +1 -1
  18. package/build/tools/auto-train.d.ts +2 -27
  19. package/build/tools/auto-train.d.ts.map +1 -1
  20. package/build/tools/auto-train.js +6 -36
  21. package/build/tools/auto-train.js.map +1 -1
  22. package/build/tools/calibrate.d.ts +1 -36
  23. package/build/tools/calibrate.d.ts.map +1 -1
  24. package/build/tools/calibrate.js +0 -13
  25. package/build/tools/calibrate.js.map +1 -1
  26. package/build/tools/compare.d.ts +0 -22
  27. package/build/tools/compare.d.ts.map +1 -1
  28. package/build/tools/compare.js +1 -21
  29. package/build/tools/compare.js.map +1 -1
  30. package/build/tools/detect.d.ts +0 -26
  31. package/build/tools/detect.d.ts.map +1 -1
  32. package/build/tools/detect.js +0 -26
  33. package/build/tools/detect.js.map +1 -1
  34. package/build/tools/drift.d.ts +0 -22
  35. package/build/tools/drift.d.ts.map +1 -1
  36. package/build/tools/drift.js +0 -10
  37. package/build/tools/drift.js.map +1 -1
  38. package/build/tools/embed.d.ts +25 -0
  39. package/build/tools/embed.d.ts.map +1 -0
  40. package/build/tools/embed.js +49 -0
  41. package/build/tools/embed.js.map +1 -0
  42. package/build/tools/encoder.d.ts +27 -0
  43. package/build/tools/encoder.d.ts.map +1 -0
  44. package/build/tools/encoder.js +42 -0
  45. package/build/tools/encoder.js.map +1 -0
  46. package/build/tools/evaluate.d.ts +0 -34
  47. package/build/tools/evaluate.d.ts.map +1 -1
  48. package/build/tools/evaluate.js +18 -44
  49. package/build/tools/evaluate.js.map +1 -1
  50. package/build/tools/export-onnx.d.ts +0 -30
  51. package/build/tools/export-onnx.d.ts.map +1 -1
  52. package/build/tools/export-onnx.js +0 -12
  53. package/build/tools/export-onnx.js.map +1 -1
  54. package/build/tools/features-select.d.ts +0 -26
  55. package/build/tools/features-select.d.ts.map +1 -1
  56. package/build/tools/features-select.js +0 -26
  57. package/build/tools/features-select.js.map +1 -1
  58. package/build/tools/feedback.d.ts +1 -37
  59. package/build/tools/feedback.d.ts.map +1 -1
  60. package/build/tools/feedback.js +0 -36
  61. package/build/tools/feedback.js.map +1 -1
  62. package/build/tools/index.d.ts +3 -88
  63. package/build/tools/index.d.ts.map +1 -1
  64. package/build/tools/index.js +3 -36
  65. package/build/tools/index.js.map +1 -1
  66. package/build/tools/info.d.ts +0 -30
  67. package/build/tools/info.d.ts.map +1 -1
  68. package/build/tools/info.js +1 -32
  69. package/build/tools/info.js.map +1 -1
  70. package/build/tools/init.d.ts +0 -15
  71. package/build/tools/init.d.ts.map +1 -1
  72. package/build/tools/init.js +0 -15
  73. package/build/tools/init.js.map +1 -1
  74. package/build/tools/list.d.ts +0 -18
  75. package/build/tools/list.d.ts.map +1 -1
  76. package/build/tools/list.js +0 -18
  77. package/build/tools/list.js.map +1 -1
  78. package/build/tools/logs.d.ts +0 -18
  79. package/build/tools/logs.d.ts.map +1 -1
  80. package/build/tools/logs.js +1 -18
  81. package/build/tools/logs.js.map +1 -1
  82. package/build/tools/predict.d.ts +2 -37
  83. package/build/tools/predict.d.ts.map +1 -1
  84. package/build/tools/predict.js +1 -36
  85. package/build/tools/predict.js.map +1 -1
  86. package/build/tools/prep-plan.d.ts +0 -26
  87. package/build/tools/prep-plan.d.ts.map +1 -1
  88. package/build/tools/prep-plan.js +0 -26
  89. package/build/tools/prep-plan.js.map +1 -1
  90. package/build/tools/prep.d.ts +0 -26
  91. package/build/tools/prep.d.ts.map +1 -1
  92. package/build/tools/prep.js +0 -26
  93. package/build/tools/prep.js.map +1 -1
  94. package/build/tools/project-overview.d.ts +0 -14
  95. package/build/tools/project-overview.d.ts.map +1 -1
  96. package/build/tools/project-overview.js +4 -19
  97. package/build/tools/project-overview.js.map +1 -1
  98. package/build/tools/promote.d.ts +0 -34
  99. package/build/tools/promote.d.ts.map +1 -1
  100. package/build/tools/promote.js +0 -34
  101. package/build/tools/promote.js.map +1 -1
  102. package/build/tools/quick-start.d.ts +2 -28
  103. package/build/tools/quick-start.d.ts.map +1 -1
  104. package/build/tools/quick-start.js +6 -40
  105. package/build/tools/quick-start.js.map +1 -1
  106. package/build/tools/rollback.d.ts +0 -18
  107. package/build/tools/rollback.d.ts.map +1 -1
  108. package/build/tools/rollback.js +0 -9
  109. package/build/tools/rollback.js.map +1 -1
  110. package/build/tools/sample.d.ts +0 -39
  111. package/build/tools/sample.d.ts.map +1 -1
  112. package/build/tools/sample.js +0 -39
  113. package/build/tools/sample.js.map +1 -1
  114. package/build/tools/serve.d.ts +0 -18
  115. package/build/tools/serve.d.ts.map +1 -1
  116. package/build/tools/serve.js +49 -59
  117. package/build/tools/serve.js.map +1 -1
  118. package/build/tools/status.d.ts +0 -10
  119. package/build/tools/status.d.ts.map +1 -1
  120. package/build/tools/status.js +1 -11
  121. package/build/tools/status.js.map +1 -1
  122. package/build/tools/threshold.d.ts +0 -38
  123. package/build/tools/threshold.d.ts.map +1 -1
  124. package/build/tools/threshold.js +0 -14
  125. package/build/tools/threshold.js.map +1 -1
  126. package/build/tools/token.d.ts +27 -0
  127. package/build/tools/token.d.ts.map +1 -0
  128. package/build/tools/token.js +49 -0
  129. package/build/tools/token.js.map +1 -0
  130. package/build/tools/train.d.ts +2 -67
  131. package/build/tools/train.d.ts.map +1 -1
  132. package/build/tools/train.js +8 -77
  133. package/build/tools/train.js.map +1 -1
  134. package/build/tools/trigger.d.ts +0 -14
  135. package/build/tools/trigger.d.ts.map +1 -1
  136. package/build/tools/trigger.js +1 -15
  137. package/build/tools/trigger.js.map +1 -1
  138. package/build/tools/validate.d.ts +0 -10
  139. package/build/tools/validate.d.ts.map +1 -1
  140. package/build/tools/validate.js +1 -11
  141. package/build/tools/validate.js.map +1 -1
  142. package/build/training-run.d.ts +33 -0
  143. package/build/training-run.d.ts.map +1 -0
  144. package/build/training-run.js +107 -0
  145. package/build/training-run.js.map +1 -0
  146. package/build/utils/errors.d.ts +6 -0
  147. package/build/utils/errors.d.ts.map +1 -1
  148. package/build/utils/errors.js +22 -1
  149. package/build/utils/errors.js.map +1 -1
  150. package/package.json +6 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@iyulab/mloop-mcp` are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
5
+ Releases before 0.11.3 are described by their commits. 0.12.0 includes the 0.11.3 fix.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.12.0] - 2026-10-26
10
+
11
+ Every tool works with `mloop` 0.40 or later; `mloop_train`, `mloop_auto_train` and `mloop_quick_start` report
12
+ whether the experiment was promoted with `mloop` 0.46.0 or later.
13
+
14
+ ### Added
15
+
16
+ - `mloop_token` issues the bearer token a server started with `mloop_serve` requires on every endpoint but
17
+ `/health`; `mloop_embed` turns images or texts into vectors with the encoder's identity; `mloop_encoder` lists,
18
+ installs and removes the pretrained encoders.
19
+ - The server speaks both MCP protocol eras over stdio: a client opening with `initialize` (2025-11-25 and earlier)
20
+ and a 2026-07-28 client opening with `server/discover` (MCP TypeScript SDK v2).
21
+ - `mloop_train`, `mloop_auto_train` and `mloop_quick_start` report progress: a call that carries a progress token
22
+ gets a notification for each phase and, at most once a second, for the trial just finished, with the time so far
23
+ and the budget.
24
+ - Cancelling a tool call stops the command it runs — the whole process group, so a cancelled training run does not
25
+ keep going in the background.
26
+
27
+ ### Changed
28
+
29
+ - `mloop_train` answers the run's own result as JSON — `result` (experiment id, trainer, metrics, the model and
30
+ report paths), `promotion` (`promoted`, `keptInStagingReason`) and `warnings` — instead of its console text, and a
31
+ failed run answers the run's error messages. `mloop_auto_train` and `mloop_quick_start` carry the same in their
32
+ answers; `mloop_quick_start` no longer reads the experiment id and promotion out of the console text.
33
+ - `mloop_compare`, `mloop_info`, `mloop_logs`, `mloop_status`, `mloop_validate`, `mloop_project_overview` and
34
+ `mloop_auto_train`'s experiment list answer the command's JSON (`--json`) instead of console tables. A command
35
+ that fails with a structured answer — `mloop_validate` on an invalid `mloop.yaml` — returns that JSON as the error.
36
+ - No tool has a fixed wall-clock limit any more: commands whose duration follows the data (predict, evaluate,
37
+ analyze, info) were stopped after 5 or 10 minutes. A command is now stopped when its call is cancelled or when it
38
+ writes nothing for 20 minutes; a training run with `time` also when it runs well past its budget (the budget plus
39
+ 10 minutes, or half again for budgets over 20 minutes). `executeMloop` has no default `timeout`, and takes
40
+ `idleTimeout`, `signal` and `onStdoutLine`.
41
+ - Built with TypeScript 7.
42
+
43
+ ### Fixed
44
+
45
+ - `mloop_evaluate` given a test file without an experiment dropped the file — the CLI takes it only after an
46
+ experiment id — and evaluated on `datasets/test.csv` or failed. It now evaluates production on that file.
47
+ - `mloop_train` and `mloop_auto_train` stopped a run after 10 and 20 minutes whatever its `time`, so a run asked
48
+ for an hour was killed a sixth of the way in.
49
+ - `mloop_serve` answered that the server was running in the background after its 5-second timeout — which is what
50
+ stopped it. It now starts the server detached, waits for `/health`, and returns the URL, process id, log file and
51
+ the command that stops it; a server that exits first, or does not answer within a minute, is an error carrying its
52
+ output.
53
+
54
+ ### Removed
55
+
56
+ - The hand-written JSON Schema copies (`*InputSchema`) and the `allTools` list exported from `./tools`: the server
57
+ registers the zod schemas, and `tools/list` is unchanged. Import the `*Schema` zod objects instead.
58
+
59
+ ## [0.11.3] - 2026-10-25
60
+
61
+ ### Security
62
+
63
+ - Tool arguments reached the CLI through a shell, with only values containing a space quoted: a quote, `$(…)`, a
64
+ backtick or a semicolon in any value a caller passed — a file name, a label, a text — ran as a shell command with
65
+ the server's privileges. The CLI is now started without a shell, with its arguments passed as given. Every release
66
+ before 0.11.3 is affected; 0.11.3 is 0.11.2 with this fix (and the lockfile's patched body-parser).
package/README.md CHANGED
@@ -16,10 +16,14 @@ Or run directly with npx:
16
16
  npx @iyulab/mloop-mcp
17
17
  ```
18
18
 
19
+ The server speaks MCP over stdio in both protocol eras: a client opening with `initialize` (2025-11-25 and
20
+ earlier) and a 2026-07-28 client opening with `server/discover`.
21
+
19
22
  ## Prerequisites
20
23
 
21
- - Node.js 18+
22
- - MLoop CLI installed and available in PATH
24
+ - Node.js 22+
25
+ - MLoop CLI 0.40 or later, installed and available in PATH (0.46.0 or later for the training tools to report
26
+ whether the experiment was promoted)
23
27
  ```bash
24
28
  dotnet tool install -g mloop
25
29
  ```
@@ -87,7 +91,10 @@ plugins:
87
91
  | `mloop_status` | Show project status |
88
92
  | `mloop_compare` | Compare multiple experiments |
89
93
  | `mloop_evaluate` | Evaluate model performance as JSON; with `against`, compare two models row by row on the same rows (mloop >= 0.39) |
90
- | `mloop_serve` | Start REST API server |
94
+ | `mloop_serve` | Start the REST API server; returns once it answers `/health`, and leaves it running |
95
+ | `mloop_token` | Issue the bearer token the server requires on every endpoint but `/health` (`role: admin` for writes) |
96
+ | `mloop_embed` | Images or texts to vectors with a pretrained encoder, with the encoder's identity (texts: mloop >= 0.46) |
97
+ | `mloop_encoder` | List, install (catalog: `dinov2-small`, `multilingual-minilm`) or remove pretrained encoders |
91
98
 
92
99
  ## Tool Examples
93
100
 
@@ -106,6 +113,24 @@ plugins:
106
113
  }
107
114
  ```
108
115
 
116
+ The answer is the run's own result as JSON — `result` (experiment id, trainer, metrics, where the model and its
117
+ report are) and the `warnings` the run raised. A call that carries a progress token gets a progress notification for
118
+ each phase and, at most once a second, for the trial just finished (`trial 12: FastForest r_squared 0.8828 · 4.1 s of a
119
+ 60 s budget`). Cancelling the call stops the training process. A run with `time` is stopped well past its budget
120
+ (the budget plus 10 minutes, or half again for budgets over 20 minutes); one without `time` sizes its own budget, so
121
+ it is stopped only when it writes nothing for 20 minutes. `mloop_auto_train` and `mloop_quick_start` train the same
122
+ way, and the answer carries `promotion` — whether the experiment went to production, and why not (`mloop` 0.46.0
123
+ and later).
124
+
125
+ Every other tool runs its command with no wall-clock limit (how long it takes follows the data) and stops it when
126
+ the call is cancelled or the command writes nothing for 20 minutes. `mloop_serve` returns once the server answers
127
+ `/health` and leaves it running, naming its URL, process id, log file and the command that stops it.
128
+
129
+ Tools answer the CLI's own JSON (`--json`) wherever the command has it — `mloop_list`, `mloop_compare`,
130
+ `mloop_info`, `mloop_status`, `mloop_validate`, `mloop_logs` and the rest — so an agent reads fields rather than
131
+ console tables. A command that fails with a structured answer (an invalid `mloop.yaml`, say) returns that JSON
132
+ as the error.
133
+
109
134
  ### Run predictions
110
135
 
111
136
  ```json
@@ -1,11 +1,24 @@
1
1
  /**
2
2
  * CLI subprocess executor for mloop commands
3
3
  */
4
+ import { type ChildProcess } from 'child_process';
4
5
  export interface ExecuteOptions {
5
6
  /** Working directory for command execution */
6
7
  cwd?: string;
7
- /** Timeout in milliseconds (default: 300000 = 5 minutes) */
8
- timeout?: number;
8
+ /**
9
+ * Wall-clock bound in milliseconds; none by default — how long a command takes follows its data, and the caller
10
+ * can cancel (see `signal`).
11
+ */
12
+ timeout?: number | null;
13
+ /**
14
+ * Stops the command when it has written nothing for this long, in milliseconds (default 20 minutes) — what tells a
15
+ * stalled command from a long one.
16
+ */
17
+ idleTimeout?: number;
18
+ /** Stops the command when aborted; defaults to the signal of the tool call being answered ({@link withRequestSignal}). */
19
+ signal?: AbortSignal;
20
+ /** Called with each complete line the command writes to stdout, as it arrives. */
21
+ onStdoutLine?: (line: string) => void;
9
22
  /** Environment variables to pass */
10
23
  env?: Record<string, string>;
11
24
  }
@@ -14,6 +27,11 @@ export interface ExecuteResult {
14
27
  stderr: string;
15
28
  exitCode: number;
16
29
  }
30
+ /**
31
+ * Runs `work` with `signal` as the cancellation of every command it executes — the server wraps each tool call in the
32
+ * call's own signal, so cancelling a call stops the command it is waiting on, whichever tool runs it.
33
+ */
34
+ export declare function withRequestSignal<T>(signal: AbortSignal, work: () => Promise<T>): Promise<T>;
17
35
  /**
18
36
  * Execute mloop CLI command
19
37
  *
@@ -24,6 +42,13 @@ export interface ExecuteResult {
24
42
  * @throws TimeoutError if command times out
25
43
  */
26
44
  export declare function executeMloop(args: string[], options?: ExecuteOptions): Promise<ExecuteResult>;
45
+ /**
46
+ * Starts mloop and leaves it running after this server returns — `mloop serve`. Its output goes to `logFile`; the
47
+ * caller watches the returned process only for an early exit.
48
+ */
49
+ export declare function startMloopDetached(args: string[], cwd: string | undefined, logFile: string): ChildProcess;
50
+ /** Stops a process started by {@link startMloopDetached} — and what it started. */
51
+ export declare function stopMloop(proc: ChildProcess): void;
27
52
  /**
28
53
  * Build CLI arguments from a parameter object
29
54
  * Handles common patterns like --flag, --key=value
@@ -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,c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,EAAE,EACd,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAwFxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CASzG;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAElD;AAgCD;;;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
@@ -2,8 +2,18 @@
2
2
  * CLI subprocess executor for mloop commands
3
3
  */
4
4
  import { spawn } from 'child_process';
5
- import { CliExecutionError, TimeoutError } from './utils/errors.js';
6
- const DEFAULT_TIMEOUT = 300_000; // 5 minutes
5
+ import { AsyncLocalStorage } from 'node:async_hooks';
6
+ import { openSync, closeSync } from 'node:fs';
7
+ import { CancelledError, CliExecutionError, TimeoutError } from './utils/errors.js';
8
+ const DEFAULT_IDLE_TIMEOUT = 20 * 60_000;
9
+ const requestSignal = new AsyncLocalStorage();
10
+ /**
11
+ * Runs `work` with `signal` as the cancellation of every command it executes — the server wraps each tool call in the
12
+ * call's own signal, so cancelling a call stops the command it is waiting on, whichever tool runs it.
13
+ */
14
+ export function withRequestSignal(signal, work) {
15
+ return requestSignal.run(signal, work);
16
+ }
7
17
  /**
8
18
  * Get the mloop executable path.
9
19
  * Uses MLOOP_PATH environment variable if set, otherwise defaults to 'mloop'.
@@ -21,41 +31,68 @@ function getMloopPath() {
21
31
  * @throws TimeoutError if command times out
22
32
  */
23
33
  export async function executeMloop(args, options = {}) {
24
- const { cwd, timeout = DEFAULT_TIMEOUT, env } = options;
25
- const mloopPath = getMloopPath();
34
+ const { cwd, timeout = null, idleTimeout = DEFAULT_IDLE_TIMEOUT, onStdoutLine, env } = options;
35
+ const signal = options.signal ?? requestSignal.getStore();
36
+ if (signal?.aborted)
37
+ throw new CancelledError();
26
38
  return new Promise((resolve, reject) => {
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, [], {
32
- cwd,
33
- env: { ...process.env, ...env },
34
- shell: true, // Required for Windows PATH resolution
35
- windowsHide: true,
36
- });
39
+ const proc = spawnMloop(args, cwd, env, ['pipe', 'pipe', 'pipe']);
37
40
  let stdout = '';
38
41
  let stderr = '';
42
+ let pending = '';
39
43
  let killed = false;
40
- const timeoutId = setTimeout(() => {
44
+ const stop = (error) => {
45
+ if (killed)
46
+ return;
41
47
  killed = true;
42
- proc.kill('SIGTERM');
43
- reject(new TimeoutError(`Command timed out after ${timeout}ms`, timeout));
44
- }, timeout);
48
+ clearTimers();
49
+ killTree(proc.pid);
50
+ reject(error);
51
+ };
52
+ const timeoutId = timeout == null
53
+ ? undefined
54
+ : setTimeout(() => stop(new TimeoutError(`Command timed out after ${timeout}ms`, timeout)), timeout);
55
+ let idleId;
56
+ const touch = () => {
57
+ if (idleTimeout === undefined)
58
+ return;
59
+ clearTimeout(idleId);
60
+ idleId = setTimeout(() => stop(new TimeoutError(`Command wrote nothing for ${idleTimeout}ms`, idleTimeout)), idleTimeout);
61
+ };
62
+ const onAbort = () => stop(new CancelledError());
63
+ const clearTimers = () => {
64
+ clearTimeout(timeoutId);
65
+ clearTimeout(idleId);
66
+ signal?.removeEventListener('abort', onAbort);
67
+ };
68
+ signal?.addEventListener('abort', onAbort, { once: true });
69
+ touch();
45
70
  proc.stdout?.on('data', (data) => {
46
- stdout += data.toString();
71
+ const text = data.toString();
72
+ stdout += text;
73
+ touch();
74
+ if (!onStdoutLine)
75
+ return;
76
+ pending += text;
77
+ const lines = pending.split('\n');
78
+ pending = lines.pop() ?? '';
79
+ for (const line of lines)
80
+ onStdoutLine(line.replace(/\r$/, ''));
47
81
  });
48
82
  proc.stderr?.on('data', (data) => {
49
83
  stderr += data.toString();
84
+ touch();
50
85
  });
51
86
  proc.on('error', (error) => {
52
- clearTimeout(timeoutId);
87
+ clearTimers();
53
88
  reject(new CliExecutionError(`Failed to execute mloop: ${error.message}`, -1, stdout, stderr));
54
89
  });
55
90
  proc.on('close', (code) => {
56
- clearTimeout(timeoutId);
91
+ clearTimers();
57
92
  if (killed)
58
- return; // Already handled by timeout
93
+ return; // Already rejected: timed out, idle or cancelled
94
+ if (onStdoutLine && pending)
95
+ onStdoutLine(pending.replace(/\r$/, ''));
59
96
  const exitCode = code ?? 0;
60
97
  const result = { stdout, stderr, exitCode };
61
98
  if (exitCode !== 0) {
@@ -67,6 +104,52 @@ export async function executeMloop(args, options = {}) {
67
104
  });
68
105
  });
69
106
  }
107
+ /**
108
+ * Starts mloop and leaves it running after this server returns — `mloop serve`. Its output goes to `logFile`; the
109
+ * caller watches the returned process only for an early exit.
110
+ */
111
+ export function startMloopDetached(args, cwd, logFile) {
112
+ const log = openSync(logFile, 'a');
113
+ try {
114
+ const proc = spawnMloop(args, cwd, undefined, ['ignore', log, log]);
115
+ proc.unref();
116
+ return proc;
117
+ }
118
+ finally {
119
+ closeSync(log);
120
+ }
121
+ }
122
+ /** Stops a process started by {@link startMloopDetached} — and what it started. */
123
+ export function stopMloop(proc) {
124
+ killTree(proc.pid);
125
+ }
126
+ function spawnMloop(args, cwd, env, stdio) {
127
+ // No shell: every argument reaches mloop exactly as given. Through a shell, a text, a file name or a label the
128
+ // caller passed was parsed as shell syntax — a quote or a `$(…)` in it ran as a command. The CLI is an executable
129
+ // on every platform (a dotnet tool installs `mloop.exe` on Windows), which spawn finds on PATH without one.
130
+ return spawn(getMloopPath(), args, {
131
+ cwd,
132
+ env: { ...process.env, ...env },
133
+ windowsHide: true,
134
+ stdio,
135
+ // Its own process group, so stopping it stops mloop and whatever it started.
136
+ detached: process.platform !== 'win32',
137
+ });
138
+ }
139
+ /** Stops a command started by {@link executeMloop} and whatever it started. */
140
+ function killTree(pid) {
141
+ if (pid === undefined)
142
+ return;
143
+ try {
144
+ if (process.platform === 'win32')
145
+ spawn('taskkill', ['/pid', String(pid), '/T', '/F'], { windowsHide: true });
146
+ else
147
+ process.kill(-pid, 'SIGTERM');
148
+ }
149
+ catch {
150
+ // Already gone.
151
+ }
152
+ }
70
153
  /**
71
154
  * Build CLI arguments from a parameter object
72
155
  * Handles common patterns like --flag, --key=value
@@ -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,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAc,EACd,UAA0B,EAAE;IAE5B,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,eAAe,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,kDAAkD;QAClD,4DAA4D;QAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,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,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/index.js CHANGED
@@ -4,24 +4,18 @@
4
4
  *
5
5
  * Exposes MLoop ML.NET MLOps capabilities via Model Context Protocol
6
6
  */
7
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { serveStdio } from '@modelcontextprotocol/server/stdio';
8
8
  import { createServer } from './server.js';
9
- async function main() {
10
- const server = createServer();
11
- const transport = new StdioServerTransport();
12
- await server.connect(transport);
13
- // Handle graceful shutdown
14
- process.on('SIGINT', async () => {
15
- await server.close();
16
- process.exit(0);
17
- });
18
- process.on('SIGTERM', async () => {
19
- await server.close();
9
+ // serveStdio answers both protocol eras on one stdin/stdout: a client opening with `initialize`
10
+ // (2025-11-25 and earlier) and a 2026-07-28 client (no handshake, `server/discover`) alike.
11
+ const connection = serveStdio(() => createServer(), {
12
+ onerror: (error) => console.error('mloop-mcp:', error),
13
+ });
14
+ // Handle graceful shutdown
15
+ for (const signal of ['SIGINT', 'SIGTERM']) {
16
+ process.on(signal, async () => {
17
+ await connection.close();
20
18
  process.exit(0);
21
19
  });
22
20
  }
23
- main().catch((error) => {
24
- console.error('Fatal error:', error);
25
- process.exit(1);
26
- });
27
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH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CAAC;AAEH,2BAA2B;AAC3B,KAAK,MAAM,MAAM,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAU,EAAE,CAAC;IACpD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;QAC5B,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"package-info.js","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,oFAAoF;AACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAC/C,CAAC;AAErB,MAAM,CAAC,MAAM,cAAc,GAAW,QAAQ,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"package-info.js","sourceRoot":"","sources":["../src/package-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,oFAAoF;AACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAC/C,CAAC;AAErB,MAAM,CAAC,MAAM,cAAc,GAAW,QAAQ,CAAC,OAAO,CAAC"}
package/build/server.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * MCP Server for MLoop CLI
3
3
  */
4
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { McpServer } from '@modelcontextprotocol/server';
5
5
  /**
6
6
  * Create and configure the MCP server
7
7
  */
@@ -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;AAoCpE;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CA6OxC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAsB,MAAM,8BAA8B,CAAC;AAoF7E;;GAEG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAexC"}
package/build/server.js CHANGED
@@ -1,15 +1,44 @@
1
1
  /**
2
2
  * MCP Server for MLoop CLI
3
3
  */
4
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
- import {
6
- // Existing tools
7
- trainTool, train, trainSchema, predictTool, predict, predictSchema, listTool, list, listSchema, promoteTool, promote, promoteSchema, rollbackTool, rollback, rollbackSchema, thresholdTool, threshold, thresholdSchema, calibrateTool, calibrate, calibrateSchema, exportOnnxTool, exportOnnx, exportOnnxSchema, 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, driftTool, drift, driftSchema, analyzeTool, analyze, analyzeSchema, detectTool, detect, detectSchema, prepPlanTool, prepPlan, prepPlanSchema, featuresSelectTool, featuresSelect, featuresSelectSchema,
10
- // Composite workflow tools
11
- quickStartTool, quickStart, quickStartSchema, autoTrainTool, autoTrain, autoTrainSchema, projectOverviewTool, projectOverview, projectOverviewSchema, } from './tools/index.js';
4
+ import { McpServer } from '@modelcontextprotocol/server';
5
+ import { trainTool, trainSchema, predictTool, predictSchema, listTool, listSchema, promoteTool, promoteSchema, rollbackTool, rollbackSchema, thresholdTool, thresholdSchema, calibrateTool, calibrateSchema, exportOnnxTool, exportOnnxSchema, infoTool, infoSchema, statusTool, statusSchema, compareTool, compareSchema, evaluateTool, evaluateSchema, serveTool, serveSchema, initTool, initSchema, validateTool, validateSchema, prepTool, prepSchema, logsTool, logsSchema, feedbackTool, feedbackSchema, sampleTool, sampleSchema, triggerTool, triggerSchema, driftTool, driftSchema, analyzeTool, analyzeSchema, detectTool, detectSchema, prepPlanTool, prepPlanSchema, featuresSelectTool, featuresSelectSchema, tokenTool, tokenSchema, embedTool, embedSchema, encoderTool, encoderSchema, quickStartTool, quickStartSchema, autoTrainTool, autoTrainSchema, projectOverviewTool, projectOverviewSchema, } from './tools/index.js';
12
6
  import { packageVersion } from './package-info.js';
7
+ import { withRequestSignal } from './executor.js';
8
+ /** Every tool, with the schema its arguments are validated against — in the order `tools/list` names them. */
9
+ const tools = [
10
+ [trainTool, trainSchema],
11
+ [predictTool, predictSchema],
12
+ [listTool, listSchema],
13
+ [promoteTool, promoteSchema],
14
+ [rollbackTool, rollbackSchema],
15
+ [thresholdTool, thresholdSchema],
16
+ [calibrateTool, calibrateSchema],
17
+ [exportOnnxTool, exportOnnxSchema],
18
+ [infoTool, infoSchema],
19
+ [statusTool, statusSchema],
20
+ [compareTool, compareSchema],
21
+ [evaluateTool, evaluateSchema],
22
+ [serveTool, serveSchema],
23
+ [initTool, initSchema],
24
+ [validateTool, validateSchema],
25
+ [prepTool, prepSchema],
26
+ [logsTool, logsSchema],
27
+ [feedbackTool, feedbackSchema],
28
+ [sampleTool, sampleSchema],
29
+ [triggerTool, triggerSchema],
30
+ [driftTool, driftSchema],
31
+ [analyzeTool, analyzeSchema],
32
+ [detectTool, detectSchema],
33
+ [prepPlanTool, prepPlanSchema],
34
+ [featuresSelectTool, featuresSelectSchema],
35
+ [tokenTool, tokenSchema],
36
+ [embedTool, embedSchema],
37
+ [encoderTool, encoderSchema],
38
+ [quickStartTool, quickStartSchema],
39
+ [autoTrainTool, autoTrainSchema],
40
+ [projectOverviewTool, projectOverviewSchema],
41
+ ];
13
42
  /**
14
43
  * Create and configure the MCP server
15
44
  */
@@ -18,65 +47,9 @@ export function createServer() {
18
47
  name: 'mloop-mcp',
19
48
  version: packageVersion,
20
49
  });
21
- // === Existing tools ===
22
- // Register mloop_train
23
- server.tool(trainTool.name, trainTool.description, trainSchema.shape, async (params) => train(params));
24
- // Register mloop_predict
25
- server.tool(predictTool.name, predictTool.description, predictSchema.shape, async (params) => predict(params));
26
- // Register mloop_list
27
- server.tool(listTool.name, listTool.description, listSchema.shape, async (params) => list(params));
28
- // Register mloop_promote
29
- server.tool(promoteTool.name, promoteTool.description, promoteSchema.shape, async (params) => promote(params));
30
- // Register mloop_rollback
31
- server.tool(rollbackTool.name, rollbackTool.description, rollbackSchema.shape, async (params) => rollback(params));
32
- // Register mloop_threshold
33
- server.tool(thresholdTool.name, thresholdTool.description, thresholdSchema.shape, async (params) => threshold(params));
34
- // Register mloop_calibrate
35
- server.tool(calibrateTool.name, calibrateTool.description, calibrateSchema.shape, async (params) => calibrate(params));
36
- // Register mloop_export_onnx
37
- server.tool(exportOnnxTool.name, exportOnnxTool.description, exportOnnxSchema.shape, async (params) => exportOnnx(params));
38
- // Register mloop_info
39
- server.tool(infoTool.name, infoTool.description, infoSchema.shape, async (params) => info(params));
40
- // Register mloop_status
41
- server.tool(statusTool.name, statusTool.description, statusSchema.shape, async (params) => status(params));
42
- // Register mloop_compare
43
- server.tool(compareTool.name, compareTool.description, compareSchema.shape, async (params) => compare(params));
44
- // Register mloop_evaluate
45
- server.tool(evaluateTool.name, evaluateTool.description, evaluateSchema.shape, async (params) => evaluate(params));
46
- // Register mloop_serve
47
- server.tool(serveTool.name, serveTool.description, serveSchema.shape, async (params) => serve(params));
48
- // === New basic tools ===
49
- // Register mloop_init
50
- server.tool(initTool.name, initTool.description, initSchema.shape, async (params) => init(params));
51
- // Register mloop_validate
52
- server.tool(validateTool.name, validateTool.description, validateSchema.shape, async (params) => validate(params));
53
- // Register mloop_prep
54
- server.tool(prepTool.name, prepTool.description, prepSchema.shape, async (params) => prep(params));
55
- // Register mloop_logs
56
- server.tool(logsTool.name, logsTool.description, logsSchema.shape, async (params) => logs(params));
57
- // Register mloop_feedback
58
- server.tool(feedbackTool.name, feedbackTool.description, feedbackSchema.shape, async (params) => feedback(params));
59
- // Register mloop_sample
60
- server.tool(sampleTool.name, sampleTool.description, sampleSchema.shape, async (params) => sample(params));
61
- // Register mloop_trigger
62
- server.tool(triggerTool.name, triggerTool.description, triggerSchema.shape, async (params) => trigger(params));
63
- // Register mloop_drift
64
- server.tool(driftTool.name, driftTool.description, driftSchema.shape, async (params) => drift(params));
65
- // Register mloop_analyze
66
- server.tool(analyzeTool.name, analyzeTool.description, analyzeSchema.shape, async (params) => analyze(params));
67
- // Register mloop_detect
68
- server.tool(detectTool.name, detectTool.description, detectSchema.shape, async (params) => detect(params));
69
- // Register mloop_prep_plan
70
- server.tool(prepPlanTool.name, prepPlanTool.description, prepPlanSchema.shape, async (params) => prepPlan(params));
71
- // Register mloop_features_select
72
- server.tool(featuresSelectTool.name, featuresSelectTool.description, featuresSelectSchema.shape, async (params) => featuresSelect(params));
73
- // === Composite workflow tools ===
74
- // Register mloop_quick_start
75
- server.tool(quickStartTool.name, quickStartTool.description, quickStartSchema.shape, async (params) => quickStart(params));
76
- // Register mloop_auto_train
77
- server.tool(autoTrainTool.name, autoTrainTool.description, autoTrainSchema.shape, async (params) => autoTrain(params));
78
- // Register mloop_project_overview
79
- server.tool(projectOverviewTool.name, projectOverviewTool.description, projectOverviewSchema.shape, async (params) => projectOverview(params));
50
+ for (const [tool, schema] of tools) {
51
+ server.registerTool(tool.name, { description: tool.description, inputSchema: schema }, async (params, ctx) => withRequestSignal(ctx.mcpReq.signal, () => tool.handler(params, ctx)));
52
+ }
80
53
  return server;
81
54
  }
82
55
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"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