Command Queue Architecture
Commands are created by the backend and stored in thesatelliteCommands table. Satellites poll for pending commands, execute them, and report results back to the backend.
Command Flow
- Command Queue: PostgreSQL table with priority-based ordering
- Polling: Satellites poll every 2-60 seconds based on priority
- Execution: Satellite processes command and performs action
- Result Reporting: Satellite reports success/failure back to backend
Command Types
The system supports 5 command types defined in thecommand_type enum:
| Command Type | Purpose | Satellite Action |
|---|---|---|
configure | Trigger configuration refresh | Fetch fresh config, apply changes |
spawn | Start MCP server process | Launch HTTP proxy or stdio process |
kill | Stop MCP server process | Terminate process gracefully |
restart | Restart MCP server | Stop and start process |
health_check | Verify server health | Call tools/list to check connectivity |
Configure Commands
Most Common: Used for all MCP installation lifecycle events (create/update/delete). How It Works:- Backend creates
configurecommand with event metadata - Satellite fetches fresh configuration from backend
- DynamicConfigManager compares old vs. new config
- Identifies added/removed/modified servers
- Takes appropriate action (spawn/restart/terminate)
configure commands trigger a full configuration refresh where changes are detected by comparing configurations.
Command Priorities
Commands are processed based on priority:| Priority | Use Case | Polling Interval |
|---|---|---|
immediate | New installations, deletions | 2 seconds |
high | Server recovery, critical updates | 10 seconds |
normal | Configuration updates | 30 seconds |
low | Maintenance tasks | 60 seconds |
Command Payload Structure
All commands include a JSON payload with event-specific data:Command Event Types
Allconfigure commands include an event field in the payload for tracking and logging:
| Event Type | When Sent | Purpose |
|---|---|---|
mcp_installation_created | New MCP installation | Satellite refreshes config, spawns new servers |
mcp_installation_updated | Config changes (args/env/headers) | Satellite refreshes config, restarts affected servers |
mcp_installation_deleted | Installation removed | Satellite refreshes config, terminates removed servers |
mcp_recovery | Server recovered from failure | Satellite rediscovers tools for recovered server |
Event Field Usage
Current Implementation: The satellite does NOT parse theevent field. All configure commands trigger a full configuration refresh where the satellite:
- Fetches fresh config from backend
- Compares with current running config
- Identifies added/removed/modified servers
- Takes appropriate action
- Database record keeping
- Structured logging
- Future extensibility
- Developer debugging
SatelliteCommandService API
The backend provides convenience methods for creating commands:notifyMcpInstallation()
Creates immediate priority configure commands when a new MCP server is installed.event: 'mcp_installation_created'
notifyMcpUpdate()
Creates immediate priority configure commands when MCP configuration is updated.event: 'mcp_installation_updated'
notifyMcpDeletion()
Creates immediate priority configure commands when an MCP installation is deleted.event: 'mcp_installation_deleted'
notifyMcpRecovery()
Creates high priority configure commands when a server recovers from failure.event: 'mcp_recovery'
Critical Pattern
ALWAYS use the correct convenience method:- Installation created →
notifyMcpInstallation() - Installation updated →
notifyMcpUpdate() - Installation deleted →
notifyMcpDeletion() - Server recovered →
notifyMcpRecovery()
notifyMcpInstallation() for delete operations.
Command Lifecycle
Commands progress through the following states:| Status | Description |
|---|---|
pending | Command created, awaiting satellite poll |
acknowledged | Satellite retrieved command |
executing | Satellite processing command |
completed | Command executed successfully |
failed | Command execution failed |
Retry Logic
Failed commands are automatically retried:- Max Retries: 3 attempts
- Retry Delay: Exponential backoff
- Expiration: Commands expire after 5 minutes
Database Schema
Table:satelliteCommands
Key Fields:
id: Command UUIDsatellite_id: Target satellitecommand_type: One of 5 command typespriority: Command priority levelpayload: JSON command data (includes event type)status: Current execution statetarget_team_id: Team contextcorrelation_id: Request tracingretry_count: Retry attemptserror_message: Failure detailsresult: Execution result
Command Processing on Satellite
When satellites receive commands: Forconfigure commands:
- Fetch fresh configuration from backend
- Compare with current running config
- Identify changes (added/removed/modified servers)
- Execute appropriate actions:
- Added: Spawn new processes
- Modified: Restart affected processes
- Removed: Terminate processes
spawn commands:
- Parse server configuration
- For stdio: Launch subprocess with JSON-RPC
- For HTTP/SSE: Create proxy tracker entry
- Discover tools via tools/list call
kill commands:
- Locate running process
- Send SIGTERM for graceful shutdown
- Wait for timeout (10 seconds)
- Send SIGKILL if needed
restart commands:
- Execute kill sequence
- Wait for process termination
- Execute spawn sequence
health_check commands:
- Call tools/list on target server
- Verify response
- Report health status
Example Usage
Creating Commands for Installation Deletion
Creating Commands for Configuration Update
Monitoring Commands
Check Command Status
View Command Payload
Monitor Failed Commands
Related Documentation
- Satellite Communication - Overall communication architecture
- Satellite Events - Event system for real-time updates
- Database Management - Schema and migrations

