@evref-bl/pharo-launcher-mcp 0.1.1

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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +194 -0
  3. package/bin/pharo-launcher.cmd +46 -0
  4. package/bin/pharo-launcher.sh +41 -0
  5. package/dist/commandCatalog.d.ts +15 -0
  6. package/dist/commandCatalog.d.ts.map +1 -0
  7. package/dist/commandCatalog.js +537 -0
  8. package/dist/commandCatalog.js.map +1 -0
  9. package/dist/config.d.ts +21 -0
  10. package/dist/config.d.ts.map +1 -0
  11. package/dist/config.js +60 -0
  12. package/dist/config.js.map +1 -0
  13. package/dist/discovery.d.ts +55 -0
  14. package/dist/discovery.d.ts.map +1 -0
  15. package/dist/discovery.js +109 -0
  16. package/dist/discovery.js.map +1 -0
  17. package/dist/index.d.ts +3 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +39 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/launcherCli.d.ts +29 -0
  22. package/dist/launcherCli.d.ts.map +1 -0
  23. package/dist/launcherCli.js +116 -0
  24. package/dist/launcherCli.js.map +1 -0
  25. package/dist/launcherScript.d.ts +23 -0
  26. package/dist/launcherScript.d.ts.map +1 -0
  27. package/dist/launcherScript.js +47 -0
  28. package/dist/launcherScript.js.map +1 -0
  29. package/dist/models.d.ts +55 -0
  30. package/dist/models.d.ts.map +1 -0
  31. package/dist/models.js +2 -0
  32. package/dist/models.js.map +1 -0
  33. package/dist/parser.d.ts +18 -0
  34. package/dist/parser.d.ts.map +1 -0
  35. package/dist/parser.js +237 -0
  36. package/dist/parser.js.map +1 -0
  37. package/dist/platform.d.ts +16 -0
  38. package/dist/platform.d.ts.map +1 -0
  39. package/dist/platform.js +67 -0
  40. package/dist/platform.js.map +1 -0
  41. package/dist/processTools.d.ts +28 -0
  42. package/dist/processTools.d.ts.map +1 -0
  43. package/dist/processTools.js +254 -0
  44. package/dist/processTools.js.map +1 -0
  45. package/dist/resultNormalizer.d.ts +4 -0
  46. package/dist/resultNormalizer.d.ts.map +1 -0
  47. package/dist/resultNormalizer.js +44 -0
  48. package/dist/resultNormalizer.js.map +1 -0
  49. package/dist/server.d.ts +20 -0
  50. package/dist/server.d.ts.map +1 -0
  51. package/dist/server.js +126 -0
  52. package/dist/server.js.map +1 -0
  53. package/docs/development.md +166 -0
  54. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Evref-BL and contributors
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.
package/README.md ADDED
@@ -0,0 +1,194 @@
1
+ # pharo-launcher-mcp
2
+
3
+ pharo-launcher-mcp is a standalone MCP server for Pharo Launcher.
4
+
5
+ It exposes Pharo Launcher image, template, VM, and process operations as MCP
6
+ tools. It can run through a bundled launcher wrapper, or fall back to a direct
7
+ Pharo VM invocation when no wrapper is available.
8
+
9
+ ## Requirements
10
+
11
+ - Node.js 24 or newer
12
+ - `npm` and `npx`
13
+ - Pharo Launcher
14
+
15
+ ## Install
16
+
17
+ ```sh
18
+ npm install @evref-bl/pharo-launcher-mcp
19
+ ```
20
+
21
+ Run the server over stdio:
22
+
23
+ ```sh
24
+ npx @evref-bl/pharo-launcher-mcp
25
+ ```
26
+
27
+ The package also exposes the `pharo-launcher-mcp` executable when installed
28
+ into a project.
29
+
30
+ ## Configuration
31
+
32
+ pharo-launcher-mcp resolves Pharo Launcher paths from environment variables
33
+ first. If they are not set, it uses host defaults:
34
+
35
+ | Host OS | Launcher directory | VM path | Bundled wrapper |
36
+ | --- | --- | --- | --- |
37
+ | Windows | `%LOCALAPPDATA%\Pharo Launcher` | `<launcher-dir>\PharoConsole.exe` | `pharo-launcher.cmd` |
38
+ | macOS | `$HOME/Library/Application Support/Pharo Launcher` | `<launcher-dir>/pharo-vm/Pharo.app/Contents/MacOS/Pharo` | `pharo-launcher.sh` |
39
+ | Linux | `$HOME/.local/share/Pharo Launcher` | `<launcher-dir>/pharo-vm/pharo` | `pharo-launcher.sh` |
40
+
41
+ Override paths when needed:
42
+
43
+ ```sh
44
+ PHARO_LAUNCHER_DIR="/path/to/Pharo Launcher"
45
+ PHARO_LAUNCHER_VM="/path/to/pharo"
46
+ PHARO_LAUNCHER_IMAGE="/path/to/PharoLauncher.image"
47
+ PHARO_LAUNCHER_SCRIPT="/path/to/pharo-launcher.sh"
48
+ ```
49
+
50
+ ```powershell
51
+ $env:PHARO_LAUNCHER_DIR="C:\Users\<you>\AppData\Local\Pharo Launcher"
52
+ $env:PHARO_LAUNCHER_VM="$env:PHARO_LAUNCHER_DIR\PharoConsole.exe"
53
+ $env:PHARO_LAUNCHER_IMAGE="$env:PHARO_LAUNCHER_DIR\PharoLauncher.image"
54
+ $env:PHARO_LAUNCHER_SCRIPT="C:\path\to\pharo-launcher.cmd"
55
+ ```
56
+
57
+ `PHARO_LAUNCHER_SCRIPT` is optional. If it is unset, pharo-launcher-mcp tries
58
+ its bundled wrapper for the current platform. If no wrapper is available, it
59
+ runs the VM directly with:
60
+
61
+ ```text
62
+ --headless <PharoLauncher.image> --no-default-preferences clap launcher ...
63
+ ```
64
+
65
+ ## Profiles
66
+
67
+ Profiles are optional. They let pharo-launcher-mcp use a separate Pharo
68
+ Launcher control image and separate folders for images, VMs, templates,
69
+ initialization scripts, and logs.
70
+
71
+ ```sh
72
+ PHARO_LAUNCHER_MCP_PROFILE=isolated
73
+ PHARO_LAUNCHER_MCP_STATE_ROOT=/path/to/pharo-launcher-mcp/profiles/isolated
74
+ ```
75
+
76
+ Profile paths can also be set explicitly:
77
+
78
+ ```sh
79
+ PHARO_LAUNCHER_MCP_LAUNCHER_IMAGE=/path/to/profile/PharoLauncher.image
80
+ PHARO_LAUNCHER_MCP_IMAGES_DIR=/path/to/images
81
+ PHARO_LAUNCHER_MCP_VMS_DIR=/path/to/vms
82
+ PHARO_LAUNCHER_MCP_TEMPLATE_SOURCES_DIR=/path/to/templates
83
+ PHARO_LAUNCHER_MCP_INIT_SCRIPTS_DIR=/path/to/init-scripts
84
+ PHARO_LAUNCHER_MCP_LOGS_DIR=/path/to/logs
85
+ ```
86
+
87
+ `PHARO_LAUNCHER_MCP_LAUNCHER_CONFIGURATION`, when set, is passed to Pharo Launcher as
88
+ `--configuration <value>`.
89
+
90
+ ## Tools
91
+
92
+ Health and configuration:
93
+
94
+ | Tool | Purpose |
95
+ | --- | --- |
96
+ | `pharo_launcher_health` | Report resolved paths and wrapper availability without invoking Pharo Launcher. |
97
+ | `pharo_launcher_config` | Report the active Pharo Launcher configuration. |
98
+ | `pharo_launcher_version` | Run `--version`. |
99
+ | `pharo_launcher_validate_installation` | Check resolved paths and run `--version`. |
100
+
101
+ Image tools:
102
+
103
+ ```text
104
+ pharo_launcher_image_bisect
105
+ pharo_launcher_image_copy
106
+ pharo_launcher_image_create
107
+ pharo_launcher_image_create_from_build
108
+ pharo_launcher_image_create_from_pull_request
109
+ pharo_launcher_image_create_from_repo
110
+ pharo_launcher_image_create_from_sha
111
+ pharo_launcher_image_delete
112
+ pharo_launcher_image_info
113
+ pharo_launcher_image_launch
114
+ pharo_launcher_image_list
115
+ pharo_launcher_image_package
116
+ pharo_launcher_image_recreate
117
+ ```
118
+
119
+ Template tools:
120
+
121
+ ```text
122
+ pharo_launcher_template_category_list
123
+ pharo_launcher_template_info
124
+ pharo_launcher_template_list
125
+ pharo_launcher_template_update
126
+ ```
127
+
128
+ VM tools:
129
+
130
+ ```text
131
+ pharo_launcher_vm_delete
132
+ pharo_launcher_vm_info
133
+ pharo_launcher_vm_list
134
+ pharo_launcher_vm_update
135
+ ```
136
+
137
+ Process tools:
138
+
139
+ ```text
140
+ pharo_launcher_process_kill
141
+ pharo_launcher_process_list
142
+ ```
143
+
144
+ Escape hatch:
145
+
146
+ ```text
147
+ pharo_launcher_raw_command
148
+ ```
149
+
150
+ Destructive tools require `confirm: true`:
151
+
152
+ ```ts
153
+ pharo_launcher_image_delete({ imageName, confirm: true, force?: true })
154
+ pharo_launcher_image_recreate({ imageName, confirm: true })
155
+ pharo_launcher_vm_delete({ vmId, confirm: true })
156
+ pharo_launcher_process_kill({ imageName, confirm: true })
157
+ pharo_launcher_process_kill({ pid, confirm: true })
158
+ ```
159
+
160
+ `pharo_launcher_process_kill` rejects ambiguous input that contains both
161
+ `imageName` and `pid`.
162
+
163
+ ## Results
164
+
165
+ Launcher tools return a normalized envelope:
166
+
167
+ ```ts
168
+ {
169
+ ok: boolean;
170
+ data?: unknown;
171
+ parser: {
172
+ status: "parsed" | "unsupported" | "failed" | "skipped";
173
+ format: "ston" | "text";
174
+ message?: string;
175
+ };
176
+ raw: {
177
+ stdout: string;
178
+ stderr: string;
179
+ format: "ston" | "text";
180
+ };
181
+ command: {
182
+ args: string[];
183
+ durationMs: number;
184
+ exitCode: number | null;
185
+ timedOut: boolean;
186
+ timeoutReason?: string;
187
+ };
188
+ }
189
+ ```
190
+
191
+ ## Development
192
+
193
+ Development, testing, and live Pharo Launcher notes are in
194
+ [`docs/development.md`](docs/development.md).
@@ -0,0 +1,46 @@
1
+ @echo off
2
+ setlocal
3
+
4
+ set "SCRIPT_DIR=%~dp0"
5
+ set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
6
+ for %%I in ("%SCRIPT_DIR%\..") do set "ROOT=%%~fI"
7
+
8
+ if "%PHARO_LAUNCHER_IMAGE%"=="" (
9
+ if exist "%ROOT%\shared\PharoLauncher.image" (
10
+ set "PHARO_LAUNCHER_IMAGE=%ROOT%\shared\PharoLauncher.image"
11
+ )
12
+ )
13
+
14
+ if "%PHARO_LAUNCHER_IMAGE%"=="" (
15
+ for %%I in ("%SCRIPT_DIR%\*.image" "%ROOT%\*.image") do (
16
+ if exist "%%~fI" (
17
+ set "PHARO_LAUNCHER_IMAGE=%%~fI"
18
+ goto :foundImage
19
+ )
20
+ )
21
+ )
22
+ :foundImage
23
+
24
+ if "%PHARO_LAUNCHER_VM%"=="" (
25
+ if exist "%ROOT%\pharo-vm\PharoConsole.exe" (
26
+ set "PHARO_LAUNCHER_VM=%ROOT%\pharo-vm\PharoConsole.exe"
27
+ )
28
+ )
29
+
30
+ if "%PHARO_LAUNCHER_VM%"=="" (
31
+ if exist "%ROOT%\vms\80-x64\PharoConsole.exe" (
32
+ set "PHARO_LAUNCHER_VM=%ROOT%\vms\80-x64\PharoConsole.exe"
33
+ )
34
+ )
35
+
36
+ if "%PHARO_LAUNCHER_IMAGE%"=="" (
37
+ echo PHARO_LAUNCHER_IMAGE is required or a packaged image must exist next to the launcher script 1>&2
38
+ exit /b 1
39
+ )
40
+
41
+ if "%PHARO_LAUNCHER_VM%"=="" (
42
+ echo PHARO_LAUNCHER_VM is required or a packaged VM must exist under pharo-vm or vms\80-x64 1>&2
43
+ exit /b 1
44
+ )
45
+
46
+ "%PHARO_LAUNCHER_VM%" --headless "%PHARO_LAUNCHER_IMAGE%" --no-default-preferences clap launcher %*
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ set -f
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do
8
+ DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
11
+ done
12
+
13
+ SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)"
14
+ ROOT="$(cd "$SCRIPT_DIR/.." >/dev/null 2>&1 && pwd)"
15
+
16
+ if [ -z "${PHARO_LAUNCHER_IMAGE:-}" ] && [ -f "$ROOT/shared/PharoLauncher.image" ]; then
17
+ PHARO_LAUNCHER_IMAGE="$ROOT/shared/PharoLauncher.image"
18
+ fi
19
+
20
+ if [ -z "${PHARO_LAUNCHER_IMAGE:-}" ]; then
21
+ IMAGE_CANDIDATE="$(find "$SCRIPT_DIR" "$ROOT" -maxdepth 1 -name "*.image" -print -quit 2>/dev/null || true)"
22
+ if [ -n "$IMAGE_CANDIDATE" ]; then
23
+ PHARO_LAUNCHER_IMAGE="$IMAGE_CANDIDATE"
24
+ fi
25
+ fi
26
+
27
+ if [ -z "${PHARO_LAUNCHER_VM:-}" ] && [ -x "$ROOT/pharo-vm/pharo" ]; then
28
+ PHARO_LAUNCHER_VM="$ROOT/pharo-vm/pharo"
29
+ fi
30
+
31
+ if [ -z "${PHARO_LAUNCHER_IMAGE:-}" ]; then
32
+ echo "PHARO_LAUNCHER_IMAGE is required or a packaged image must exist next to the launcher script" >&2
33
+ exit 1
34
+ fi
35
+
36
+ if [ -z "${PHARO_LAUNCHER_VM:-}" ]; then
37
+ echo "PHARO_LAUNCHER_VM is required or a packaged VM must exist under pharo-vm" >&2
38
+ exit 1
39
+ fi
40
+
41
+ "$PHARO_LAUNCHER_VM" --headless "$PHARO_LAUNCHER_IMAGE" --no-default-preferences clap launcher "$@"
@@ -0,0 +1,15 @@
1
+ export interface LauncherCommandTool {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: Record<string, unknown>;
5
+ buildArgs: (input: unknown) => string[];
6
+ }
7
+ export declare class ToolInputError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ export declare const launcherCommandTools: LauncherCommandTool[];
11
+ export declare const launcherCommandToolByName: Map<string, LauncherCommandTool>;
12
+ export declare function buildLauncherCommandArgs(name: string, input: unknown): string[] | undefined;
13
+ export declare function rawCommandArgs(input: unknown): string[];
14
+ export declare const rawCommandTool: LauncherCommandTool;
15
+ //# sourceMappingURL=commandCatalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandCatalog.d.ts","sourceRoot":"","sources":["../src/commandCatalog.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,EAAE,CAAC;CACzC;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAkWD,eAAO,MAAM,oBAAoB,EAAE,mBAAmB,EA0OrD,CAAC;AAEF,eAAO,MAAM,yBAAyB,kCAErC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAE3F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAoBvD;AAED,eAAO,MAAM,cAAc,EAAE,mBAgB5B,CAAC"}