terminator-mcp-agent 0.11.13 → 0.12.5
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 +48 -20
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -10,6 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
A Model Context Protocol (MCP) server that provides desktop GUI automation capabilities using the [Terminator](https://github.com/mediar-ai/terminator) library. This server enables LLMs and agentic clients to interact with Windows, macOS, and Linux applications through structured accessibility APIs—no vision models or screenshots required.
|
|
12
12
|
|
|
13
|
+
### HTTP Endpoints (when running with `-t http`)
|
|
14
|
+
|
|
15
|
+
- `GET /health`: Always returns 200 while the process is alive.
|
|
16
|
+
- `GET /status`: Busy-aware probe for load balancers. Returns JSON and appropriate status:
|
|
17
|
+
- 200 when idle: `{ "busy": false, "activeRequests": 0, "maxConcurrent": 1, "lastActivity": "<ISO-8601>" }`
|
|
18
|
+
- 503 when busy: `{ "busy": true, "activeRequests": 1, "maxConcurrent": 1, "lastActivity": "<ISO-8601>" }`
|
|
19
|
+
- Content-Type is `application/json`.
|
|
20
|
+
- `POST /mcp`: MCP execution endpoint. Enforces single-request concurrency per machine by default.
|
|
21
|
+
|
|
22
|
+
Concurrency is controlled by the `MCP_MAX_CONCURRENT` environment variable (default `1`). Only accepted `POST /mcp` requests are counted toward `activeRequests`. If the server is at capacity, new `POST /mcp` requests return 503 immediately. This 503 behavior is intentional so an Azure Load Balancer probing `GET /status` can take a busy VM out of rotation and route traffic elsewhere.
|
|
23
|
+
|
|
13
24
|
### Getting Started
|
|
14
25
|
|
|
15
26
|
The easiest way to get started is to use the one-click install buttons above for your specific editor (VS Code, Cursor, etc.).
|
|
@@ -28,12 +39,12 @@ If you prefer, you can add the following to your MCP client's settings file:
|
|
|
28
39
|
|
|
29
40
|
```json
|
|
30
41
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"terminator-mcp-agent": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["-y", "terminator-mcp-agent@latest"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
37
48
|
}
|
|
38
49
|
```
|
|
39
50
|
|
|
@@ -42,6 +53,7 @@ If you prefer, you can add the following to your MCP client's settings file:
|
|
|
42
53
|
For automation workflows and CI/CD pipelines, you can execute workflows directly from the command line using the [Terminator CLI](../terminator-cli/README.md):
|
|
43
54
|
|
|
44
55
|
**Quick Start:**
|
|
56
|
+
|
|
45
57
|
```bash
|
|
46
58
|
# Execute a workflow file
|
|
47
59
|
terminator mcp run workflow.yml
|
|
@@ -59,6 +71,7 @@ terminator mcp run workflow.yml --command "npx -y terminator-mcp-agent@latest"
|
|
|
59
71
|
**Workflow File Formats:**
|
|
60
72
|
|
|
61
73
|
Direct workflow format (`workflow.yml`):
|
|
74
|
+
|
|
62
75
|
```yaml
|
|
63
76
|
steps:
|
|
64
77
|
- tool_name: navigate_browser
|
|
@@ -72,6 +85,7 @@ include_detailed_results: true
|
|
|
72
85
|
```
|
|
73
86
|
|
|
74
87
|
Tool call wrapper format (`workflow.json`):
|
|
88
|
+
|
|
75
89
|
```json
|
|
76
90
|
{
|
|
77
91
|
"tool_name": "execute_sequence",
|
|
@@ -101,7 +115,7 @@ steps:
|
|
|
101
115
|
// Access desktop automation APIs
|
|
102
116
|
const elements = await desktop.locator('role:button').all();
|
|
103
117
|
log(`Found ${elements.length} buttons`);
|
|
104
|
-
|
|
118
|
+
|
|
105
119
|
// Conditional logic and bulk operations
|
|
106
120
|
for (const element of elements) {
|
|
107
121
|
const name = await element.name();
|
|
@@ -110,7 +124,7 @@ steps:
|
|
|
110
124
|
break;
|
|
111
125
|
}
|
|
112
126
|
}
|
|
113
|
-
|
|
127
|
+
|
|
114
128
|
return {
|
|
115
129
|
buttons_found: elements.length,
|
|
116
130
|
action: 'clicked_submit'
|
|
@@ -133,13 +147,14 @@ This is the most powerful and flexible method. You build a workflow step-by-step
|
|
|
133
147
|
4. **Extract Structured Data with `output_parser`**: Add the `output_parser` argument to your `execute_sequence` call. Write JavaScript code to parse the final UI tree and extract structured data. If successful, the tool result will contain a `parsed_output` field with your clean JSON data.
|
|
134
148
|
|
|
135
149
|
Here is an example of an `output_parser` that extracts insurance quote data from a web page:
|
|
150
|
+
|
|
136
151
|
```yaml
|
|
137
152
|
output_parser:
|
|
138
153
|
ui_tree_source_step_id: capture_quotes_tree
|
|
139
154
|
javascript_code: |
|
|
140
155
|
// Find all quote groups with Image and Text children
|
|
141
156
|
const results = [];
|
|
142
|
-
|
|
157
|
+
|
|
143
158
|
function findElementsRecursively(element) {
|
|
144
159
|
if (element.attributes && element.attributes.role === 'Group') {
|
|
145
160
|
const children = element.children || [];
|
|
@@ -183,7 +198,7 @@ output_parser:
|
|
|
183
198
|
}
|
|
184
199
|
}
|
|
185
200
|
}
|
|
186
|
-
|
|
201
|
+
|
|
187
202
|
findElementsRecursively(tree);
|
|
188
203
|
return results;
|
|
189
204
|
```
|
|
@@ -233,6 +248,7 @@ Now, when your MCP client runs `terminator-mcp-agent`, it will use your local bu
|
|
|
233
248
|
**Problem**: "missing field `items`" or schema mismatch errors
|
|
234
249
|
|
|
235
250
|
**Solution**: Ensure you're using the latest MCP server version:
|
|
251
|
+
|
|
236
252
|
```bash
|
|
237
253
|
# Force latest version in CLI
|
|
238
254
|
terminator mcp run workflow.yml --command "npx -y terminator-mcp-agent@latest"
|
|
@@ -256,6 +272,7 @@ npm cache clean --force
|
|
|
256
272
|
**Problem**: CLI commands not working or connection errors
|
|
257
273
|
|
|
258
274
|
**Solution**: Test MCP connectivity step by step:
|
|
275
|
+
|
|
259
276
|
```bash
|
|
260
277
|
# Test basic connectivity
|
|
261
278
|
terminator mcp exec get_applications
|
|
@@ -275,6 +292,7 @@ terminator mcp run workflow.yml --url http://localhost:3000/mcp
|
|
|
275
292
|
**Problem**: JavaScript code fails or can't access desktop APIs
|
|
276
293
|
|
|
277
294
|
**Solution**: Verify JavaScript execution and API access:
|
|
295
|
+
|
|
278
296
|
```bash
|
|
279
297
|
# Test basic JavaScript execution
|
|
280
298
|
terminator mcp exec run_javascript '{"script": "return {test: true};"}'
|
|
@@ -291,6 +309,7 @@ terminator mcp run workflow.yml --verbose
|
|
|
291
309
|
**Problem**: Workflow parsing errors or unexpected behavior
|
|
292
310
|
|
|
293
311
|
**Solution**: Validate workflow structure:
|
|
312
|
+
|
|
294
313
|
```bash
|
|
295
314
|
# Validate workflow syntax
|
|
296
315
|
terminator mcp run workflow.yml --dry-run
|
|
@@ -307,16 +326,19 @@ terminator mcp run workflow.json # JSON
|
|
|
307
326
|
### Platform-Specific Issues
|
|
308
327
|
|
|
309
328
|
**Windows**:
|
|
329
|
+
|
|
310
330
|
- Ensure Windows UI Automation APIs are available
|
|
311
331
|
- Run with administrator privileges if accessibility features are restricted
|
|
312
332
|
- Check Windows Defender/antivirus isn't blocking automation
|
|
313
333
|
|
|
314
334
|
**macOS**:
|
|
335
|
+
|
|
315
336
|
- Grant accessibility permissions in System Preferences > Security & Privacy
|
|
316
337
|
- Ensure the terminal/IDE has accessibility access
|
|
317
338
|
- Check macOS version compatibility (10.14+ recommended)
|
|
318
339
|
|
|
319
340
|
**Linux**:
|
|
341
|
+
|
|
320
342
|
- Ensure AT-SPI (assistive technology) is enabled
|
|
321
343
|
- Install required packages: `sudo apt-get install at-spi2-core`
|
|
322
344
|
- Check desktop environment compatibility (GNOME, KDE, XFCE supported)
|
|
@@ -324,11 +346,13 @@ terminator mcp run workflow.json # JSON
|
|
|
324
346
|
### Performance Optimization
|
|
325
347
|
|
|
326
348
|
**Large UI Trees**:
|
|
349
|
+
|
|
327
350
|
- Use specific selectors instead of broad element searches
|
|
328
351
|
- Implement delays between rapid operations
|
|
329
352
|
- Consider using `include_tree: false` for intermediate steps
|
|
330
353
|
|
|
331
354
|
**JavaScript Performance**:
|
|
355
|
+
|
|
332
356
|
- Use `quickjs` engine for lightweight operations
|
|
333
357
|
- Use `nodejs` engine only when full APIs are needed
|
|
334
358
|
- Implement `sleep()` delays in loops to prevent overwhelming the UI
|
|
@@ -347,7 +371,8 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
347
371
|
{
|
|
348
372
|
"tool_name": "execute_sequence",
|
|
349
373
|
"arguments": {
|
|
350
|
-
"variables": {
|
|
374
|
+
"variables": {
|
|
375
|
+
// 1️⃣ Re-usable inputs with type metadata
|
|
351
376
|
"app_path": {
|
|
352
377
|
"type": "string",
|
|
353
378
|
"label": "Calculator EXE Path",
|
|
@@ -364,18 +389,21 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
364
389
|
"default": "8"
|
|
365
390
|
}
|
|
366
391
|
},
|
|
367
|
-
"inputs": {
|
|
392
|
+
"inputs": {
|
|
393
|
+
// 2️⃣ Concrete values for *this run*
|
|
368
394
|
"app_path": "calc.exe",
|
|
369
395
|
"first_number": "42",
|
|
370
396
|
"second_number": "8"
|
|
371
397
|
},
|
|
372
|
-
"selectors": {
|
|
398
|
+
"selectors": {
|
|
399
|
+
// 3️⃣ Human-readable element shortcuts
|
|
373
400
|
"calc_window": "role:Window|name:Calculator",
|
|
374
401
|
"btn_clear": "role:Button|name:Clear",
|
|
375
402
|
"btn_plus": "role:Button|name:Plus",
|
|
376
403
|
"btn_equals": "role:Button|name:Equals"
|
|
377
404
|
},
|
|
378
|
-
"steps": [
|
|
405
|
+
"steps": [
|
|
406
|
+
// 4️⃣ Ordered actions & control flow
|
|
379
407
|
{
|
|
380
408
|
"tool_name": "open_application",
|
|
381
409
|
"arguments": { "path": "${{app_path}}" }
|
|
@@ -418,7 +446,7 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
418
446
|
"arguments": { "selector": "${{selectors.btn_equals}}" }
|
|
419
447
|
},
|
|
420
448
|
{
|
|
421
|
-
"tool_name": "wait_for_element",
|
|
449
|
+
"tool_name": "wait_for_element", // 4c. Capture final UI tree
|
|
422
450
|
"arguments": {
|
|
423
451
|
"selector": "${{selectors.calc_window}}",
|
|
424
452
|
"condition": "exists",
|
|
@@ -427,7 +455,8 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
427
455
|
}
|
|
428
456
|
}
|
|
429
457
|
],
|
|
430
|
-
"output_parser": {
|
|
458
|
+
"output_parser": {
|
|
459
|
+
// 5️⃣ Turn the tree into clean JSON
|
|
431
460
|
"javascript_code": "// Extract calculator display value\nconst results = [];\n\nfunction findElementsRecursively(element) {\n if (element.attributes && element.attributes.role === 'Text') {\n const item = {\n displayValue: element.attributes.name || ''\n };\n results.push(item);\n }\n \n if (element.children) {\n for (const child of element.children) {\n findElementsRecursively(child);\n }\n }\n}\n\nfindElementsRecursively(tree);\nreturn results;"
|
|
432
461
|
}
|
|
433
462
|
}
|
|
@@ -437,8 +466,8 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
437
466
|
### 2. Key Concepts at a Glance
|
|
438
467
|
|
|
439
468
|
1. **Variables vs. Inputs** – Declare once, override per-run. This is perfect for parameterizing CI pipelines or A/B test data.
|
|
440
|
-
2. **Selectors** – Give every important UI element a
|
|
441
|
-
3. **Templating** – `${{ ... }}` (GitHub Actions-style)
|
|
469
|
+
2. **Selectors** – Give every important UI element a _nickname_. It makes long workflows readable and easy to maintain.
|
|
470
|
+
3. **Templating** – `${{ ... }}` (GitHub Actions-style) _or_ legacy `{{ ... }}` lets you reference **any** key inside `variables`, `inputs`, or `selectors`. Both syntaxes are supported; the engine uses Mustache-style rendering.
|
|
442
471
|
4. **Groups & Control Flow** – Add `group_name`, `skippable`, `if`, or `continue_on_error` to any step for advanced branching.
|
|
443
472
|
5. **Output Parsing** – Always end with a step that includes the UI tree, then use the declarative JSON DSL to mine the data you need.
|
|
444
473
|
|
|
@@ -451,7 +480,7 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
451
480
|
```jsonc
|
|
452
481
|
{
|
|
453
482
|
"parsed_output": {
|
|
454
|
-
"displayValue": "50"
|
|
483
|
+
"displayValue": "50" // 42 + 8
|
|
455
484
|
}
|
|
456
485
|
}
|
|
457
486
|
```
|
|
@@ -464,4 +493,3 @@ For additional help, see the [Terminator CLI documentation](../terminator-cli/RE
|
|
|
464
493
|
- **Version control** – Store workflow JSON in a repo and use PR reviews just like regular code.
|
|
465
494
|
|
|
466
495
|
> Need more help? Browse the examples under `examples/` in this repo or open a discussion on GitHub.
|
|
467
|
-
|
package/package.json
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
],
|
|
13
13
|
"name": "terminator-mcp-agent",
|
|
14
14
|
"optionalDependencies": {
|
|
15
|
-
"terminator-mcp-darwin-arm64": "0.
|
|
16
|
-
"terminator-mcp-darwin-x64": "0.
|
|
17
|
-
"terminator-mcp-linux-x64-gnu": "0.
|
|
18
|
-
"terminator-mcp-win32-x64-msvc": "0.
|
|
15
|
+
"terminator-mcp-darwin-arm64": "0.12.5",
|
|
16
|
+
"terminator-mcp-darwin-x64": "0.12.5",
|
|
17
|
+
"terminator-mcp-linux-x64-gnu": "0.12.5",
|
|
18
|
+
"terminator-mcp-win32-x64-msvc": "0.12.5"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"sync-version": "node ./utils/sync-version.js",
|
|
28
28
|
"update-badges": "node ./utils/update-badges.js"
|
|
29
29
|
},
|
|
30
|
-
"version": "0.
|
|
30
|
+
"version": "0.12.5"
|
|
31
31
|
}
|