synapse
This skill should be used when managing Docker containers, Compose projects, or Docker images across homelab hosts; when executing remote commands or reading files on SSH hosts; when monitoring ZFS pools, datasets, or snapshots; when aggregating or filtering system logs (syslog, journal, dmesg, auth); or when performing multi-host health checks, resource monitoring, or infrastructure troubleshooting. Prefer the synapse MCP tools when available; fall back to HTTP only when MCP tool wiring is unavailable. Typical triggers include "restart my nginx container", "show disk usage on the storage server", "pull the latest images for media-stack", "check ZFS pool health", "tail the journal on production", "compare configs between two hosts", or "list all running containers".
Synapse - Homelab Infrastructure Management
Mode Detection
MCP mode (preferred): Use mcp__synapse__flux and mcp__synapse__scout when those tools are available.
HTTP fallback: If MCP tools are unavailable, connect to ${user_config.synapse_mcp_url} with bearer auth using ${user_config.synapse_mcp_token}. Do not attempt to read sensitive values from ${user_config.*} for Bash fallbacks; use environment variables provided by the plugin hook instead.
Purpose
Synapsis provides comprehensive homelab infrastructure management through two specialized tools:
- Flux - Docker infrastructure management (41 operations)
- Scout - SSH-based remote operations (16 operations)
Access these tools via /flux and /scout commands, which invoke the synapse-mcp MCP server.
Capabilities:
- ✅ Read-Write Operations - Full Docker and SSH management
- ✅ Multi-Host Orchestration - Auto-discovery from SSH config
- ✅ Intelligent Caching - Compose project discovery (24hr TTL)
- ✅ Security-First - Command allowlisting, path validation
- ✅ Performance Optimized - SSH connection pooling (50× speedup)
Tool Selection
Use Flux When:
- Managing Docker containers (start, stop, restart, logs, stats)
- Orchestrating Compose projects (up, down, recreate)
- Working with Docker images (pull, build, prune)
- Checking host system health (resources, uptime, services)
- Managing Docker networks or volumes
Use Scout When:
- Reading/writing remote files
- Executing allowlisted commands on remote hosts
- Managing ZFS pools, datasets, snapshots
- Analyzing system logs (syslog, journal, dmesg, auth)
- Transferring files between hosts
- Monitoring processes or disk usage
Quick Command Reference
Flux Operations
Container Management:
/flux list containers
/flux start container-name
/flux logs nginx --lines 50 --grep error
/flux stats plex
/flux exec container-name ls -la /data
Compose Projects:
/flux list compose projects
/flux up media-stack
/flux down media-stack
/flux logs media-stack
/flux recreate media-stack --pull
Host Diagnostics:
/flux check host status
/flux show system resources
/flux list docker images
/flux show disk usage
Scout Operations
File Operations:
/scout list hosts
/scout read production:/etc/docker/daemon.json
/scout exec production df -h
/scout find files matching *.log on production
ZFS Management:
/scout show zfs pools on storage
/scout list zfs datasets on storage
/scout show zfs snapshots on storage
Log Analysis:
/scout show journal logs on production
/scout show syslog on production --grep error
/scout show auth logs on production
Common Workflows
1. Docker Deployment
Deploy new version:
- Check current status:
/flux list containers --state running - Pull latest images:
/flux pull media-stack - Stop old version:
/flux down media-stack - Start new version:
/flux up media-stack - Verify health:
/flux logs media-stack --lines 20 - Monitor resources:
/flux stats
Quick restart:
- Restart services:
/flux restart media-stack - Check logs:
/flux logs media-stack
2. Multi-Host Health Check
System overview:
- List all hosts:
/scout list hosts - Check Docker status:
/flux check all hosts - View system resources:
/flux show resources on all hosts - Check critical services:
/flux show services on all hosts
Storage health:
- Check ZFS pools:
/scout show zfs pools on storage - Disk usage:
/scout exec all-hosts df -h - Mount status:
/flux show mounts on all hosts
3. Troubleshooting
Container issues:
- Check container state:
/flux list containers --name problematic-service - View recent logs:
/flux logs service --lines 100 --since 1h - Inspect configuration:
/flux inspect service - Check processes:
/flux top service - Verify resources:
/flux stats service
Application errors:
- Search logs:
/flux logs service --grep "ERROR|FATAL" - Check system logs:
/scout show journal on host --unit service - Review auth logs:
/scout show auth logs on host - Compare configs:
/scout compare host1:/config host2:/config
4. Log Aggregation
Centralized log analysis:
- Get container logs:
/flux logs --all --since 1h --grep error - Get system logs:
/scout show journal on all hosts --since 1h - Get auth activity:
/scout show auth logs on all hosts - Get kernel messages:
/scout show dmesg on all hosts
Best Practices
Multi-Host Management
Auto-Discovery:
- Hosts from
~/.ssh/configare automatically available - Use
synapse.config.jsonfor advanced host configuration - Tag hosts for filtering (production, staging, storage)
Host Targeting:
- Omit
hostparameter to run on all discovered hosts - Use specific host name for targeted operations
- Use
emitfor parallel multi-host commands
Compose Discovery:
- Projects are auto-discovered with 24hr cache
- Default search paths:
/compose,/mnt/cache/compose,/mnt/cache/code - Use
/flux refresh compose cacheto force re-scan - Explicit host targeting skips discovery (faster)
Performance
Caching:
- Compose projects cached for 24 hours (configurable via
COMPOSE_CACHE_TTL_HOURS) - SSH connections pooled (50× faster than new connections)
- Container-to-host mapping cached to avoid repeated lookups
Pagination:
- Use
--limitfor large result sets (default: 50, max: 1000) - Use
--offsetfor browsing paginated data - Filter early (state, name, image) to reduce data transfer
Filtering:
- Container filters: state, name, image, labels
- Log filters: time range (
--since,--until), grep patterns - Process filters: user, CPU threshold, memory threshold
Security
Command Execution:
- Scout
execonly allows 20+ safe commands (cat, grep, find, ls, stat, etc.) - Never expose credentials in logs or output
- Use SSH key authentication (not passwords)
- Path traversal protection (no
..in paths)
Destructive Operations:
recreate,down,rmi,prunerequireforce: true- Always check impact before destructive operations
- Use
--dry-runwhere available
Validation:
- All input validated with Zod schemas (O(1) discrimination)
- Safe grep patterns only (no injection)
- Command allowlisting enforced
Error Handling
Transient Failures:
- SSH connection errors: Check network, verify host in
~/.ssh/config - Docker connection errors: Verify Docker socket accessibility
- Compose discovery timeout: Use explicit host targeting
Permanent Failures:
- Invalid host: Add to SSH config or synapse.config.json
- Permission denied: Verify SSH keys and Docker socket permissions
- Unknown project: Check compose search paths, run refresh
Recovery:
- Connection pool auto-recovers from transient failures
- Compose cache auto-refreshes on miss
- Failed operations return structured errors with context
Configuration
Environment Variables
Set via .env or shell environment:
SYNAPSE_CONFIG_FILE=/path/to/synapse.config.json
SYNAPSE_DEFAULT_HOST=production
SSH_POOL_MAX_CONNECTIONS=10
COMPOSE_CACHE_TTL_HOURS=24
Host Configuration
Minimal (SSH config only):
Host production
HostName 192.168.1.100
User admin
IdentityFile ~/.ssh/id_rsa
Advanced (synapse.config.json):
{
"hosts": [
{
"name": "production",
"host": "192.168.1.100",
"protocol": "ssh",
"sshUser": "admin",
"sshKeyPath": "~/.ssh/id_rsa",
"composeSearchPaths": ["/opt/stacks", "/srv/docker"],
"tags": ["production", "docker"]
}
]
}
Notes
Compose Auto-Discovery:
- First checks local cache (fastest)
- Falls back to
docker compose ls(medium) - Last resort: filesystem scan (slowest)
- Cache TTL: 24 hours (configurable)
- Manual refresh available
SSH Connection Pooling:
- 50× performance improvement over new connections
- Configurable pool size (default: 10)
- Auto-recovery from failures
- Idle timeout management
Output Formats:
- Default: Human-readable markdown
- Optional: Structured JSON (
response_format: "json") - Pagination support for large datasets
- Context-aware formatting (tables, lists, trees)
Limitations:
- Scout
execlimited to allowlisted commands (security) - Compose projects must be in configured search paths
- ZFS operations require ZFS tools on target host
- Log operations require appropriate permissions
Reference Documentation
For comprehensive documentation, see:
- Flux Operations Reference - All 41 Flux operations with parameters
- Scout Operations Reference - All 16 Scout operations with parameters
- Workflow Guide - Detailed workflow examples
- Best Practices Guide - Advanced usage patterns
- Troubleshooting Guide - Common issues and solutions
For working examples, see:
- Docker Deployment Example - Complete deployment workflow
- Multi-Host Monitoring Example - Health check automation
- Log Analysis Example - Centralized log aggregation
Version: 1.0.0 Last Updated: 2026-03-14