Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,12 @@ class Launcher {
}

this.state = States.STARTING

// The node-red node_modules may have been (re)installed or relinked,
// so any previously-resolved MCP SDK could now be stale. Drop the cached
// reference so it is re-resolved against the current install on next use.
this.agent?.mqttClient?.mcp?.resetSdk?.()

if (!existsSync(this.projectDir) ||
!existsSync(this.files.flows) ||
!existsSync(this.files.credentials) ||
Expand Down Expand Up @@ -751,6 +757,11 @@ class Launcher {
let finalState = States.STOPPED
this.stopReason = reason || 'shutdown'
info('Stopping Node-RED. Reason: ' + this.stopReason)

// Drop any cached MCP SDK reference: the SDK files may be removed (clean
// stop) or replaced before the next start, so they must not be reused.
this.agent?.mqttClient?.mcp?.resetSdk?.()

if (this.stopReason === States.SUSPENDED) {
finalState = States.SUSPENDED
}
Expand Down
Loading