Skip to content

Commit 0ca6146

Browse files
committed
fix(backend): correct satellite command event types for MCP deletion operations
Previously, deletion operations incorrectly sent 'mcp_installation_created' events to satellites. This bug occurred because the code called notifyMcpInstallation() for all operations including deletions. Changes: - Add notifyMcpDeletion() method to SatelliteCommandService - Fix delete.ts route to use notifyMcpDeletion() instead of notifyMcpInstallation() - Fix mcpServerCascadeDeletionWorker to use correct deletion method - Fix teamService deleteTeam to use correct deletion method for all team installations - Add comprehensive satellite commands documentation - Update satellite communication docs with event types reference This ensures database records and logs accurately reflect operation types (mcp_installation_deleted vs mcp_installation_created) and sets proper foundation for future event-driven satellite processing.
1 parent 9c2e4c0 commit 0ca6146

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

services/backend/src/routes/mcp/installations/delete.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ export default async function deleteInstallationRoute(server: FastifyInstance) {
8989
// Create satellite commands for configuration update notification
9090
try {
9191
const satelliteCommandService = new SatelliteCommandService(db, request.log);
92-
const commands = await satelliteCommandService.notifyMcpInstallation(
92+
const commands = await satelliteCommandService.notifyMcpDeletion(
9393
installationId,
9494
teamId,
9595
userId
9696
);
97-
97+
9898
request.log.info({
9999
operation: 'delete_mcp_installation',
100100
installationId,

services/backend/src/services/satelliteCommandService.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,23 @@ export class SatelliteCommandService {
326326
});
327327
}
328328

329+
/**
330+
* Convenience method for MCP deletion events
331+
* Creates immediate priority configure commands for all global satellites
332+
*/
333+
async notifyMcpDeletion(installationId: string, teamId: string, userId?: string): Promise<SatelliteCommand[]> {
334+
return await this.createCommandForAllGlobalSatellites({
335+
commandType: 'configure',
336+
priority: 'immediate',
337+
payload: {
338+
event: 'mcp_installation_deleted',
339+
installation_id: installationId,
340+
team_id: teamId
341+
},
342+
targetTeamId: teamId,
343+
expiresInMinutes: 5,
344+
createdBy: userId
345+
});
346+
}
347+
329348
}

services/backend/src/services/teamService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export class TeamService {
309309

310310
// 2. Create satellite commands to kill processes (fire-and-forget)
311311
try {
312-
const commands = await satelliteCommandService.notifyMcpInstallation(
312+
const commands = await satelliteCommandService.notifyMcpDeletion(
313313
installation.id,
314314
teamId,
315315
userId

services/backend/src/workers/mcpServerCascadeDeletionWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class McpServerCascadeDeletionWorker implements Worker {
251251

252252
// Notify satellites to refresh configuration
253253
try {
254-
const commands = await this.satelliteCommandService.notifyMcpInstallation(
254+
const commands = await this.satelliteCommandService.notifyMcpDeletion(
255255
installationId,
256256
teamId,
257257
deletedBy.id

0 commit comments

Comments
 (0)