mcp-ssh-manager 3.0.0 → 3.1.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/.claude/settings.local.json +10 -1
- package/CLAUDE.md +16 -0
- package/README.md +62 -0
- package/cli/commands/server.sh +27 -5
- package/cli/commands/tools.sh +603 -0
- package/cli/lib/config.sh +104 -14
- package/cli/lib/menu.sh +124 -0
- package/cli/ssh-manager +17 -7
- package/docs/TOOL_MANAGEMENT.md +473 -0
- package/package.json +5 -4
- package/scripts/validate.sh +12 -0
- package/src/backup-manager.js +12 -12
- package/src/command-aliases.js +16 -16
- package/src/config-loader.js +1 -1
- package/src/database-manager.js +38 -40
- package/src/deploy-helper.js +12 -13
- package/src/health-monitor.js +26 -26
- package/src/hooks-system.js +43 -43
- package/src/index.js +866 -832
- package/src/logger.js +53 -53
- package/src/profile-loader.js +14 -14
- package/src/server-aliases.js +11 -11
- package/src/server-groups.js +98 -97
- package/src/session-manager.js +59 -58
- package/src/ssh-key-manager.js +1 -1
- package/src/ssh-manager.js +44 -23
- package/src/tool-config-manager.js +434 -0
- package/src/tool-registry.js +196 -0
- package/src/tunnel-manager.js +98 -98
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
# Tool Management Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
MCP SSH Manager provides **37 tools** organized into **6 functional groups**. You can enable or disable tool groups to customize your experience and reduce context usage in Claude Code.
|
|
6
|
+
|
|
7
|
+
### Why Manage Tools?
|
|
8
|
+
|
|
9
|
+
- **Reduce Context Usage**: By default, all 37 tools consume ~43.5k tokens in Claude Code. Minimal mode uses only ~3.5k tokens (92% reduction)
|
|
10
|
+
- **Fewer Approval Prompts**: Only enabled tools require approval in Claude Code
|
|
11
|
+
- **Faster Loading**: Less tools mean faster MCP server startup
|
|
12
|
+
- **Cleaner Interface**: Only see the tools you actually use
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### View Current Configuration
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
ssh-manager tools list
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Interactive Configuration Wizard
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ssh-manager tools configure
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Choose from three modes:
|
|
29
|
+
1. **All tools** (37 tools) - Full feature set, recommended for most users
|
|
30
|
+
2. **Minimal** (5 tools) - Only core operations, maximum efficiency
|
|
31
|
+
3. **Custom** - Pick which groups to enable
|
|
32
|
+
|
|
33
|
+
### Enable/Disable Specific Groups
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Enable a group
|
|
37
|
+
ssh-manager tools enable monitoring
|
|
38
|
+
|
|
39
|
+
# Disable a group
|
|
40
|
+
ssh-manager tools disable backup
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Reset to Defaults
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ssh-manager tools reset
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Export Auto-Approval Configuration
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ssh-manager tools export-claude
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This generates configuration for Claude Code to auto-approve your enabled tools.
|
|
56
|
+
|
|
57
|
+
## Tool Groups
|
|
58
|
+
|
|
59
|
+
### Core (5 tools) ✨ Always Enabled
|
|
60
|
+
|
|
61
|
+
Essential SSH operations for basic functionality:
|
|
62
|
+
|
|
63
|
+
- `ssh_list_servers` - List all configured SSH servers
|
|
64
|
+
- `ssh_execute` - Execute commands on remote servers
|
|
65
|
+
- `ssh_upload` - Upload files to remote servers
|
|
66
|
+
- `ssh_download` - Download files from remote servers
|
|
67
|
+
- `ssh_sync` - Bidirectional file synchronization with rsync
|
|
68
|
+
|
|
69
|
+
**When to use**: Always enabled. These are the minimum tools needed for SSH operations.
|
|
70
|
+
|
|
71
|
+
### Sessions (4 tools)
|
|
72
|
+
|
|
73
|
+
Persistent SSH session management:
|
|
74
|
+
|
|
75
|
+
- `ssh_session_start` - Start a persistent SSH session
|
|
76
|
+
- `ssh_session_send` - Send command to an existing session
|
|
77
|
+
- `ssh_session_list` - List all active sessions
|
|
78
|
+
- `ssh_session_close` - Close a persistent session
|
|
79
|
+
|
|
80
|
+
**When to use**: Enable if you need to maintain state across multiple commands or run interactive sessions.
|
|
81
|
+
|
|
82
|
+
### Monitoring (6 tools)
|
|
83
|
+
|
|
84
|
+
System health checks and monitoring:
|
|
85
|
+
|
|
86
|
+
- `ssh_health_check` - Comprehensive server health check (CPU, RAM, disk, network)
|
|
87
|
+
- `ssh_service_status` - Check status of services (nginx, mysql, docker, etc.)
|
|
88
|
+
- `ssh_process_manager` - List, monitor, or kill processes
|
|
89
|
+
- `ssh_monitor` - Real-time system resource monitoring
|
|
90
|
+
- `ssh_tail` - Tail log files in real-time
|
|
91
|
+
- `ssh_alert_setup` - Configure health monitoring alerts and thresholds
|
|
92
|
+
|
|
93
|
+
**When to use**: Enable for server administration, DevOps work, or troubleshooting.
|
|
94
|
+
|
|
95
|
+
### Backup (4 tools)
|
|
96
|
+
|
|
97
|
+
Automated backup and restore:
|
|
98
|
+
|
|
99
|
+
- `ssh_backup_create` - Create database or file backups
|
|
100
|
+
- `ssh_backup_list` - List all available backups
|
|
101
|
+
- `ssh_backup_restore` - Restore from previous backups
|
|
102
|
+
- `ssh_backup_schedule` - Schedule automatic backups using cron
|
|
103
|
+
|
|
104
|
+
**Supports**: MySQL, PostgreSQL, MongoDB, files
|
|
105
|
+
|
|
106
|
+
**When to use**: Enable for database administration or when managing production servers.
|
|
107
|
+
|
|
108
|
+
### Database (4 tools)
|
|
109
|
+
|
|
110
|
+
Database operations:
|
|
111
|
+
|
|
112
|
+
- `ssh_db_dump` - Create database dumps
|
|
113
|
+
- `ssh_db_import` - Import SQL dumps or restore databases
|
|
114
|
+
- `ssh_db_list` - List databases or tables/collections
|
|
115
|
+
- `ssh_db_query` - Execute read-only SELECT queries
|
|
116
|
+
|
|
117
|
+
**Supports**: MySQL, PostgreSQL, MongoDB
|
|
118
|
+
|
|
119
|
+
**When to use**: Enable for database administration or data migration tasks.
|
|
120
|
+
|
|
121
|
+
### Advanced (14 tools)
|
|
122
|
+
|
|
123
|
+
Advanced features for power users:
|
|
124
|
+
|
|
125
|
+
- `ssh_deploy` - Smart deployment with automatic permission handling
|
|
126
|
+
- `ssh_execute_sudo` - Execute commands with sudo privileges
|
|
127
|
+
- `ssh_alias` - Manage server aliases (shortcuts)
|
|
128
|
+
- `ssh_command_alias` - Manage command aliases
|
|
129
|
+
- `ssh_hooks` - Automation hooks system
|
|
130
|
+
- `ssh_profile` - Profile management
|
|
131
|
+
- `ssh_connection_status` - Connection management and pooling
|
|
132
|
+
- `ssh_tunnel_create` - Create SSH tunnels (local/remote/SOCKS)
|
|
133
|
+
- `ssh_tunnel_list` - List active tunnels
|
|
134
|
+
- `ssh_tunnel_close` - Close SSH tunnels
|
|
135
|
+
- `ssh_key_manage` - SSH host key management
|
|
136
|
+
- `ssh_execute_group` - Execute commands on server groups
|
|
137
|
+
- `ssh_group_manage` - Manage server groups
|
|
138
|
+
- `ssh_history` - View command history
|
|
139
|
+
|
|
140
|
+
**When to use**: Enable for advanced automation, deployment workflows, or managing multiple servers.
|
|
141
|
+
|
|
142
|
+
## Configuration Modes
|
|
143
|
+
|
|
144
|
+
### All Tools Mode
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mode": "all",
|
|
149
|
+
"groups": {
|
|
150
|
+
"core": { "enabled": true },
|
|
151
|
+
"sessions": { "enabled": true },
|
|
152
|
+
"monitoring": { "enabled": true },
|
|
153
|
+
"backup": { "enabled": true },
|
|
154
|
+
"database": { "enabled": true },
|
|
155
|
+
"advanced": { "enabled": true }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- **Enabled tools**: 37/37
|
|
161
|
+
- **Context usage**: ~43.5k tokens
|
|
162
|
+
- **Best for**: Users who need all features
|
|
163
|
+
|
|
164
|
+
### Minimal Mode
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"mode": "minimal",
|
|
169
|
+
"groups": {
|
|
170
|
+
"core": { "enabled": true },
|
|
171
|
+
"sessions": { "enabled": false },
|
|
172
|
+
"monitoring": { "enabled": false },
|
|
173
|
+
"backup": { "enabled": false },
|
|
174
|
+
"database": { "enabled": false },
|
|
175
|
+
"advanced": { "enabled": false }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
- **Enabled tools**: 5/37
|
|
181
|
+
- **Context usage**: ~3.5k tokens
|
|
182
|
+
- **Context savings**: 92% reduction (~40k tokens saved)
|
|
183
|
+
- **Best for**: Simple SSH operations, file transfers, basic command execution
|
|
184
|
+
|
|
185
|
+
### Custom Mode
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"mode": "custom",
|
|
190
|
+
"groups": {
|
|
191
|
+
"core": { "enabled": true },
|
|
192
|
+
"sessions": { "enabled": true },
|
|
193
|
+
"monitoring": { "enabled": true },
|
|
194
|
+
"backup": { "enabled": false },
|
|
195
|
+
"database": { "enabled": false },
|
|
196
|
+
"advanced": { "enabled": false }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- **Enabled tools**: Custom (5-37 tools)
|
|
202
|
+
- **Context usage**: Varies based on selection
|
|
203
|
+
- **Best for**: Tailoring to specific workflows
|
|
204
|
+
|
|
205
|
+
## Configuration File
|
|
206
|
+
|
|
207
|
+
### Location
|
|
208
|
+
|
|
209
|
+
- **User-global**: `~/.ssh-manager/tools-config.json`
|
|
210
|
+
|
|
211
|
+
### Structure
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"version": "1.0",
|
|
216
|
+
"mode": "minimal|all|custom",
|
|
217
|
+
"groups": {
|
|
218
|
+
"core": { "enabled": true },
|
|
219
|
+
"sessions": { "enabled": false },
|
|
220
|
+
"monitoring": { "enabled": false },
|
|
221
|
+
"backup": { "enabled": false },
|
|
222
|
+
"database": { "enabled": false },
|
|
223
|
+
"advanced": { "enabled": false }
|
|
224
|
+
},
|
|
225
|
+
"tools": {
|
|
226
|
+
"ssh_session_start": true // Individual tool override
|
|
227
|
+
},
|
|
228
|
+
"_comment": "Tool configuration for MCP SSH Manager"
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Individual Tool Overrides
|
|
233
|
+
|
|
234
|
+
You can override group settings for specific tools:
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"mode": "minimal",
|
|
239
|
+
"groups": {
|
|
240
|
+
"sessions": { "enabled": false }
|
|
241
|
+
},
|
|
242
|
+
"tools": {
|
|
243
|
+
"ssh_session_start": true // Enable this tool despite group being disabled
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Use Cases
|
|
249
|
+
|
|
250
|
+
### Scenario 1: Web Developer (Basic SSH)
|
|
251
|
+
|
|
252
|
+
**Need**: Upload files, run build commands, restart services
|
|
253
|
+
|
|
254
|
+
**Recommended**: Minimal mode + monitoring
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
ssh-manager tools configure # Choose "2) Minimal"
|
|
258
|
+
ssh-manager tools enable monitoring
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Result**: 11 tools (5 core + 6 monitoring) = ~7k tokens
|
|
262
|
+
|
|
263
|
+
### Scenario 2: DevOps Engineer
|
|
264
|
+
|
|
265
|
+
**Need**: Full server management, monitoring, backups
|
|
266
|
+
|
|
267
|
+
**Recommended**: All tools mode
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
ssh-manager tools configure # Choose "1) All tools"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Result**: 37 tools = ~43.5k tokens
|
|
274
|
+
|
|
275
|
+
### Scenario 3: Database Administrator
|
|
276
|
+
|
|
277
|
+
**Need**: Database operations, backups, monitoring
|
|
278
|
+
|
|
279
|
+
**Recommended**: Custom mode
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
ssh-manager tools configure # Choose "3) Custom"
|
|
283
|
+
# Enable: monitoring, backup, database
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Result**: 19 tools (5 core + 6 monitoring + 4 backup + 4 database) = ~15k tokens
|
|
287
|
+
|
|
288
|
+
### Scenario 4: Security-Conscious User
|
|
289
|
+
|
|
290
|
+
**Need**: Minimal attack surface, only essential tools
|
|
291
|
+
|
|
292
|
+
**Recommended**: Minimal mode only
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
ssh-manager tools configure # Choose "2) Minimal"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Result**: 5 tools = ~3.5k tokens (minimum possible)
|
|
299
|
+
|
|
300
|
+
## Claude Code Integration
|
|
301
|
+
|
|
302
|
+
### Auto-Approval Configuration
|
|
303
|
+
|
|
304
|
+
After configuring your tools, export the auto-approval configuration:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
ssh-manager tools export-claude
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
This generates a JSON snippet like:
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"autoApprove": {
|
|
315
|
+
"tools": [
|
|
316
|
+
"mcp__ssh-manager__ssh_list_servers",
|
|
317
|
+
"mcp__ssh-manager__ssh_execute",
|
|
318
|
+
"mcp__ssh-manager__ssh_upload",
|
|
319
|
+
"mcp__ssh-manager__ssh_download",
|
|
320
|
+
"mcp__ssh-manager__ssh_sync"
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Adding to Claude Code Config
|
|
327
|
+
|
|
328
|
+
1. Open `~/.config/claude-code/claude_code_config.json`
|
|
329
|
+
2. Add or merge the `autoApprove` section
|
|
330
|
+
3. Save and restart Claude Code
|
|
331
|
+
|
|
332
|
+
Example complete config:
|
|
333
|
+
|
|
334
|
+
```json
|
|
335
|
+
{
|
|
336
|
+
"mcpServers": {
|
|
337
|
+
"ssh-manager": {
|
|
338
|
+
"command": "node",
|
|
339
|
+
"args": ["/absolute/path/to/mcp-ssh-manager/src/index.js"]
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"autoApprove": {
|
|
343
|
+
"tools": [
|
|
344
|
+
"mcp__ssh-manager__ssh_list_servers",
|
|
345
|
+
"mcp__ssh-manager__ssh_execute",
|
|
346
|
+
"mcp__ssh-manager__ssh_upload",
|
|
347
|
+
"mcp__ssh-manager__ssh_download",
|
|
348
|
+
"mcp__ssh-manager__ssh_sync"
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Troubleshooting
|
|
355
|
+
|
|
356
|
+
### Tools Not Disabled After Configuration
|
|
357
|
+
|
|
358
|
+
**Cause**: MCP server is still running with old configuration
|
|
359
|
+
|
|
360
|
+
**Solution**: Restart Claude Code or run `claude mcp restart`
|
|
361
|
+
|
|
362
|
+
### Config File Not Found
|
|
363
|
+
|
|
364
|
+
**Cause**: No configuration file exists yet
|
|
365
|
+
|
|
366
|
+
**Solution**: Run `ssh-manager tools configure` to create one
|
|
367
|
+
|
|
368
|
+
### Can't Disable Core Group
|
|
369
|
+
|
|
370
|
+
**Cause**: Core tools are required for basic functionality
|
|
371
|
+
|
|
372
|
+
**Solution**: Core group cannot be disabled. Consider minimal mode if you want the absolute minimum tools.
|
|
373
|
+
|
|
374
|
+
### Changes Not Reflected in Claude Code
|
|
375
|
+
|
|
376
|
+
**Cause**: Claude Code caches MCP server configuration
|
|
377
|
+
|
|
378
|
+
**Solution**:
|
|
379
|
+
1. Restart Claude Code
|
|
380
|
+
2. Or use Claude Code's MCP server management commands
|
|
381
|
+
3. Verify with `ssh-manager tools list`
|
|
382
|
+
|
|
383
|
+
## Best Practices
|
|
384
|
+
|
|
385
|
+
### 1. Start with Minimal, Enable as Needed
|
|
386
|
+
|
|
387
|
+
Begin with minimal mode and enable groups as you discover you need them:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
ssh-manager tools configure # Choose minimal
|
|
391
|
+
# ... later when you need monitoring ...
|
|
392
|
+
ssh-manager tools enable monitoring
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### 2. Use Tool List Regularly
|
|
396
|
+
|
|
397
|
+
Check what's enabled before starting work:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
ssh-manager tools list
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### 3. Different Configs for Different Projects
|
|
404
|
+
|
|
405
|
+
While MCP SSH Manager uses a single user-global config, you can:
|
|
406
|
+
- Create shell aliases for different profiles
|
|
407
|
+
- Manually switch configs for different projects
|
|
408
|
+
- Use the CLI to quickly enable/disable groups
|
|
409
|
+
|
|
410
|
+
### 4. Export Auto-Approval After Changes
|
|
411
|
+
|
|
412
|
+
Whenever you modify tool configuration, update your Claude Code auto-approval:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
ssh-manager tools enable backup
|
|
416
|
+
ssh-manager tools export-claude
|
|
417
|
+
# Copy the output to claude_code_config.json
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### 5. Document Your Configuration
|
|
421
|
+
|
|
422
|
+
Add comments to your config file to remember why you enabled specific groups:
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
{
|
|
426
|
+
"_comment": "Custom config for web development projects. Monitoring enabled for debugging deployment issues. Backup disabled as we use external backup solutions."
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## FAQ
|
|
431
|
+
|
|
432
|
+
### Q: Will existing users see any changes?
|
|
433
|
+
|
|
434
|
+
**A**: No. If no configuration file exists, all 37 tools are enabled by default (current behavior).
|
|
435
|
+
|
|
436
|
+
### Q: Can I enable individual tools without enabling the whole group?
|
|
437
|
+
|
|
438
|
+
**A**: Yes! Use the `tools` object in the config file for individual overrides.
|
|
439
|
+
|
|
440
|
+
### Q: What happens to new tools in future updates?
|
|
441
|
+
|
|
442
|
+
**A**: New tools default to enabled unless you've explicitly disabled their group.
|
|
443
|
+
|
|
444
|
+
### Q: Can I have different configs for different servers?
|
|
445
|
+
|
|
446
|
+
**A**: Currently, tool configuration is user-global. Server-specific tool configs may be added in a future version.
|
|
447
|
+
|
|
448
|
+
### Q: Does this affect the Node.js API?
|
|
449
|
+
|
|
450
|
+
**A**: Only if you're using the MCP server. Direct use of the Node.js SSH Manager class is unaffected.
|
|
451
|
+
|
|
452
|
+
### Q: How much does minimal mode actually save?
|
|
453
|
+
|
|
454
|
+
**A**: Minimal mode (5 tools) uses ~3.5k tokens vs all tools (37 tools) at ~43.5k tokens. That's a **92% reduction** or **~40k tokens saved**.
|
|
455
|
+
|
|
456
|
+
## Command Reference
|
|
457
|
+
|
|
458
|
+
| Command | Description |
|
|
459
|
+
|---------|-------------|
|
|
460
|
+
| `ssh-manager tools list` | Show all tools and their current status |
|
|
461
|
+
| `ssh-manager tools configure` | Interactive configuration wizard |
|
|
462
|
+
| `ssh-manager tools enable <group>` | Enable a tool group |
|
|
463
|
+
| `ssh-manager tools disable <group>` | Disable a tool group |
|
|
464
|
+
| `ssh-manager tools reset` | Reset to defaults (all tools enabled) |
|
|
465
|
+
| `ssh-manager tools show` | Display raw configuration file |
|
|
466
|
+
| `ssh-manager tools export-claude` | Generate Claude Code auto-approval config |
|
|
467
|
+
|
|
468
|
+
## See Also
|
|
469
|
+
|
|
470
|
+
- [README.md](../README.md) - Main project documentation
|
|
471
|
+
- [CLAUDE.md](../CLAUDE.md) - Instructions for Claude Code AI
|
|
472
|
+
- [Tool Registry Source](../src/tool-registry.js) - Tool group definitions
|
|
473
|
+
- [Config Manager Source](../src/tool-config-manager.js) - Configuration logic
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation. NEW: Tool activation system reduces context usage by 92%",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"setup": "npm install && pip install -r tools/requirements.txt",
|
|
10
10
|
"configure": "python tools/server-manager.py",
|
|
11
11
|
"test-connection": "python tools/test-connection.py",
|
|
12
|
-
"test": "npm run test:profiles && npm run test:aliases && npm run test:hooks",
|
|
12
|
+
"test": "npm run test:profiles && npm run test:aliases && npm run test:hooks && npm run test:tools",
|
|
13
13
|
"test:profiles": "node tests/test-profiles.js",
|
|
14
14
|
"test:aliases": "node tests/test-command-aliases.js",
|
|
15
15
|
"test:hooks": "node tests/test-hooks.js",
|
|
16
|
+
"test:tools": "node tests/test-tool-registry.js",
|
|
16
17
|
"test:all": "npm test && ./scripts/validate.sh",
|
|
17
18
|
"validate": "./scripts/validate.sh",
|
|
18
19
|
"lint": "eslint src/*.js",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"license": "MIT",
|
|
62
63
|
"repository": {
|
|
63
64
|
"type": "git",
|
|
64
|
-
"url": "https://github.com/bvisible/mcp-ssh-manager.git"
|
|
65
|
+
"url": "git+https://github.com/bvisible/mcp-ssh-manager.git"
|
|
65
66
|
},
|
|
66
67
|
"bugs": {
|
|
67
68
|
"url": "https://github.com/bvisible/mcp-ssh-manager/issues"
|
package/scripts/validate.sh
CHANGED
|
@@ -65,6 +65,18 @@ else
|
|
|
65
65
|
fi
|
|
66
66
|
fi
|
|
67
67
|
|
|
68
|
+
# Test password special characters handling
|
|
69
|
+
echo "📋 Testing password special character handling..."
|
|
70
|
+
if [ -f "debug/test_password_special_chars.sh" ]; then
|
|
71
|
+
if bash debug/test_password_special_chars.sh > /dev/null 2>&1; then
|
|
72
|
+
echo " ✅ Password special characters handled correctly"
|
|
73
|
+
else
|
|
74
|
+
echo " ⚠️ Password test requires local dependencies (skipping in CI)"
|
|
75
|
+
fi
|
|
76
|
+
else
|
|
77
|
+
echo " ⚠️ Password test script not found (skipping)"
|
|
78
|
+
fi
|
|
79
|
+
|
|
68
80
|
echo ""
|
|
69
81
|
echo "====================================="
|
|
70
82
|
if [ $ERRORS -eq 0 ]; then
|
package/src/backup-manager.js
CHANGED
|
@@ -207,16 +207,16 @@ export function buildFilesBackupCommand(options) {
|
|
|
207
207
|
*/
|
|
208
208
|
export function buildRestoreCommand(backupType, backupFile, options = {}) {
|
|
209
209
|
switch (backupType) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
case BACKUP_TYPES.MYSQL:
|
|
211
|
+
return buildMySQLRestoreCommand(backupFile, options);
|
|
212
|
+
case BACKUP_TYPES.POSTGRESQL:
|
|
213
|
+
return buildPostgreSQLRestoreCommand(backupFile, options);
|
|
214
|
+
case BACKUP_TYPES.MONGODB:
|
|
215
|
+
return buildMongoDBRestoreCommand(backupFile, options);
|
|
216
|
+
case BACKUP_TYPES.FILES:
|
|
217
|
+
return buildFilesRestoreCommand(backupFile, options);
|
|
218
|
+
default:
|
|
219
|
+
throw new Error(`Unknown backup type: ${backupType}`);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
@@ -379,7 +379,7 @@ export function createBackupMetadata(backupId, type, options = {}) {
|
|
|
379
379
|
export function buildSaveMetadataCommand(metadata, metadataPath) {
|
|
380
380
|
const jsonData = JSON.stringify(metadata, null, 2);
|
|
381
381
|
// Escape single quotes in JSON for shell
|
|
382
|
-
const escapedJson = jsonData.replace(/'/g,
|
|
382
|
+
const escapedJson = jsonData.replace(/'/g, '\'\\\'\'');
|
|
383
383
|
return `echo '${escapedJson}' > "${metadataPath}"`;
|
|
384
384
|
}
|
|
385
385
|
|
|
@@ -394,7 +394,7 @@ export function buildListBackupsCommand(backupDir = DEFAULT_BACKUP_DIR, type = n
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
// Read and parse each metadata file
|
|
397
|
-
command +=
|
|
397
|
+
command += ' | while read -r file; do cat "$file"; echo "---"; done';
|
|
398
398
|
|
|
399
399
|
return command;
|
|
400
400
|
}
|
package/src/command-aliases.js
CHANGED
|
@@ -29,13 +29,13 @@ export function loadCommandAliases() {
|
|
|
29
29
|
try {
|
|
30
30
|
// Start with profile aliases
|
|
31
31
|
let aliases = { ...profileAliases };
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// Merge with custom aliases from file
|
|
34
34
|
if (fs.existsSync(ALIASES_FILE)) {
|
|
35
35
|
const data = fs.readFileSync(ALIASES_FILE, 'utf8');
|
|
36
36
|
aliases = { ...aliases, ...JSON.parse(data) };
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
return aliases;
|
|
40
40
|
} catch (error) {
|
|
41
41
|
console.error(`Error loading command aliases: ${error.message}`);
|
|
@@ -55,7 +55,7 @@ export function saveCommandAliases(aliases) {
|
|
|
55
55
|
customAliases[key] = value;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
fs.writeFileSync(ALIASES_FILE, JSON.stringify(customAliases, null, 2));
|
|
60
60
|
return true;
|
|
61
61
|
} catch (error) {
|
|
@@ -69,21 +69,21 @@ export function saveCommandAliases(aliases) {
|
|
|
69
69
|
*/
|
|
70
70
|
export function expandCommandAlias(command) {
|
|
71
71
|
const aliases = loadCommandAliases();
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
// Check if the entire command is an alias
|
|
74
74
|
if (aliases[command]) {
|
|
75
75
|
return aliases[command];
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
// Check if the command starts with an alias
|
|
79
79
|
const parts = command.split(' ');
|
|
80
80
|
const firstPart = parts[0];
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
if (aliases[firstPart]) {
|
|
83
83
|
parts[0] = aliases[firstPart];
|
|
84
84
|
return parts.join(' ');
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
return command;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -101,14 +101,14 @@ export function addCommandAlias(alias, command) {
|
|
|
101
101
|
*/
|
|
102
102
|
export function removeCommandAlias(alias) {
|
|
103
103
|
const aliases = loadCommandAliases();
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
// Don't remove profile aliases, just reset them
|
|
106
106
|
if (profileAliases[alias]) {
|
|
107
107
|
aliases[alias] = profileAliases[alias];
|
|
108
108
|
} else {
|
|
109
109
|
delete aliases[alias];
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
return saveCommandAliases(aliases);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -118,7 +118,7 @@ export function removeCommandAlias(alias) {
|
|
|
118
118
|
export function listCommandAliases() {
|
|
119
119
|
const aliases = loadCommandAliases();
|
|
120
120
|
const result = [];
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
for (const [alias, command] of Object.entries(aliases)) {
|
|
123
123
|
result.push({
|
|
124
124
|
alias,
|
|
@@ -127,7 +127,7 @@ export function listCommandAliases() {
|
|
|
127
127
|
isCustom: profileAliases[alias] !== command
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
return result.sort((a, b) => a.alias.localeCompare(b.alias));
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -137,15 +137,15 @@ export function listCommandAliases() {
|
|
|
137
137
|
export function suggestAliases(command) {
|
|
138
138
|
const suggestions = [];
|
|
139
139
|
const aliases = loadCommandAliases();
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
const commandLower = command.toLowerCase();
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
for (const [alias, aliasCommand] of Object.entries(aliases)) {
|
|
144
|
-
if (aliasCommand.toLowerCase().includes(commandLower) ||
|
|
144
|
+
if (aliasCommand.toLowerCase().includes(commandLower) ||
|
|
145
145
|
alias.toLowerCase().includes(commandLower)) {
|
|
146
146
|
suggestions.push({ alias, command: aliasCommand });
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
return suggestions;
|
|
151
|
-
}
|
|
151
|
+
}
|
package/src/config-loader.js
CHANGED