terminal-sessions-mcp 1.2.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/2025-11-09 20.00.53.gif +0 -0
- package/CHANGELOG.md +98 -0
- package/LICENSE +22 -0
- package/README.md +357 -0
- package/dist/cli/session-cli.d.ts +3 -0
- package/dist/cli/session-cli.d.ts.map +1 -0
- package/dist/cli/session-cli.js +377 -0
- package/dist/cli/session-cli.js.map +1 -0
- package/dist/gui/src/server.d.ts +16 -0
- package/dist/gui/src/server.d.ts.map +1 -0
- package/dist/gui/src/server.js +212 -0
- package/dist/gui/src/server.js.map +1 -0
- package/dist/gui/src/start-gui.d.ts +6 -0
- package/dist/gui/src/start-gui.d.ts.map +1 -0
- package/dist/gui/src/start-gui.js +20 -0
- package/dist/gui/src/start-gui.js.map +1 -0
- package/gui/public/app.js +367 -0
- package/gui/public/index.html +305 -0
- package/htop-perfect.png +0 -0
- package/htop-xterm-fix.png +0 -0
- package/package.json +63 -0
- package/run-art.sh +7 -0
- package/terminal-art-adaptive-test.png +0 -0
- package/terminal-art-debug-screenshot.png +0 -0
- package/terminal-art-final.png +0 -0
- package/terminal-art-fixed-final.png +0 -0
- package/terminal-art-nowrap-test.png +0 -0
- package/terminal-art-screenshot.png +0 -0
- package/terminal-art-showcase.png +0 -0
- package/terminal-art-stable-test.png +0 -0
- package/terminal_streams_art_continuous.py +309 -0
- package/test-htop-screenshot.png +0 -0
- package/test-htop-working.png +0 -0
|
Binary file
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.2.0 - 2024-11-09
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Direct Keyboard Input** ⌨️ - Type directly in the terminal, all keys forwarded to PTY
|
|
8
|
+
- Arrow keys (←↑↓→)
|
|
9
|
+
- Modifier keys (Ctrl, Alt, Shift)
|
|
10
|
+
- Tab completion
|
|
11
|
+
- All special characters
|
|
12
|
+
- Real terminal experience in the browser
|
|
13
|
+
- **Signal Controls** - Practical buttons for process management
|
|
14
|
+
- ^C button (SIGINT) - Interrupt processes
|
|
15
|
+
- ^Z button (SIGTSTP) - Suspend processes
|
|
16
|
+
- TERM button (SIGTERM) - Terminate gracefully
|
|
17
|
+
- Replaces less useful screenshot button
|
|
18
|
+
- **Web GUI** 🎨 - Beautiful web interface for terminal session management
|
|
19
|
+
- xterm.js-based terminal rendering with full TUI support
|
|
20
|
+
- Dashboard showing all active sessions
|
|
21
|
+
- Live Socket.IO updates
|
|
22
|
+
- Interactive command input
|
|
23
|
+
- Screenshot button to capture rendered terminal
|
|
24
|
+
- GitHub dark theme UI
|
|
25
|
+
- Accessible at http://localhost:3200
|
|
26
|
+
- **Proper TUI Support** - All terminal control sequences work correctly:
|
|
27
|
+
- Cursor positioning (`\033[row;colH`)
|
|
28
|
+
- Screen clearing (`\033[2J`)
|
|
29
|
+
- All ANSI colors and formatting
|
|
30
|
+
- Box drawing characters
|
|
31
|
+
- Progress bars with proper positioning
|
|
32
|
+
- **Live Event Streaming** - RobustSessionClient now emits WebSocket events
|
|
33
|
+
- Binary command: `session-gui` for starting web interface
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Screenshots now properly render TUI control sequences (via web GUI's xterm.js)
|
|
38
|
+
- Event forwarding from session server → GUI server → browser clients
|
|
39
|
+
|
|
40
|
+
## v1.1.0 - 2024-11-09
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **Terminal Screenshots** 📸 - Capture visual terminal output including:
|
|
45
|
+
- ANSI colors and formatting
|
|
46
|
+
- TUIs (terminal user interfaces)
|
|
47
|
+
- Progress bars and spinners
|
|
48
|
+
- ASCII/ANSI art
|
|
49
|
+
- Colorized log output
|
|
50
|
+
- Returns base64 or saves to file
|
|
51
|
+
- Configurable resolution and line count
|
|
52
|
+
- New MCP tool: `takeScreenshot`
|
|
53
|
+
- Dependencies: `ansi-to-html`, `puppeteer`
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Infinite reconnection** - RobustSessionClient now retries indefinitely instead of giving up after 5 attempts
|
|
58
|
+
- Reconnection delay caps at 5 seconds (was 30 seconds)
|
|
59
|
+
- Handles server restarts gracefully without manual intervention
|
|
60
|
+
|
|
61
|
+
## v1.0.0 - 2024-11-09
|
|
62
|
+
|
|
63
|
+
### Initial Release
|
|
64
|
+
|
|
65
|
+
Extracted from `connectome-ts` as a standalone, generally-useful package.
|
|
66
|
+
|
|
67
|
+
### Features
|
|
68
|
+
|
|
69
|
+
- **Persistent Terminal Sessions** - Real PTY-based shell sessions that maintain state
|
|
70
|
+
- **Smart Service Management** - Intelligent startup detection with ready/error patterns
|
|
71
|
+
- **Log Search** - Regex-based log search with context lines
|
|
72
|
+
- **MCP Integration** - Full Model Context Protocol support for AI assistants
|
|
73
|
+
- **WebSocket API** - Real-time bidirectional communication
|
|
74
|
+
- **Interactive Support** - Send input and signals to running processes
|
|
75
|
+
- **Robust Client** - Automatic reconnection with exponential backoff
|
|
76
|
+
- **CLI Tools** - Command-line interface for manual session management
|
|
77
|
+
|
|
78
|
+
### Components
|
|
79
|
+
|
|
80
|
+
- `PersistentSessionServer` - Core PTY session management
|
|
81
|
+
- `SessionAPI` - WebSocket API server
|
|
82
|
+
- `RobustSessionClient` - WebSocket client with auto-reconnection
|
|
83
|
+
- `ConnectomeTestingMCP` - MCP integration layer
|
|
84
|
+
- `session-cli` - Command-line tool
|
|
85
|
+
|
|
86
|
+
### Migration from connectome-ts
|
|
87
|
+
|
|
88
|
+
Files moved from `connectome-ts/src/testing/`:
|
|
89
|
+
- `session-server-v3.ts` → `src/server/session-server-v3.ts`
|
|
90
|
+
- `websocket-api.ts` → `src/server/websocket-api.ts`
|
|
91
|
+
- `start-session-server.ts` → `src/server/start-session-server.ts`
|
|
92
|
+
- `mcp-server.ts` → `src/mcp/mcp-server.ts`
|
|
93
|
+
- `mcp-stdio-server.ts` → `src/mcp/mcp-stdio-server.ts`
|
|
94
|
+
- `websocket-client.ts` → `src/client/websocket-client.ts`
|
|
95
|
+
- `session-cli.ts` → `cli/session-cli.ts`
|
|
96
|
+
|
|
97
|
+
All import paths updated to reflect new structure.
|
|
98
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Anima Labs
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# Terminal Sessions MCP
|
|
2
|
+
|
|
3
|
+
**Interactive, persistent terminal sessions for AI assistants via Model Context Protocol**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Why This Matters
|
|
8
|
+
|
|
9
|
+
While many AI tools offer basic command execution, Terminal Sessions MCP provides unique capabilities:
|
|
10
|
+
|
|
11
|
+
**What makes this different:**
|
|
12
|
+
- **Sessions survive IDE restarts** - Unlike typical tools, your sessions persist even when you close Cursor/Claude Desktop
|
|
13
|
+
- **Background tasks with log access** - Run dev servers, builds, or tests in background while retaining full access to their output
|
|
14
|
+
- **True interactivity** - Send input to prompts, handle confirmations, respond to interactive tools
|
|
15
|
+
- **Process control** - Send signals (Ctrl+C, Ctrl+Z) to gracefully manage long-running processes
|
|
16
|
+
- **Stateful environment** - `cd`, `export`, and environment changes persist across commands
|
|
17
|
+
- **Visual debugging** - Take screenshots of terminal output to debug TUI applications
|
|
18
|
+
- **Context search** - Search through command history and output with regex
|
|
19
|
+
|
|
20
|
+
Your AI assistant can now run servers in the background while working on other tasks, maintain persistent development environments, handle interactive workflows, and even build terminal UI applications with visual feedback.
|
|
21
|
+
|
|
22
|
+
## MCP Features
|
|
23
|
+
|
|
24
|
+
✅ **Truly Persistent Sessions** - Sessions survive Cursor/IDE restarts, keeping all state
|
|
25
|
+
✅ **Interactive Workflows** - Handle password prompts, confirmations, and interactive tools
|
|
26
|
+
✅ **Build & Debug TUIs** - Develop terminal UI apps with visual feedback via screenshots
|
|
27
|
+
✅ **Process Control** - Send signals (SIGINT, SIGTERM, SIGTSTP) to running processes
|
|
28
|
+
✅ **Stateful Shell** - `cd`, `export`, and other state changes persist across AI responses
|
|
29
|
+
✅ **Log Search** - Search through command history and output with regex and context
|
|
30
|
+
✅ **Service Management** - Start services with intelligent readiness detection
|
|
31
|
+
✅ **Smart Command Execution** - Detects when commands complete, handles long-running processes
|
|
32
|
+
✅ **Multi-Session Management** - Track multiple services/sessions by name
|
|
33
|
+
✅ **Terminal Screenshots** - Capture visually rich terminal output for debugging
|
|
34
|
+
✅ **Real-Time Streaming** - Watch output as it happens, not just final results
|
|
35
|
+
|
|
36
|
+
## Quick Start for AI Assistants
|
|
37
|
+
|
|
38
|
+
### 1. Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install terminal-sessions-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Start the Session Server
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx session-server
|
|
48
|
+
# Starts on port 3100 (with optional GUI on port 3200)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Headless mode (no GUI):**
|
|
52
|
+
```bash
|
|
53
|
+
npx session-server --headless
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Configure MCP Integration
|
|
57
|
+
|
|
58
|
+
Add to your `~/.cursor/mcp.json` or Claude Desktop config:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"connectome-session": {
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["ts-node", "/absolute/path/to/terminal-sessions-mcp/src/mcp/mcp-stdio-server.ts"],
|
|
66
|
+
"cwd": "/absolute/path/to/terminal-sessions-mcp",
|
|
67
|
+
"env": {
|
|
68
|
+
"SESSION_SERVER_PORT": "3100"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Note:** Replace `/absolute/path/to/` with your actual installation path. The session server must be running on the specified port before the MCP server connects.
|
|
76
|
+
|
|
77
|
+
### 4. Use with Your AI Assistant
|
|
78
|
+
|
|
79
|
+
Your AI assistant now has access to these MCP tools:
|
|
80
|
+
|
|
81
|
+
- `startService` - Start a service with readiness detection
|
|
82
|
+
- `runCommand` - Execute a command in a session
|
|
83
|
+
- `tailLogs` - Get recent output from a session
|
|
84
|
+
- `searchLogs` - Search through output with regex
|
|
85
|
+
- `sendInput` - Send input to interactive prompts
|
|
86
|
+
- `sendSignal` - Send signals (Ctrl+C, etc.) to processes
|
|
87
|
+
- `listSessions` - See all active sessions
|
|
88
|
+
- `killSession` - Stop a session gracefully or forcefully
|
|
89
|
+
- `takeScreenshot` - Capture terminal visual state
|
|
90
|
+
|
|
91
|
+
## Web GUI (Optional)
|
|
92
|
+
|
|
93
|
+
The server includes an optional web-based GUI for human operators to monitor and interact with sessions:
|
|
94
|
+
|
|
95
|
+
**Features:**
|
|
96
|
+
- 📊 Dashboard showing all active sessions with live status
|
|
97
|
+
- 🖥️ Full xterm.js terminal emulator with 256-color support
|
|
98
|
+
- 🖱️ Complete mouse support in TUI apps (Midnight Commander, htop, etc.)
|
|
99
|
+
- ⌨️ Direct keyboard input with proper key code forwarding
|
|
100
|
+
- 📐 Automatic resize handling for perfect coordinate mapping
|
|
101
|
+
- 🎨 Beautiful GitHub-inspired dark theme
|
|
102
|
+
- 🔄 Real-time output streaming
|
|
103
|
+
- ⚡ Signal controls (Ctrl+C, Ctrl+Z, SIGTERM)
|
|
104
|
+
|
|
105
|
+
**Access:** Open `http://localhost:3200` when running with GUI enabled (default), or use `--headless` to disable.
|
|
106
|
+
|
|
107
|
+
## TUI Control Sequences Support
|
|
108
|
+
|
|
109
|
+
All terminal control sequences work perfectly, enabling rich TUI applications:
|
|
110
|
+
|
|
111
|
+
[](docs/screenshots/tui-controls.png)
|
|
112
|
+
|
|
113
|
+
- ✅ **Cursor positioning** - `\033[row;colH`
|
|
114
|
+
- ✅ **Screen clearing** - `\033[2J\033[H`
|
|
115
|
+
- ✅ **Colors & formatting** - All ANSI codes (30-37, 40-47, bold, dim, etc.)
|
|
116
|
+
- ✅ **Progress bars** - Dynamic updates with proper positioning
|
|
117
|
+
- ✅ **Box drawing** - UTF-8 box characters (╔═══╗)
|
|
118
|
+
- ✅ **Live TUIs** - htop, vim, tmux, custom TUI apps
|
|
119
|
+
|
|
120
|
+
## API Usage
|
|
121
|
+
|
|
122
|
+
### From TypeScript/JavaScript
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { SessionClient } from 'terminal-sessions-mcp';
|
|
126
|
+
|
|
127
|
+
const client = new SessionClient('ws://localhost:3100');
|
|
128
|
+
|
|
129
|
+
// Create a session
|
|
130
|
+
await client.createSession({ id: 'my-session' });
|
|
131
|
+
|
|
132
|
+
// Execute commands
|
|
133
|
+
const result = await client.exec('my-session', 'npm test');
|
|
134
|
+
console.log(result.output);
|
|
135
|
+
|
|
136
|
+
// Search logs
|
|
137
|
+
const matches = await client.searchLogs('my-session', 'error|warning', 5);
|
|
138
|
+
|
|
139
|
+
// Take a screenshot (includes all colors and formatting!)
|
|
140
|
+
const screenshot = await client.takeScreenshot('my-session', {
|
|
141
|
+
lines: 50,
|
|
142
|
+
outputPath: './terminal.png'
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Architecture
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────────────────────────────────────┐
|
|
150
|
+
│ Web GUI (http://localhost:3200) │
|
|
151
|
+
│ - xterm.js terminal rendering │
|
|
152
|
+
│ - Live Socket.IO updates │
|
|
153
|
+
│ - Session dashboard │
|
|
154
|
+
└─────────────────────────────────────────────────┘
|
|
155
|
+
↕ Socket.IO
|
|
156
|
+
┌─────────────────────────────────────────────────┐
|
|
157
|
+
│ Session Server (ws://localhost:3100) │
|
|
158
|
+
│ - PTY-based persistent sessions │
|
|
159
|
+
│ - WebSocket API │
|
|
160
|
+
│ - Event streaming │
|
|
161
|
+
└─────────────────────────────────────────────────┘
|
|
162
|
+
↕ MCP Protocol
|
|
163
|
+
┌─────────────────────────────────────────────────┐
|
|
164
|
+
│ AI Assistant (Cursor, Claude, etc.) │
|
|
165
|
+
│ - 10 MCP tools for session management │
|
|
166
|
+
│ - Start services, run commands │
|
|
167
|
+
│ - Take screenshots │
|
|
168
|
+
└─────────────────────────────────────────────────┘
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Available Tools (MCP)
|
|
172
|
+
|
|
173
|
+
Once configured, your AI assistant will have access to these tools:
|
|
174
|
+
|
|
175
|
+
### Session Management
|
|
176
|
+
- **startService** - Start a long-running service with startup detection
|
|
177
|
+
- **runCommand** - Execute a command and wait for completion
|
|
178
|
+
- **listSessions** - Get all active sessions
|
|
179
|
+
- **killSession** - Terminate a specific session (graceful by default)
|
|
180
|
+
- **killAll** - Terminate all active sessions
|
|
181
|
+
|
|
182
|
+
### Interactive Operations
|
|
183
|
+
- **sendInput** - Send input to a running process
|
|
184
|
+
- **sendSignal** - Send a signal (SIGINT, SIGTERM, etc)
|
|
185
|
+
|
|
186
|
+
### Log Operations
|
|
187
|
+
- **tailLogs** - Get recent logs from a session
|
|
188
|
+
- **searchLogs** - Search logs with regex patterns and context
|
|
189
|
+
- **takeScreenshot** - Capture terminal screenshot with proper TUI rendering 📸
|
|
190
|
+
|
|
191
|
+
## CLI Usage
|
|
192
|
+
|
|
193
|
+
The package includes a CLI tool for manual session management:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# List sessions
|
|
197
|
+
npx session-cli list
|
|
198
|
+
|
|
199
|
+
# Create a session
|
|
200
|
+
npx session-cli create my-session --cwd=/path/to/dir
|
|
201
|
+
|
|
202
|
+
# Execute a command
|
|
203
|
+
npx session-cli exec my-session "npm test"
|
|
204
|
+
|
|
205
|
+
# Tail logs
|
|
206
|
+
npx session-cli tail my-session --lines=100
|
|
207
|
+
|
|
208
|
+
# Subscribe to live events
|
|
209
|
+
npx session-cli subscribe my-session --replay=50
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Web GUI Usage
|
|
213
|
+
|
|
214
|
+
Start the web GUI to visually manage all your terminal sessions:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Start on default port (3200)
|
|
218
|
+
npx session-gui
|
|
219
|
+
|
|
220
|
+
# Or custom port
|
|
221
|
+
GUI_PORT=8080 npx session-gui
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Then open http://localhost:3200 in your browser to:
|
|
225
|
+
- View all active sessions in a sidebar
|
|
226
|
+
- Click any session to see its xterm.js rendered terminal
|
|
227
|
+
- Type commands directly in the web interface
|
|
228
|
+
- Watch live updates stream in real-time
|
|
229
|
+
- Take screenshots from the rendered terminal
|
|
230
|
+
- Monitor multiple services simultaneously
|
|
231
|
+
|
|
232
|
+
## Terminal Screenshots 📸
|
|
233
|
+
|
|
234
|
+
Perfect for debugging visually rich terminal applications:
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
// Capture a TUI, progress bar, or ANSI art
|
|
238
|
+
const result = await client.takeScreenshot('my-session', {
|
|
239
|
+
lines: 50, // How many lines to capture
|
|
240
|
+
outputPath: './screenshot.png', // Save to file
|
|
241
|
+
width: 1200, // Image width
|
|
242
|
+
height: 800 // Image height
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Or get base64 (omit outputPath) - displays inline in MCP!
|
|
246
|
+
const { base64 } = await client.takeScreenshot('my-session');
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Use cases:**
|
|
250
|
+
- 📊 Debugging progress bars and spinners
|
|
251
|
+
- 🎨 Capturing ANSI art and colors
|
|
252
|
+
- 🖥️ Visual regression testing of CLI tools
|
|
253
|
+
- 📝 Documenting terminal applications
|
|
254
|
+
- 🔍 Sharing colorized logs with proper formatting
|
|
255
|
+
|
|
256
|
+
## Use Cases
|
|
257
|
+
|
|
258
|
+
### 1. AI-Assisted Development
|
|
259
|
+
|
|
260
|
+
Enable AI assistants to manage development services, run tests, and interact with terminal sessions without losing context between responses.
|
|
261
|
+
|
|
262
|
+
### 2. Multi-Service Testing
|
|
263
|
+
|
|
264
|
+
Start and monitor multiple services simultaneously, with intelligent startup detection and log search.
|
|
265
|
+
|
|
266
|
+
### 3. Visual Terminal Debugging
|
|
267
|
+
|
|
268
|
+
Capture screenshots of TUIs, progress bars, and ANSI art for debugging or documentation. The web GUI provides real-time visual feedback.
|
|
269
|
+
|
|
270
|
+
### 4. Interactive Debugging
|
|
271
|
+
|
|
272
|
+
AI assistants can interact with running processes, send input, and observe output in real-time.
|
|
273
|
+
|
|
274
|
+
### 5. Team Collaboration
|
|
275
|
+
|
|
276
|
+
Share terminal sessions between multiple agents or humans. Send a URL to view live terminal output.
|
|
277
|
+
|
|
278
|
+
## Development
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Clone the repository
|
|
282
|
+
git clone https://github.com/anima-labs/terminal-sessions-mcp.git
|
|
283
|
+
cd terminal-sessions-mcp
|
|
284
|
+
|
|
285
|
+
# Install dependencies
|
|
286
|
+
npm install
|
|
287
|
+
|
|
288
|
+
# Build
|
|
289
|
+
npm run build
|
|
290
|
+
|
|
291
|
+
# Start session server
|
|
292
|
+
npm run start-server
|
|
293
|
+
|
|
294
|
+
# Start web GUI
|
|
295
|
+
npm run start-gui
|
|
296
|
+
|
|
297
|
+
# Run CLI
|
|
298
|
+
npm run cli -- list
|
|
299
|
+
|
|
300
|
+
# Run demos
|
|
301
|
+
npx ts-node examples/screenshot-demo.ts
|
|
302
|
+
npx ts-node examples/service-management.ts
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Requirements
|
|
306
|
+
|
|
307
|
+
- **Node.js** >= 18.0.0
|
|
308
|
+
- **Headless Chrome** (via Puppeteer) for screenshots
|
|
309
|
+
- **Modern browser** for web GUI (Chrome, Firefox, Safari, Edge)
|
|
310
|
+
|
|
311
|
+
## Configuration
|
|
312
|
+
|
|
313
|
+
### Environment Variables
|
|
314
|
+
|
|
315
|
+
- `SESSION_SERVER_PORT` - WebSocket session server port (default: 3100)
|
|
316
|
+
- `GUI_PORT` - Web GUI port (default: 3200)
|
|
317
|
+
- `MCP_DEBUG` - Enable debug logging (set to "1")
|
|
318
|
+
|
|
319
|
+
## Troubleshooting
|
|
320
|
+
|
|
321
|
+
### MCP server not loading
|
|
322
|
+
|
|
323
|
+
1. Ensure the session server is running: `npx session-server`
|
|
324
|
+
2. Check that paths in mcp.json are absolute
|
|
325
|
+
3. Restart your AI assistant after configuration changes
|
|
326
|
+
4. Enable debug mode: `MCP_DEBUG=1`
|
|
327
|
+
|
|
328
|
+
### Web GUI not connecting
|
|
329
|
+
|
|
330
|
+
1. Ensure session server is running on port 3100
|
|
331
|
+
2. Check browser console for errors
|
|
332
|
+
3. Verify Socket.IO and xterm.js CDN libraries loaded
|
|
333
|
+
4. Try a different port if 3200 is occupied
|
|
334
|
+
|
|
335
|
+
### Screenshots failing
|
|
336
|
+
|
|
337
|
+
1. Ensure Puppeteer can launch headless Chrome
|
|
338
|
+
2. Check system resources (memory)
|
|
339
|
+
3. Try with fewer lines: `lines: 20`
|
|
340
|
+
|
|
341
|
+
## License
|
|
342
|
+
|
|
343
|
+
MIT
|
|
344
|
+
|
|
345
|
+
## Credits
|
|
346
|
+
|
|
347
|
+
Developed by [Anima Labs](https://github.com/anima-labs) as part of the Connectome project.
|
|
348
|
+
|
|
349
|
+
Extracted as a standalone package because terminal session management with proper TUI support is universally useful for AI-assisted development workflows.
|
|
350
|
+
|
|
351
|
+
## Contributing
|
|
352
|
+
|
|
353
|
+
Contributions welcome! Please open an issue or PR on GitHub.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
**Star ⭐ this repo if you find it useful!**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-cli.d.ts","sourceRoot":"","sources":["../../cli/session-cli.ts"],"names":[],"mappings":""}
|