mcp-ssh-manager 3.0.0 → 3.1.2

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.
@@ -0,0 +1,603 @@
1
+ #!/bin/bash
2
+ # Tool management commands for ssh-manager CLI
3
+
4
+ # Tool configuration file location
5
+ TOOLS_CONFIG="${HOME}/.ssh-manager/tools-config.json"
6
+
7
+ # Tool group definitions (matching src/tool-registry.js)
8
+ get_tool_count() {
9
+ case "$1" in
10
+ core) echo "5" ;;
11
+ sessions) echo "4" ;;
12
+ monitoring) echo "6" ;;
13
+ backup) echo "4" ;;
14
+ database) echo "4" ;;
15
+ advanced) echo "14" ;;
16
+ *) echo "0" ;;
17
+ esac
18
+ }
19
+
20
+ get_tool_description() {
21
+ case "$1" in
22
+ core) echo "Essential SSH operations (list, execute, upload, download, sync)" ;;
23
+ sessions) echo "Persistent SSH sessions with state management" ;;
24
+ monitoring) echo "System health checks, service monitoring, process management, and alerts" ;;
25
+ backup) echo "Automated backup and restore for databases and files" ;;
26
+ database) echo "Database operations (MySQL, PostgreSQL, MongoDB)" ;;
27
+ advanced) echo "Advanced features (deployment, sudo, tunnels, groups, aliases, hooks, profiles)" ;;
28
+ *) echo "" ;;
29
+ esac
30
+ }
31
+
32
+ # Main tools command router
33
+ cmd_tools() {
34
+ local action="$1"
35
+ shift || true
36
+
37
+ case "$action" in
38
+ list|ls)
39
+ cmd_tools_list "$@"
40
+ ;;
41
+ enable|on)
42
+ cmd_tools_enable "$@"
43
+ ;;
44
+ disable|off)
45
+ cmd_tools_disable "$@"
46
+ ;;
47
+ reset)
48
+ cmd_tools_reset "$@"
49
+ ;;
50
+ configure|config|setup)
51
+ cmd_tools_configure "$@"
52
+ ;;
53
+ show|status)
54
+ cmd_tools_show "$@"
55
+ ;;
56
+ export-claude|export)
57
+ cmd_tools_export_claude "$@"
58
+ ;;
59
+ "")
60
+ print_error "Missing action"
61
+ echo ""
62
+ echo "Usage: ssh-manager tools <action>"
63
+ echo ""
64
+ echo "Actions:"
65
+ echo " list Show all tools and their status"
66
+ echo " configure Interactive configuration wizard"
67
+ echo " enable <group> Enable a tool group"
68
+ echo " disable <group> Disable a tool group"
69
+ echo " reset Reset to default (all tools enabled)"
70
+ echo " export-claude Export Claude Code auto-approval config"
71
+ return 1
72
+ ;;
73
+ *)
74
+ print_error "Unknown tools command: $action"
75
+ echo ""
76
+ echo "Available commands: list, configure, enable, disable, reset, export-claude"
77
+ return 1
78
+ ;;
79
+ esac
80
+ }
81
+
82
+ # List all tools with status
83
+ cmd_tools_list() {
84
+ print_header "MCP Tools Configuration"
85
+
86
+ if [ ! -f "$TOOLS_CONFIG" ]; then
87
+ print_info "No tool configuration found"
88
+ echo ""
89
+ echo "${GRAY}Default: All 37 tools enabled${NC}"
90
+ echo ""
91
+ print_info "Run ${CYAN}ssh-manager tools configure${NC} to customize and reduce context usage"
92
+ return 0
93
+ fi
94
+
95
+ # Read configuration
96
+ local mode=$(jq -r '.mode // "all"' "$TOOLS_CONFIG" 2>/dev/null || echo "all")
97
+ local enabled_count=0
98
+ local total_count=37
99
+
100
+ # Calculate enabled count
101
+ case "$mode" in
102
+ all)
103
+ enabled_count=37
104
+ ;;
105
+ minimal)
106
+ enabled_count=5
107
+ ;;
108
+ custom)
109
+ # Count enabled tools per group
110
+ for group in core sessions monitoring backup database advanced; do
111
+ local group_enabled=$(jq -r ".groups.$group.enabled // true" "$TOOLS_CONFIG" 2>/dev/null || echo "true")
112
+ if [ "$group_enabled" = "true" ]; then
113
+ enabled_count=$((enabled_count + TOOL_GROUP_COUNTS[$group]))
114
+ fi
115
+ done
116
+ ;;
117
+ esac
118
+
119
+ echo ""
120
+ echo " ${BOLD}Mode:${NC} ${CYAN}$mode${NC}"
121
+ echo " ${BOLD}Enabled:${NC} ${enabled_count}/${total_count} tools"
122
+ echo " ${BOLD}Config:${NC} ${GRAY}$TOOLS_CONFIG${NC}"
123
+ echo ""
124
+
125
+ print_subheader "Tool Groups"
126
+ echo ""
127
+
128
+ # Print header
129
+ printf "${BOLD}%-12s %-10s %-8s %s${NC}\n" "GROUP" "STATUS" "TOOLS" "DESCRIPTION"
130
+ printf "${GRAY}%-12s %-10s %-8s %s${NC}\n" "────────────" "──────────" "────────" "─────────────────────────────────────────"
131
+
132
+ # Print each group
133
+ for group in core sessions monitoring backup database advanced; do
134
+ local enabled="true"
135
+ local status_icon="${GREEN}●${NC}"
136
+ local status_text="${GREEN}enabled${NC}"
137
+
138
+ if [ -f "$TOOLS_CONFIG" ]; then
139
+ case "$mode" in
140
+ all)
141
+ enabled="true"
142
+ ;;
143
+ minimal)
144
+ if [ "$group" != "core" ]; then
145
+ enabled="false"
146
+ status_icon="${GRAY}○${NC}"
147
+ status_text="${GRAY}disabled${NC}"
148
+ fi
149
+ ;;
150
+ custom)
151
+ enabled=$(jq -r ".groups.$group.enabled // true" "$TOOLS_CONFIG" 2>/dev/null || echo "true")
152
+ if [ "$enabled" != "true" ]; then
153
+ status_icon="${GRAY}○${NC}"
154
+ status_text="${GRAY}disabled${NC}"
155
+ fi
156
+ ;;
157
+ esac
158
+ fi
159
+
160
+ local count="$(get_tool_count "$group")"
161
+ local desc="$(get_tool_description "$group")"
162
+
163
+ printf "%-12s %s %-8s %-8s %s\n" "$group" "$status_icon" "$status_text" "$count" "$desc"
164
+ done
165
+
166
+ echo ""
167
+
168
+ # Show tips
169
+ if [ "$mode" = "all" ]; then
170
+ print_info "${LIGHTBULB} Tip: Switch to ${CYAN}minimal${NC} mode to reduce context usage by 92%"
171
+ echo " Run: ${CYAN}ssh-manager tools configure${NC}"
172
+ elif [ "$mode" = "minimal" ]; then
173
+ print_success "${CHECK} Optimized! Using only 5 core tools (saves ~40k tokens in Claude Code)"
174
+ echo ""
175
+ echo " To enable more tools: ${CYAN}ssh-manager tools enable <group>${NC}"
176
+ fi
177
+
178
+ echo ""
179
+ }
180
+
181
+ # Show current configuration details
182
+ cmd_tools_show() {
183
+ if [ ! -f "$TOOLS_CONFIG" ]; then
184
+ print_error "No configuration file found"
185
+ echo ""
186
+ echo "Run ${CYAN}ssh-manager tools configure${NC} to create one"
187
+ return 1
188
+ fi
189
+
190
+ print_header "Tool Configuration Details"
191
+ echo ""
192
+
193
+ cat "$TOOLS_CONFIG" | jq '.' 2>/dev/null || {
194
+ print_error "Failed to parse configuration file"
195
+ return 1
196
+ }
197
+
198
+ echo ""
199
+ }
200
+
201
+ # Enable a tool group
202
+ cmd_tools_enable() {
203
+ local group="$1"
204
+
205
+ if [ -z "$group" ]; then
206
+ print_error "Usage: ssh-manager tools enable <group>"
207
+ echo ""
208
+ echo "Available groups: core, sessions, monitoring, backup, database, advanced"
209
+ return 1
210
+ fi
211
+
212
+ # Validate group name
213
+ if [[ ! "$group" =~ ^(core|sessions|monitoring|backup|database|advanced)$ ]]; then
214
+ print_error "Unknown group: $group"
215
+ echo ""
216
+ echo "Available groups: core, sessions, monitoring, backup, database, advanced"
217
+ return 1
218
+ fi
219
+
220
+ # Ensure config file exists
221
+ if [ ! -f "$TOOLS_CONFIG" ]; then
222
+ # Create default config in custom mode
223
+ mkdir -p "$(dirname "$TOOLS_CONFIG")"
224
+ cat > "$TOOLS_CONFIG" <<EOF
225
+ {
226
+ "version": "1.0",
227
+ "mode": "custom",
228
+ "groups": {
229
+ "core": { "enabled": true },
230
+ "sessions": { "enabled": false },
231
+ "monitoring": { "enabled": false },
232
+ "backup": { "enabled": false },
233
+ "database": { "enabled": false },
234
+ "advanced": { "enabled": false }
235
+ },
236
+ "tools": {},
237
+ "_comment": "Tool configuration created by ssh-manager tools enable"
238
+ }
239
+ EOF
240
+ fi
241
+
242
+ # Update mode to custom if it's all
243
+ local current_mode=$(jq -r '.mode // "all"' "$TOOLS_CONFIG")
244
+ if [ "$current_mode" = "all" ]; then
245
+ # Initialize all groups as enabled when coming from 'all' mode
246
+ jq '.mode = "custom" | .groups.core.enabled = true | .groups.sessions.enabled = true | .groups.monitoring.enabled = true | .groups.backup.enabled = true | .groups.database.enabled = true | .groups.advanced.enabled = true' "$TOOLS_CONFIG" > "$TOOLS_CONFIG.tmp"
247
+ mv "$TOOLS_CONFIG.tmp" "$TOOLS_CONFIG"
248
+ elif [ "$current_mode" = "minimal" ]; then
249
+ # Initialize from minimal
250
+ jq '.mode = "custom" | .groups.core.enabled = true | .groups.sessions.enabled = false | .groups.monitoring.enabled = false | .groups.backup.enabled = false | .groups.database.enabled = false | .groups.advanced.enabled = false' "$TOOLS_CONFIG" > "$TOOLS_CONFIG.tmp"
251
+ mv "$TOOLS_CONFIG.tmp" "$TOOLS_CONFIG"
252
+ fi
253
+
254
+ # Enable the group
255
+ jq ".groups.$group.enabled = true" "$TOOLS_CONFIG" > "$TOOLS_CONFIG.tmp"
256
+ mv "$TOOLS_CONFIG.tmp" "$TOOLS_CONFIG"
257
+
258
+ local count="$(get_tool_count "$group")"
259
+ print_success "Enabled ${CYAN}$group${NC} group (${count} tools)"
260
+ echo ""
261
+ print_warning "Restart MCP server for changes to take effect:"
262
+ echo " - Restart Claude Code, or"
263
+ echo " - Run: ${CYAN}claude mcp restart${NC}"
264
+ }
265
+
266
+ # Disable a tool group
267
+ cmd_tools_disable() {
268
+ local group="$1"
269
+
270
+ if [ -z "$group" ]; then
271
+ print_error "Usage: ssh-manager tools disable <group>"
272
+ echo ""
273
+ echo "Available groups: sessions, monitoring, backup, database, advanced"
274
+ echo "${GRAY}Note: 'core' group cannot be disabled${NC}"
275
+ return 1
276
+ fi
277
+
278
+ # Validate group name
279
+ if [[ ! "$group" =~ ^(sessions|monitoring|backup|database|advanced)$ ]]; then
280
+ if [ "$group" = "core" ]; then
281
+ print_error "Cannot disable 'core' group (required for basic functionality)"
282
+ else
283
+ print_error "Unknown group: $group"
284
+ echo ""
285
+ echo "Available groups: sessions, monitoring, backup, database, advanced"
286
+ fi
287
+ return 1
288
+ fi
289
+
290
+ # Ensure config file exists
291
+ if [ ! -f "$TOOLS_CONFIG" ]; then
292
+ mkdir -p "$(dirname "$TOOLS_CONFIG")"
293
+ cat > "$TOOLS_CONFIG" <<EOF
294
+ {
295
+ "version": "1.0",
296
+ "mode": "custom",
297
+ "groups": {
298
+ "core": { "enabled": true },
299
+ "sessions": { "enabled": true },
300
+ "monitoring": { "enabled": true },
301
+ "backup": { "enabled": true },
302
+ "database": { "enabled": true },
303
+ "advanced": { "enabled": true }
304
+ },
305
+ "tools": {},
306
+ "_comment": "Tool configuration created by ssh-manager tools disable"
307
+ }
308
+ EOF
309
+ fi
310
+
311
+ # Update mode to custom if needed
312
+ local current_mode=$(jq -r '.mode // "all"' "$TOOLS_CONFIG")
313
+ if [ "$current_mode" = "all" ]; then
314
+ jq '.mode = "custom" | .groups.core.enabled = true | .groups.sessions.enabled = true | .groups.monitoring.enabled = true | .groups.backup.enabled = true | .groups.database.enabled = true | .groups.advanced.enabled = true' "$TOOLS_CONFIG" > "$TOOLS_CONFIG.tmp"
315
+ mv "$TOOLS_CONFIG.tmp" "$TOOLS_CONFIG"
316
+ fi
317
+
318
+ # Disable the group
319
+ jq ".groups.$group.enabled = false" "$TOOLS_CONFIG" > "$TOOLS_CONFIG.tmp"
320
+ mv "$TOOLS_CONFIG.tmp" "$TOOLS_CONFIG"
321
+
322
+ local count="$(get_tool_count "$group")"
323
+ print_success "Disabled ${CYAN}$group${NC} group (${count} tools)"
324
+ echo ""
325
+ print_warning "Restart MCP server for changes to take effect:"
326
+ echo " - Restart Claude Code, or"
327
+ echo " - Run: ${CYAN}claude mcp restart${NC}"
328
+ }
329
+
330
+ # Reset configuration to defaults
331
+ cmd_tools_reset() {
332
+ if [ -f "$TOOLS_CONFIG" ]; then
333
+ print_warning "This will delete your tool configuration and enable all 37 tools"
334
+ echo ""
335
+ if prompt_yes_no "Continue?" "n"; then
336
+ rm -f "$TOOLS_CONFIG"
337
+ print_success "Tool configuration reset to defaults (all tools enabled)"
338
+ echo ""
339
+ print_info "Restart Claude Code for changes to take effect"
340
+ else
341
+ print_info "Cancelled"
342
+ fi
343
+ else
344
+ print_info "No configuration file found (already using defaults)"
345
+ fi
346
+ }
347
+
348
+ # Interactive configuration wizard
349
+ cmd_tools_configure() {
350
+ print_header "Tool Configuration Wizard"
351
+
352
+ echo ""
353
+ echo "MCP SSH Manager has ${BOLD}37 tools${NC} organized into ${BOLD}6 groups${NC}:"
354
+ echo ""
355
+
356
+ for group in core sessions monitoring backup database advanced; do
357
+ local count="$(get_tool_count "$group")"
358
+ local desc="$(get_tool_description "$group")"
359
+ printf " ${CYAN}%-12s${NC} (%-2d tools) - %s\n" "$group" "$count" "$desc"
360
+ done
361
+
362
+ echo ""
363
+ echo "Choose configuration mode:"
364
+ echo ""
365
+ echo " ${GREEN}1) All tools${NC} (recommended for most users)"
366
+ echo " ├─ All 37 tools enabled"
367
+ echo " ├─ Full feature set available"
368
+ echo " └─ Uses ~43k tokens in Claude Code"
369
+ echo ""
370
+ echo " ${YELLOW}2) Minimal${NC} (lightweight, core functionality only)"
371
+ echo " ├─ Only 5 core tools enabled"
372
+ echo " ├─ Reduces context usage by 92%"
373
+ echo " └─ Uses ~3.5k tokens in Claude Code"
374
+ echo ""
375
+ echo " ${CYAN}3) Custom${NC} (choose which groups to enable)"
376
+ echo " ├─ Interactive group selection"
377
+ echo " ├─ Fine-tune for your workflow"
378
+ echo " └─ Balances features and context usage"
379
+ echo ""
380
+
381
+ read -p "Choose [1-3]: " mode_choice
382
+
383
+ # Create config directory
384
+ mkdir -p "$(dirname "$TOOLS_CONFIG")"
385
+
386
+ case "$mode_choice" in
387
+ 2)
388
+ # Minimal mode
389
+ cat > "$TOOLS_CONFIG" <<EOF
390
+ {
391
+ "version": "1.0",
392
+ "mode": "minimal",
393
+ "groups": {
394
+ "core": { "enabled": true },
395
+ "sessions": { "enabled": false },
396
+ "monitoring": { "enabled": false },
397
+ "backup": { "enabled": false },
398
+ "database": { "enabled": false },
399
+ "advanced": { "enabled": false }
400
+ },
401
+ "tools": {},
402
+ "_comment": "Minimal mode - only 5 core tools enabled"
403
+ }
404
+ EOF
405
+ echo ""
406
+ print_success "Configuration saved: ${YELLOW}Minimal mode${NC} (5 tools)"
407
+ echo ""
408
+ echo " ${GREEN}Context savings:${NC} ~40k tokens (92% reduction)"
409
+ echo " ${GREEN}Enabled tools:${NC} ssh_list_servers, ssh_execute, ssh_upload, ssh_download, ssh_sync"
410
+ ;;
411
+
412
+ 3)
413
+ # Custom mode - interactive
414
+ echo ""
415
+ print_subheader "Group Selection"
416
+ echo ""
417
+ echo "${BOLD}Core${NC} group is always enabled. Choose additional groups:"
418
+ echo ""
419
+
420
+ local sessions="false"
421
+ local monitoring="false"
422
+ local backup="false"
423
+ local database="false"
424
+ local advanced="false"
425
+
426
+ if prompt_yes_no "Enable ${CYAN}sessions${NC} group? (4 tools - persistent SSH sessions)" "n"; then
427
+ sessions="true"
428
+ fi
429
+
430
+ if prompt_yes_no "Enable ${CYAN}monitoring${NC} group? (6 tools - health checks, service monitoring)" "n"; then
431
+ monitoring="true"
432
+ fi
433
+
434
+ if prompt_yes_no "Enable ${CYAN}backup${NC} group? (4 tools - database and file backups)" "n"; then
435
+ backup="true"
436
+ fi
437
+
438
+ if prompt_yes_no "Enable ${CYAN}database${NC} group? (4 tools - MySQL, PostgreSQL, MongoDB)" "n"; then
439
+ database="true"
440
+ fi
441
+
442
+ if prompt_yes_no "Enable ${CYAN}advanced${NC} group? (14 tools - deployment, sudo, tunnels, etc)" "n"; then
443
+ advanced="true"
444
+ fi
445
+
446
+ cat > "$TOOLS_CONFIG" <<EOF
447
+ {
448
+ "version": "1.0",
449
+ "mode": "custom",
450
+ "groups": {
451
+ "core": { "enabled": true },
452
+ "sessions": { "enabled": $sessions },
453
+ "monitoring": { "enabled": $monitoring },
454
+ "backup": { "enabled": $backup },
455
+ "database": { "enabled": $database },
456
+ "advanced": { "enabled": $advanced }
457
+ },
458
+ "tools": {},
459
+ "_comment": "Custom configuration created by wizard"
460
+ }
461
+ EOF
462
+
463
+ # Count enabled tools
464
+ local enabled_count=5 # core
465
+ [ "$sessions" = "true" ] && enabled_count=$((enabled_count + 4))
466
+ [ "$monitoring" = "true" ] && enabled_count=$((enabled_count + 6))
467
+ [ "$backup" = "true" ] && enabled_count=$((enabled_count + 4))
468
+ [ "$database" = "true" ] && enabled_count=$((enabled_count + 4))
469
+ [ "$advanced" = "true" ] && enabled_count=$((enabled_count + 14))
470
+
471
+ echo ""
472
+ print_success "Configuration saved: ${CYAN}Custom mode${NC} ($enabled_count tools enabled)"
473
+ ;;
474
+
475
+ *)
476
+ # All tools (default)
477
+ cat > "$TOOLS_CONFIG" <<EOF
478
+ {
479
+ "version": "1.0",
480
+ "mode": "all",
481
+ "groups": {
482
+ "core": { "enabled": true },
483
+ "sessions": { "enabled": true },
484
+ "monitoring": { "enabled": true },
485
+ "backup": { "enabled": true },
486
+ "database": { "enabled": true },
487
+ "advanced": { "enabled": true }
488
+ },
489
+ "tools": {},
490
+ "_comment": "All tools enabled (default configuration)"
491
+ }
492
+ EOF
493
+ echo ""
494
+ print_success "Configuration saved: ${GREEN}All tools mode${NC} (37 tools)"
495
+ ;;
496
+ esac
497
+
498
+ echo ""
499
+ echo " ${BOLD}Config file:${NC} ${GRAY}$TOOLS_CONFIG${NC}"
500
+ echo ""
501
+ print_warning "Restart MCP server for changes to take effect:"
502
+ echo " ${ARROW} Option 1: Restart Claude Code application"
503
+ echo " ${ARROW} Option 2: Run ${CYAN}claude mcp restart${NC}"
504
+ echo ""
505
+
506
+ # Offer to export auto-approval config
507
+ if prompt_yes_no "Generate Claude Code auto-approval configuration?" "y"; then
508
+ cmd_tools_export_claude
509
+ fi
510
+ }
511
+
512
+ # Export Claude Code auto-approval configuration
513
+ cmd_tools_export_claude() {
514
+ if [ ! -f "$TOOLS_CONFIG" ]; then
515
+ print_error "No tool configuration found"
516
+ echo ""
517
+ echo "Run ${CYAN}ssh-manager tools configure${NC} first"
518
+ return 1
519
+ fi
520
+
521
+ print_header "Claude Code Auto-Approval Configuration"
522
+ echo ""
523
+
524
+ # Read mode
525
+ local mode=$(jq -r '.mode // "all"' "$TOOLS_CONFIG")
526
+
527
+ # Build tool list
528
+ local tools=()
529
+
530
+ case "$mode" in
531
+ all)
532
+ # All 37 tools
533
+ tools=("ssh_list_servers" "ssh_execute" "ssh_upload" "ssh_download" "ssh_sync"
534
+ "ssh_session_start" "ssh_session_send" "ssh_session_list" "ssh_session_close"
535
+ "ssh_health_check" "ssh_service_status" "ssh_process_manager" "ssh_monitor" "ssh_tail" "ssh_alert_setup"
536
+ "ssh_backup_create" "ssh_backup_list" "ssh_backup_restore" "ssh_backup_schedule"
537
+ "ssh_db_dump" "ssh_db_import" "ssh_db_list" "ssh_db_query"
538
+ "ssh_deploy" "ssh_execute_sudo" "ssh_alias" "ssh_command_alias" "ssh_hooks" "ssh_profile"
539
+ "ssh_connection_status" "ssh_tunnel_create" "ssh_tunnel_list" "ssh_tunnel_close"
540
+ "ssh_key_manage" "ssh_execute_group" "ssh_group_manage" "ssh_history")
541
+ ;;
542
+ minimal)
543
+ tools=("ssh_list_servers" "ssh_execute" "ssh_upload" "ssh_download" "ssh_sync")
544
+ ;;
545
+ custom)
546
+ # Core (always enabled)
547
+ tools=("ssh_list_servers" "ssh_execute" "ssh_upload" "ssh_download" "ssh_sync")
548
+
549
+ # Check each group
550
+ if [ "$(jq -r '.groups.sessions.enabled // false' "$TOOLS_CONFIG")" = "true" ]; then
551
+ tools+=("ssh_session_start" "ssh_session_send" "ssh_session_list" "ssh_session_close")
552
+ fi
553
+
554
+ if [ "$(jq -r '.groups.monitoring.enabled // false' "$TOOLS_CONFIG")" = "true" ]; then
555
+ tools+=("ssh_health_check" "ssh_service_status" "ssh_process_manager" "ssh_monitor" "ssh_tail" "ssh_alert_setup")
556
+ fi
557
+
558
+ if [ "$(jq -r '.groups.backup.enabled // false' "$TOOLS_CONFIG")" = "true" ]; then
559
+ tools+=("ssh_backup_create" "ssh_backup_list" "ssh_backup_restore" "ssh_backup_schedule")
560
+ fi
561
+
562
+ if [ "$(jq -r '.groups.database.enabled // false' "$TOOLS_CONFIG")" = "true" ]; then
563
+ tools+=("ssh_db_dump" "ssh_db_import" "ssh_db_list" "ssh_db_query")
564
+ fi
565
+
566
+ if [ "$(jq -r '.groups.advanced.enabled // false' "$TOOLS_CONFIG")" = "true" ]; then
567
+ tools+=("ssh_deploy" "ssh_execute_sudo" "ssh_alias" "ssh_command_alias" "ssh_hooks" "ssh_profile"
568
+ "ssh_connection_status" "ssh_tunnel_create" "ssh_tunnel_list" "ssh_tunnel_close"
569
+ "ssh_key_manage" "ssh_execute_group" "ssh_group_manage" "ssh_history")
570
+ fi
571
+ ;;
572
+ esac
573
+
574
+ # Generate JSON
575
+ echo "Add this to your ${CYAN}~/.config/claude-code/claude_code_config.json${NC}:"
576
+ echo ""
577
+ echo "${GRAY}────────────────────────────────────────────────────────────${NC}"
578
+ echo "{"
579
+ echo " \"autoApprove\": {"
580
+ echo " \"tools\": ["
581
+
582
+ local first=true
583
+ for tool in "${tools[@]}"; do
584
+ if [ "$first" = true ]; then
585
+ first=false
586
+ else
587
+ echo ","
588
+ fi
589
+ printf " \"mcp__ssh-manager__${tool}\""
590
+ done
591
+
592
+ echo ""
593
+ echo " ]"
594
+ echo " }"
595
+ echo "}"
596
+ echo "${GRAY}────────────────────────────────────────────────────────────${NC}"
597
+ echo ""
598
+ print_info "Copy the ${CYAN}autoApprove${NC} section above into your Claude Code config"
599
+ echo ""
600
+ echo " ${BOLD}Config location:${NC} ~/.config/claude-code/claude_code_config.json"
601
+ echo " ${BOLD}Enabled tools:${NC} ${#tools[@]} tools will be auto-approved"
602
+ echo ""
603
+ }