smart-terminal-mcp 1.2.35 → 1.2.36
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/CHANGELOG.md +17 -1
- package/README.md +99 -17
- package/package.json +2 -2
- package/server-card.json +30 -2
- package/server.json +2 -2
- package/smithery.json +1 -1
- package/src/command-runner.js +1 -1
- package/src/index.js +10 -2
- package/src/pty-session.js +225 -19
- package/src/session-id.js +36 -0
- package/src/session-manager.js +2 -2
- package/src/tools.js +82 -7
- package/test/command-runner.test.js +1 -1
- package/test/pty-session.test.js +281 -0
- package/test/session-id.test.js +39 -0
- package/test/tools.test.js +207 -3
- package/.mcpregistry_github_token +0 -1
- package/.mcpregistry_registry_token +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [1.2.
|
|
5
|
+
## [1.2.36] - 2026-04-30
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Process group kill**: `terminal_stop` now kills the entire process group on Unix (via `kill(-pid)`), preventing orphan child processes when stopping sessions that spawned subprocess trees (e.g. `npm run dev` → webpack → esbuild). Windows behavior unchanged.
|
|
9
|
+
- **Incremental reads with `since`**: `terminal_read` accepts an optional `since` byte position and returns only output emitted since that position, along with the current `position`. Agents polling build logs or long-running processes can now read incrementally instead of re-reading the full buffer every poll. Reduces token usage by up to ~87% on repeated polling.
|
|
10
|
+
- **`terminal_watch` tool**: New event-driven monitoring tool that waits for regex/literal trigger matches in session output. Supports multiple triggers with per-trigger cooldowns, quiet detection (auto-return when output stops), process exit detection, context lines, and `since` filtering. Replaces manual poll loops — reduces token usage by up to ~99% for log-watching workflows. Available via `terminal_extra` by default.
|
|
11
|
+
- **Quiet-exit on `terminal_exec`**: New `quietExitMs` and `minOutputBytes` parameters let agents return early when a long-running command (e.g. `npm run dev`) stops producing output, instead of waiting for a hard timeout. Session stays busy so the agent can read incrementally. Reduces token usage by up to ~94% for dev-server commands.
|
|
12
|
+
- **Snapshot and transcript on `terminal_stop`**: `terminal_stop` now accepts `snapshotLines` (return last N lines in response) and `transcriptPath` (write full session history to disk before stopping). Transcript write failure safely prevents session termination.
|
|
13
|
+
- **Human-readable session IDs**: Sessions now get memorable IDs like `calm-reef` or `brisk-falcon` instead of hex fragments like `a1b2c3d4`. Easier to read in logs and agent references.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- `terminal_read` now always includes a `position` field in the response (monotonic byte counter).
|
|
17
|
+
- `terminal_stop` accepts optional `snapshotLines` and `transcriptPath` parameters.
|
|
18
|
+
|
|
19
|
+
## [1.2.35] - 2026-04-26
|
|
6
20
|
|
|
7
21
|
### Added
|
|
8
22
|
- **`terminal_extra` meta-tool**: Convenience tools (`terminal_run_paged`, `terminal_retry`, `terminal_diff`, `terminal_resize`, `terminal_send_key`, `terminal_get_history`, `terminal_write_file`) are now collected behind a single lightweight meta-tool by default, reducing tool definition token overhead by ~50%. The agent can discover schemas via `list: true` and call any extra tool through `terminal_extra`.
|
|
@@ -12,6 +26,8 @@ All notable changes to this project will be documented in this file.
|
|
|
12
26
|
- Stripped redundant `.describe()` calls from tool parameter schemas where the parameter name is self-documenting (e.g. `sessionId`, `command`, `cwd`, `timeout`). Keeps only 6 essential descriptions for non-obvious parameters.
|
|
13
27
|
|
|
14
28
|
### Fixed
|
|
29
|
+
- Fixed `pty-session` to properly track pending markers and allow smooth interruption of background commands.
|
|
30
|
+
- Handled `/mcp` POST parsing and transport errors gracefully in `http-scan-server` to avoid crashes.
|
|
15
31
|
- Fixed `terminal_start` test that expected auto-detect hint when no shell was explicitly provided.
|
|
16
32
|
|
|
17
33
|
## [1.2.12] - 2026-03-08
|
package/README.md
CHANGED
|
@@ -36,12 +36,16 @@ Think of this as a **controlled keyboard + terminal for an agent running inside
|
|
|
36
36
|
### Long output and long-running commands
|
|
37
37
|
|
|
38
38
|
- **Interactive reads and writes** -- `terminal_write` + `terminal_read` support prompts, REPLs, and other interactive programs without leaving the current session.
|
|
39
|
+
- **Incremental reads** -- `terminal_read` accepts a `since` byte position to return only new output since the last read, avoiding re-reading the full buffer on every poll.
|
|
39
40
|
- **Pattern waiting** -- `terminal_wait` can pause until specific text appears, such as `server listening on port`.
|
|
41
|
+
- **Event-driven monitoring** -- `terminal_watch` waits for trigger patterns in session output, returning only on match, quiet, timeout, or exit. Eliminates poll-loop token waste.
|
|
42
|
+
- **Quiet-exit detection** -- `terminal_exec` can return early when output goes silent (`quietExitMs`), instead of waiting for a hard timeout.
|
|
40
43
|
- **Retry helper** -- `terminal_retry` can re-run flaky commands with bounded backoff and optional output matching.
|
|
41
44
|
- **Best-effort progress notifications** -- Long `terminal_exec` / `terminal_wait` calls can emit `notifications/progress` when the client provides a progress token.
|
|
42
45
|
- **Output truncation** -- `terminal_exec` and `terminal_read` shorten very large output by returning the beginning and the end.
|
|
43
46
|
- **Paged read-only output** -- `terminal_run_paged` returns large read-only output one page at a time instead of sending the full result at once.
|
|
44
47
|
- **Output diffing** -- `terminal_diff` compares two command results and returns a unified diff.
|
|
48
|
+
- **Session snapshots** -- `terminal_stop` can capture a tail snapshot or write a full transcript to disk before stopping.
|
|
45
49
|
|
|
46
50
|
### Safety and usability
|
|
47
51
|
|
|
@@ -49,7 +53,8 @@ Think of this as a **controlled keyboard + terminal for an agent running inside
|
|
|
49
53
|
- **Structured parsers** -- Some supported read-only commands can return both raw text and parsed output.
|
|
50
54
|
- **Blocking mitigations** -- Disables pagers (`GIT_PAGER=cat`, `PAGER=cat`), suppresses PowerShell progress output, and sets UTF-8 for `cmd.exe` on Windows.
|
|
51
55
|
- **Special key support** -- Can send Ctrl+C, Tab, arrow keys, and similar keys without manually constructing escape sequences.
|
|
52
|
-
- **
|
|
56
|
+
- **Process group cleanup** -- `terminal_stop` kills the entire process group on Unix, preventing orphan child processes.
|
|
57
|
+
- **Session management** -- Supports named sessions, idle cleanup, and up to 10 concurrent sessions. Session IDs are human-readable (e.g. `calm-reef`).
|
|
53
58
|
- **Shell auto-detection** -- Windows: `pwsh.exe` > `powershell.exe` > `cmd.exe`. Linux/macOS: `$SHELL` > `bash` > `sh`.
|
|
54
59
|
|
|
55
60
|
Progress notifications are not the same as full stdout streaming. They currently send periodic status updates for `terminal_exec` and `terminal_wait`, usually based on elapsed time and the latest output line. Whether you see them depends on your MCP client.
|
|
@@ -60,21 +65,30 @@ This MCP does not magically compress terminal output, but it **can help agents u
|
|
|
60
65
|
|
|
61
66
|
The main benefit is **model-context efficiency**, not guaranteed savings in the underlying command's runtime or total bytes produced.
|
|
62
67
|
|
|
68
|
+
### Polling and long-running processes
|
|
69
|
+
|
|
70
|
+
- Use **`terminal_read({ since })`** to read incrementally. Each call returns only new output since the last `position`, instead of re-reading the full buffer. Reduces token usage by up to ~87% on repeated polling.
|
|
71
|
+
- Use **`terminal_watch`** instead of a manual poll loop when waiting for a specific pattern. A single call returns on match, quiet, timeout, or exit — reduces token usage by up to ~99% for log-watching workflows.
|
|
72
|
+
- Use **`terminal_exec({ quietExitMs })`** for long-running commands (dev servers, watchers) that never produce a completion marker. Returns early when output stops, instead of waiting for a hard timeout. Reduces token usage by up to ~94%.
|
|
73
|
+
|
|
74
|
+
### Output size control
|
|
75
|
+
|
|
63
76
|
- Use **`terminal_run_paged`** for large read-only output when **the agent** wants one page of the returned result at a time.
|
|
64
77
|
- Lower **`maxLines`**, **`pageSize`**, or **`tailLines`** when **the agent** only needs a narrow slice of the output.
|
|
65
78
|
- Use **`summary: true`** or **`parseOnly: true`** with `terminal_run` when **the agent** benefits more from structured results than raw text.
|
|
66
79
|
- Use **`terminal_wait({ returnMode: "match-only" })`** when the agent only needs to know whether a pattern appeared.
|
|
67
80
|
- Use **`terminal_get_history`** when **the agent** needs to revisit earlier output without re-dumping the whole session into the conversation.
|
|
81
|
+
- Use **`terminal_stop({ transcriptPath })`** to offload large session history to disk instead of returning it in the response.
|
|
68
82
|
|
|
69
83
|
In practice, this lets agents inspect terminal state more selectively instead of repeatedly dumping large logs back into the conversation.
|
|
70
84
|
|
|
71
85
|
### Reducing tool definition overhead
|
|
72
86
|
|
|
73
|
-
By default, the 8 most-used tools are registered with full schemas and
|
|
87
|
+
By default, the 8 most-used tools are registered with full schemas and 8 convenience tools are collected behind a single lightweight `terminal_extra` meta-tool (~30 tokens instead of ~1,700).
|
|
74
88
|
|
|
75
89
|
**Default core tools**: `terminal_start`, `terminal_exec`, `terminal_run`, `terminal_read`, `terminal_write`, `terminal_wait`, `terminal_stop`, `terminal_list`
|
|
76
90
|
|
|
77
|
-
**Default extra tools** (behind `terminal_extra`): `terminal_run_paged`, `terminal_retry`, `terminal_diff`, `terminal_resize`, `terminal_send_key`, `terminal_get_history`, `terminal_write_file`
|
|
91
|
+
**Default extra tools** (behind `terminal_extra`): `terminal_run_paged`, `terminal_retry`, `terminal_diff`, `terminal_resize`, `terminal_send_key`, `terminal_get_history`, `terminal_write_file`, `terminal_watch`
|
|
78
92
|
|
|
79
93
|
Extra tools are **not hidden** — the agent sees the tool names in the `terminal_extra` description and can:
|
|
80
94
|
|
|
@@ -101,21 +115,21 @@ Use `SMART_TERMINAL_DISABLED_TOOLS` to customize which tools are extra, or set i
|
|
|
101
115
|
|
|
102
116
|
```json
|
|
103
117
|
"env": {
|
|
104
|
-
"SMART_TERMINAL_DISABLED_TOOLS": "terminal_run,terminal_run_paged,terminal_retry,terminal_diff,terminal_write_file,terminal_resize,terminal_send_key,terminal_get_history"
|
|
118
|
+
"SMART_TERMINAL_DISABLED_TOOLS": "terminal_run,terminal_run_paged,terminal_retry,terminal_diff,terminal_write_file,terminal_resize,terminal_send_key,terminal_get_history,terminal_watch"
|
|
105
119
|
}
|
|
106
120
|
```
|
|
107
121
|
|
|
108
|
-
5 core tools + `terminal_extra` holding
|
|
122
|
+
5 core tools + `terminal_extra` holding 9 tools on demand.
|
|
109
123
|
|
|
110
|
-
**Agent-focused setup**
|
|
124
|
+
**Agent-focused setup** -- `terminal_run` instead of `terminal_exec`:
|
|
111
125
|
|
|
112
126
|
```json
|
|
113
127
|
"env": {
|
|
114
|
-
"SMART_TERMINAL_DISABLED_TOOLS": "terminal_exec,terminal_diff,terminal_retry,terminal_resize,terminal_send_key,terminal_write,terminal_read,terminal_get_history"
|
|
128
|
+
"SMART_TERMINAL_DISABLED_TOOLS": "terminal_exec,terminal_diff,terminal_retry,terminal_resize,terminal_send_key,terminal_write,terminal_read,terminal_get_history,terminal_watch"
|
|
115
129
|
}
|
|
116
130
|
```
|
|
117
131
|
|
|
118
|
-
7 core tools + `terminal_extra` holding
|
|
132
|
+
7 core tools + `terminal_extra` holding 9 tools on demand.
|
|
119
133
|
|
|
120
134
|
## Installation
|
|
121
135
|
|
|
@@ -183,7 +197,7 @@ If you want to pin an exact release instead of following the stable tag, replace
|
|
|
183
197
|
|
|
184
198
|
## Tools
|
|
185
199
|
|
|
186
|
-
By default, 8 core tools are registered with full schemas and
|
|
200
|
+
By default, 8 core tools are registered with full schemas and 8 convenience tools are available on demand via `terminal_extra` (see [Reducing tool definition overhead](#reducing-tool-definition-overhead)).
|
|
187
201
|
|
|
188
202
|
### Core tools
|
|
189
203
|
|
|
@@ -212,8 +226,10 @@ Execute a command with deterministic completion detection. Large outputs are tru
|
|
|
212
226
|
| `command` | string | *required* | Command to execute |
|
|
213
227
|
| `timeout` | number | 30000 | Timeout in ms (max 10min) |
|
|
214
228
|
| `maxLines` | number | 200 | Max output lines before truncation |
|
|
229
|
+
| `quietExitMs` | number | -- | Return early if output is silent for N ms |
|
|
230
|
+
| `minOutputBytes` | number | 1 | Min bytes before quiet detection can trigger |
|
|
215
231
|
|
|
216
|
-
**Returns**: `output`, `exitCode`, `cwd`, `timedOut`
|
|
232
|
+
**Returns**: `output`, `exitCode`, `cwd`, `timedOut`, optional `quietExited`, optional `hint`
|
|
217
233
|
|
|
218
234
|
### `terminal_run`
|
|
219
235
|
|
|
@@ -246,7 +262,7 @@ Write raw data to a terminal (for interactive programs). Follow with `terminal_r
|
|
|
246
262
|
|
|
247
263
|
### `terminal_read`
|
|
248
264
|
|
|
249
|
-
Read buffered output with idle detection. Large outputs are truncated to head + tail based on `maxLines`.
|
|
265
|
+
Read buffered output with idle detection. Large outputs are truncated to head + tail based on `maxLines`. Pass `since` to read incrementally — returns only output emitted after the given byte position.
|
|
250
266
|
|
|
251
267
|
| Param | Type | Default | Description |
|
|
252
268
|
|-------|------|---------|-------------|
|
|
@@ -254,8 +270,9 @@ Read buffered output with idle detection. Large outputs are truncated to head +
|
|
|
254
270
|
| `timeout` | number | 30000 | Hard timeout in ms |
|
|
255
271
|
| `idleTimeout` | number | 500 | Return after this many ms of silence |
|
|
256
272
|
| `maxLines` | number | 200 | Max output lines |
|
|
273
|
+
| `since` | number | -- | Byte position from a prior read response |
|
|
257
274
|
|
|
258
|
-
**Returns**: `output`, `timedOut`
|
|
275
|
+
**Returns**: `output`, `timedOut`, `position`, optional `truncated`
|
|
259
276
|
|
|
260
277
|
### `terminal_wait`
|
|
261
278
|
|
|
@@ -273,11 +290,15 @@ Wait for a specific pattern in the output stream. By default, responses return o
|
|
|
273
290
|
|
|
274
291
|
### `terminal_stop`
|
|
275
292
|
|
|
276
|
-
Stop and clean up a terminal session.
|
|
293
|
+
Stop and clean up a terminal session. Optionally capture a snapshot of recent output or write the full transcript to disk before stopping. On Unix, kills the entire process group to prevent orphan child processes.
|
|
277
294
|
|
|
278
|
-
| Param | Type | Description |
|
|
279
|
-
|
|
280
|
-
| `sessionId` | string | Session ID to stop |
|
|
295
|
+
| Param | Type | Default | Description |
|
|
296
|
+
|-------|------|---------|-------------|
|
|
297
|
+
| `sessionId` | string | *required* | Session ID to stop |
|
|
298
|
+
| `snapshotLines` | number | 0 | Return last N lines of output (0 = none) |
|
|
299
|
+
| `transcriptPath` | string | -- | Write full history to this absolute path |
|
|
300
|
+
|
|
301
|
+
**Returns**: `success`, `message`, optional `snapshot`, optional `transcript`
|
|
281
302
|
|
|
282
303
|
### `terminal_list`
|
|
283
304
|
|
|
@@ -401,12 +422,36 @@ Write content directly to a file on disk. Resolves paths relative to the session
|
|
|
401
422
|
|
|
402
423
|
**Returns**: `success`, `path` (absolute), `size` (bytes), `append`
|
|
403
424
|
|
|
425
|
+
### `terminal_watch`
|
|
426
|
+
|
|
427
|
+
Wait for one or more trigger patterns in session output. Returns on first match, quiet detection, timeout, or process exit. Replaces manual poll loops — a single call blocks until an event fires.
|
|
428
|
+
|
|
429
|
+
| Param | Type | Default | Description |
|
|
430
|
+
|-------|------|---------|-------------|
|
|
431
|
+
| `sessionId` | string | *required* | Session ID |
|
|
432
|
+
| `triggers` | array | *required* | 1–10 trigger objects (see below) |
|
|
433
|
+
| `timeout` | number | 60000 | Hard timeout in ms (max 1hr) |
|
|
434
|
+
| `quietExitMs` | number | -- | Return if no output for N ms |
|
|
435
|
+
| `contextLines` | number | 3 | Lines of context before match |
|
|
436
|
+
| `since` | number | -- | Only match output after this byte position |
|
|
437
|
+
|
|
438
|
+
**Trigger object**:
|
|
439
|
+
|
|
440
|
+
| Field | Type | Default | Description |
|
|
441
|
+
|-------|------|---------|-------------|
|
|
442
|
+
| `id` | string | *required* | Label returned in response |
|
|
443
|
+
| `pattern` | string | *required* | Regex or literal pattern |
|
|
444
|
+
| `isRegex` | boolean | `true` | Set `false` for literal match |
|
|
445
|
+
| `cooldownMs` | number | 0 | Min ms between matches for this trigger |
|
|
446
|
+
|
|
447
|
+
**Returns**: `reason` (`trigger`/`quiet`/`timeout`/`exit`), `position`, `timedOut`, optional `triggerId`, `matchedLine`, `context`
|
|
448
|
+
|
|
404
449
|
## Usage Examples
|
|
405
450
|
|
|
406
451
|
### Run a command
|
|
407
452
|
|
|
408
453
|
```
|
|
409
|
-
terminal_start() -> { sessionId: "
|
|
454
|
+
terminal_start() -> { sessionId: "calm-reef" }
|
|
410
455
|
terminal_exec({ sessionId, command: "ls -la" }) -> { output: "...", exitCode: 0, cwd: "/home/user" }
|
|
411
456
|
```
|
|
412
457
|
|
|
@@ -461,6 +506,42 @@ terminal_wait({ sessionId, pattern: "listening on port", timeout: 60000 })
|
|
|
461
506
|
terminal_wait({ sessionId, pattern: "listening on port", returnMode: "full" })
|
|
462
507
|
```
|
|
463
508
|
|
|
509
|
+
### Watch for build events
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
terminal_extra({ tool: "terminal_watch", args: {
|
|
513
|
+
sessionId,
|
|
514
|
+
triggers: [
|
|
515
|
+
{ id: "success", pattern: "webpack: Compiled successfully" },
|
|
516
|
+
{ id: "error", pattern: "ERROR in" }
|
|
517
|
+
],
|
|
518
|
+
timeout: 120000,
|
|
519
|
+
quietExitMs: 10000
|
|
520
|
+
}})
|
|
521
|
+
-> { reason: "trigger", triggerId: "success", matchedLine: "webpack: Compiled successfully", context: [...], position: 184320 }
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Incrementally poll a build log
|
|
525
|
+
|
|
526
|
+
```
|
|
527
|
+
const r1 = terminal_read({ sessionId }) -> { output: "Building...", position: 5000 }
|
|
528
|
+
const r2 = terminal_read({ sessionId, since: 5000 }) -> { output: "Done.", position: 5200 }
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### Quiet-exit a dev server
|
|
532
|
+
|
|
533
|
+
```
|
|
534
|
+
terminal_exec({ sessionId, command: "npm run dev", quietExitMs: 3000, minOutputBytes: 50 })
|
|
535
|
+
-> { output: "webpack: Compiled successfully", quietExited: true, hint: "Command is still running..." }
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Stop with a transcript
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
terminal_stop({ sessionId, snapshotLines: 20, transcriptPath: "/tmp/session.log" })
|
|
542
|
+
-> { success: true, snapshot: { text: "...", lineCount: 20, totalLines: 500 }, transcript: { path: "/tmp/session.log", bytes: 12345 } }
|
|
543
|
+
```
|
|
544
|
+
|
|
464
545
|
### Retry a flaky command
|
|
465
546
|
|
|
466
547
|
```
|
|
@@ -487,6 +568,7 @@ src/
|
|
|
487
568
|
pty-session.js PTY session: marker injection, idle read, buffer mgmt
|
|
488
569
|
smart-tools.js Retry and diff helpers for higher-level terminal tools
|
|
489
570
|
regex-utils.js Shared user-regex validation and compilation
|
|
571
|
+
session-id.js Human-readable session ID generation
|
|
490
572
|
session-manager.js Session lifecycle, TTL cleanup, concurrency limits
|
|
491
573
|
shell-detector.js Cross-platform shell auto-detection
|
|
492
574
|
ansi.js ANSI escape code stripping
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-terminal-mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.36",
|
|
4
4
|
"description": "MCP PTY server providing AI agents with real interactive terminal access",
|
|
5
5
|
"mcpName": "io.github.pungggi/smart-terminal",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "node src/index.js",
|
|
17
17
|
"test": "node --test",
|
|
18
|
-
"stable": "npm dist-tag add smart-terminal-mcp@1.2.
|
|
18
|
+
"stable": "npm dist-tag add smart-terminal-mcp@1.2.35 stable",
|
|
19
19
|
"release": "node scripts/publish.js"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
package/server-card.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"serverInfo": {
|
|
3
3
|
"name": "smart-terminal-mcp",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.36"
|
|
5
5
|
},
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
@@ -65,6 +65,18 @@
|
|
|
65
65
|
"minimum": 10,
|
|
66
66
|
"maximum": 10000,
|
|
67
67
|
"default": 200
|
|
68
|
+
},
|
|
69
|
+
"quietExitMs": {
|
|
70
|
+
"type": "integer",
|
|
71
|
+
"minimum": 500,
|
|
72
|
+
"maximum": 600000,
|
|
73
|
+
"description": "Exit if silent for N ms"
|
|
74
|
+
},
|
|
75
|
+
"minOutputBytes": {
|
|
76
|
+
"type": "integer",
|
|
77
|
+
"minimum": 0,
|
|
78
|
+
"default": 1,
|
|
79
|
+
"description": "Min bytes before quiet exit"
|
|
68
80
|
}
|
|
69
81
|
},
|
|
70
82
|
"required": [
|
|
@@ -200,6 +212,11 @@
|
|
|
200
212
|
"minimum": 10,
|
|
201
213
|
"maximum": 10000,
|
|
202
214
|
"default": 200
|
|
215
|
+
},
|
|
216
|
+
"since": {
|
|
217
|
+
"type": "integer",
|
|
218
|
+
"minimum": 0,
|
|
219
|
+
"description": "Byte position for inc. read"
|
|
203
220
|
}
|
|
204
221
|
},
|
|
205
222
|
"required": [
|
|
@@ -259,6 +276,17 @@
|
|
|
259
276
|
"properties": {
|
|
260
277
|
"sessionId": {
|
|
261
278
|
"type": "string"
|
|
279
|
+
},
|
|
280
|
+
"snapshotLines": {
|
|
281
|
+
"type": "integer",
|
|
282
|
+
"minimum": 0,
|
|
283
|
+
"maximum": 2000,
|
|
284
|
+
"default": 0,
|
|
285
|
+
"description": "Return last N lines. 0 = none."
|
|
286
|
+
},
|
|
287
|
+
"transcriptPath": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"description": "Write history to this path"
|
|
262
290
|
}
|
|
263
291
|
},
|
|
264
292
|
"required": [
|
|
@@ -285,7 +313,7 @@
|
|
|
285
313
|
},
|
|
286
314
|
{
|
|
287
315
|
"name": "terminal_extra",
|
|
288
|
-
"description": "
|
|
316
|
+
"description": "8 more tools: terminal_run_paged, terminal_get_history, terminal_resize, terminal_send_key, terminal_watch, terminal_retry, terminal_diff, terminal_write_file. list=true for full schemas, or pass tool + args to call.",
|
|
289
317
|
"inputSchema": {
|
|
290
318
|
"type": "object",
|
|
291
319
|
"properties": {
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/pungggi/smart-terminal-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.36",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "smart-terminal-mcp",
|
|
14
|
-
"version": "1.2.
|
|
14
|
+
"version": "1.2.36",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|
package/smithery.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pungggi/smart-terminal",
|
|
3
3
|
"description": "MCP PTY server providing AI agents with real interactive terminal access",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.36",
|
|
5
5
|
"repository": "https://github.com/pungggi/smart-terminal-mcp",
|
|
6
6
|
"tags": [
|
|
7
7
|
"terminal",
|
package/src/command-runner.js
CHANGED
|
@@ -386,7 +386,7 @@ function formatStartError({ cmd, err }) {
|
|
|
386
386
|
return baseMessage;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
return `${baseMessage}. Verify it is installed and on PATH for the server process. For shell built-ins, pipes, or redirections,
|
|
389
|
+
return `${baseMessage}. Verify it is installed and on PATH for the server process. For shell built-ins, pipes, or redirections, use shell:true. Alternatively, start an interactive session with terminal_start.`;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
export function getStructuredParserHint({ cmd, args, ok, parseRequested, parsed, stdout }) {
|
package/src/index.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
|
|
3
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
8
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
9
|
import { SessionManager } from './session-manager.js';
|
|
6
10
|
import { registerTools } from './tools.js';
|
|
7
11
|
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
|
|
14
|
+
const version = pkg.version;
|
|
15
|
+
|
|
8
16
|
const log = (msg) => process.stderr.write(`[smart-terminal-mcp] ${msg}\n`);
|
|
9
17
|
|
|
10
18
|
export function createSandboxServer() {
|
|
11
19
|
const server = new McpServer({
|
|
12
20
|
name: 'smart-terminal-mcp',
|
|
13
|
-
version
|
|
21
|
+
version,
|
|
14
22
|
});
|
|
15
23
|
const manager = new SessionManager();
|
|
16
24
|
registerTools(server, manager);
|
|
@@ -22,7 +30,7 @@ async function main() {
|
|
|
22
30
|
const manager = new SessionManager();
|
|
23
31
|
const server = new McpServer({
|
|
24
32
|
name: 'smart-terminal-mcp',
|
|
25
|
-
version
|
|
33
|
+
version,
|
|
26
34
|
});
|
|
27
35
|
registerTools(server, manager);
|
|
28
36
|
|