Event Emission
The satellite communicates with the backend through a centralized EventBus that emits typed events. These events enable real-time status updates, log streaming, and tool metadata synchronization without polling.Overview
The satellite emits events for:- Status Changes: Real-time installation status updates
- Server Logs: Batched stderr output from MCP servers
- Request Logs: Batched tool execution logs with request/response data
- Tool Metadata: Tool discovery results with token counts
- Process Lifecycle: Server start, crash, restart, permanent failure events
Event System Architecture
Event Types Reference
mcp.server.status_changed
Purpose: Update installation status in real-time Emitted by:- ProcessManager (connecting, online, crashed, permanently_failed)
- McpServerWrapper (offline, error, requires_reauth on tool execution failures)
- RemoteToolDiscoveryManager (connecting, online, offline, error, requires_reauth)
mcpServerInstallations.status and broadcasts via SSE
mcp.server.logs
Purpose: Stream server logs (stderr, connection errors, startup messages) to backend Emitted by:- ProcessManager (batched stderr output from stdio MCP servers)
- Interval: 3 seconds after first log entry
- Max Size: 20 logs per batch (forces immediate flush)
- Grouping: By
installation_id + team_id
mcpServerLogs table, enforces 100-line limit per installation
mcp.request.logs
Purpose: Stream tool execution logs with full request/response data Emitted by:- McpServerWrapper (batched tool call logs)
- Interval: 3 seconds after first request
- Max Size: 20 requests per batch
- Grouping: By
installation_id + team_id
mcpRequestLogs table, enforces 100-line limit
Privacy Note: Only emitted if settings.request_logging_enabled !== false
mcp.tools.discovered
Purpose: Synchronize discovered tools and metadata to backend Emitted by:- UnifiedToolDiscoveryManager (after tool discovery completes)
mcpTools table with discovered tools and metadata
Process Lifecycle Events
These events track stdio MCP server process state:mcp.server.started
Emitted when: Stdio process successfully spawned Payload:mcp.server.crashed
Emitted when: Stdio process terminates unexpectedly Payload:mcp.server.restarted
Emitted when: Stdio process automatically restarted after crash Payload:mcp.server.permanently_failed
Emitted when: Stdio process crashes 3 times within 5 minutes Payload:permanently_failed, requires manual restart
Event Batching Strategy
Why Batching?
Batching reduces:- Backend API calls (20 logs = 1 API call instead of 20)
- Database transactions (bulk insert instead of individual inserts)
- Network overhead (fewer HTTP requests)
- Backend processing load (batch operations are more efficient)
Batching Configuration
| Parameter | Value | Reason |
|---|---|---|
| Batch Interval | 3 seconds | Balance between real-time feel and efficiency |
| Max Batch Size | 20 entries | Prevent large payloads, force timely emission |
| Grouping Key | installation_id + team_id | Separate batches per installation |
Batching Implementation
Log batching implementation details are in Log Capture - Buffering Implementation for both server logs and request logs.EventBus Usage
Emitting Events
Event Registry
All event types are defined in the event registry:Backend Event Handlers
Each event type has a dedicated backend handler: Status Changed:Integration Points
Process Manager:- Emits server logs (stderr batching)
- Emits lifecycle events (started, crashed, restarted, permanently_failed)
- Emits status changes (connecting, online, permanently_failed)
- Emits request logs (tool execution batching)
- Emits status changes (offline, error, requires_reauth on failures)
- Emits status changes (connecting, online on recovery)
- Emit status changes (connecting, discovering_tools, online, offline, error)
- Trigger tool metadata emission via UnifiedToolDiscoveryManager
- Emits
mcp.tools.discoveredafter successful discovery - Coordinates status callbacks from discovery managers
Implementation Components
The event emission system consists of several integrated components:- Backend event handler system
- Satellite status event emission
- Server and request log batching
- Tool metadata event emission
- Stdio permanently_failed event
- Tool execution failure status events
Related Documentation
- Status Tracking - Status values and lifecycle
- Log Capture - Logging system details
- Process Management - Lifecycle events
- Tool Discovery - Tool metadata events

