@1mcp/agent 0.32.0 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/build/commands/run/run.d.ts.map +1 -1
  2. package/build/commands/run/run.js +2 -1
  3. package/build/commands/run/run.js.map +1 -1
  4. package/build/constants/mcp.d.ts +1 -1
  5. package/build/constants/mcp.js +1 -1
  6. package/build/core/capabilities/asyncLoadingOrchestrator.d.ts.map +1 -1
  7. package/build/core/capabilities/asyncLoadingOrchestrator.js +1 -0
  8. package/build/core/capabilities/asyncLoadingOrchestrator.js.map +1 -1
  9. package/build/core/configChangeHandler.d.ts +7 -2
  10. package/build/core/configChangeHandler.d.ts.map +1 -1
  11. package/build/core/configChangeHandler.js +14 -7
  12. package/build/core/configChangeHandler.js.map +1 -1
  13. package/build/core/loading/loadingStateTracker.d.ts +19 -0
  14. package/build/core/loading/loadingStateTracker.d.ts.map +1 -1
  15. package/build/core/loading/loadingStateTracker.js +37 -0
  16. package/build/core/loading/loadingStateTracker.js.map +1 -1
  17. package/build/core/loading/mcpLoadingManager.d.ts +103 -8
  18. package/build/core/loading/mcpLoadingManager.d.ts.map +1 -1
  19. package/build/core/loading/mcpLoadingManager.js +301 -31
  20. package/build/core/loading/mcpLoadingManager.js.map +1 -1
  21. package/build/core/server/mcpServerLifecycleManager.d.ts +9 -1
  22. package/build/core/server/mcpServerLifecycleManager.d.ts.map +1 -1
  23. package/build/core/server/mcpServerLifecycleManager.js +22 -0
  24. package/build/core/server/mcpServerLifecycleManager.js.map +1 -1
  25. package/build/core/server/serverManager.d.ts +8 -0
  26. package/build/core/server/serverManager.d.ts.map +1 -1
  27. package/build/core/server/serverManager.js +83 -1
  28. package/build/core/server/serverManager.js.map +1 -1
  29. package/build/server.d.ts.map +1 -1
  30. package/build/server.js +1 -0
  31. package/build/server.js.map +1 -1
  32. package/package.json +4 -3
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { DEFAULT_MAX_CONCURRENT_LOADS } from '../../constants/mcp.js';
3
3
  import logger, { debugIf } from '../../logger/logger.js';
4
+ import { createTransports } from '../../transport/transportFactory.js';
4
5
  import { LoadingState, LoadingStateEvent, LoadingStateTracker, } from './loadingStateTracker.js';
5
6
  import { ParallelExecutor } from './parallelExecutor.js';
6
7
  /**
@@ -55,17 +56,44 @@ export var McpLoadingEvent;
55
56
  * ```
56
57
  */
57
58
  export class McpLoadingManager extends EventEmitter {
59
+ /**
60
+ * Most-recently constructed instance, exposed so runtime collaborators (e.g.
61
+ * ConfigChangeHandler) can route hot-reload add/remove through the single
62
+ * canonical loading pipeline. Mirrors ServerManager.current / ClientManager.current.
63
+ */
64
+ static _current;
65
+ static get current() {
66
+ if (!McpLoadingManager._current) {
67
+ throw new Error('McpLoadingManager not initialized');
68
+ }
69
+ return McpLoadingManager._current;
70
+ }
58
71
  clientManager;
59
72
  config;
60
73
  stateTracker;
61
74
  backgroundRetryTimer;
62
75
  isShuttingDown = false;
76
+ /** Per-connection-attempt abort controllers (timeout window only) */
63
77
  abortControllers = new Map();
78
+ /**
79
+ * Per-server operation abort controllers.
80
+ *
81
+ * Covers the full lifetime of a `loadServer` or background-retry operation
82
+ * for a given server name — including the retry loop and its sleep delays.
83
+ * Cancelling this controller stops the loop immediately and prevents the
84
+ * operation from writing state back after the server has been removed.
85
+ *
86
+ * Invariant: only ONE entry per server name exists at a time. Starting a new
87
+ * operation for a name (`loadServer`, `performBackgroundRetry`) replaces the
88
+ * previous controller after aborting it via `cancelServerOperation`.
89
+ */
90
+ serverOpAbortControllers = new Map();
64
91
  constructor(clientManager, config = {}) {
65
92
  super();
66
93
  this.clientManager = clientManager;
67
94
  this.config = { ...DEFAULT_LOADING_CONFIG, ...config };
68
95
  this.stateTracker = new LoadingStateTracker();
96
+ McpLoadingManager._current = this;
69
97
  // Forward state tracker events
70
98
  this.stateTracker.on(LoadingStateEvent.ServerStateChanged, (name, info) => {
71
99
  if (info.state === LoadingState.Ready) {
@@ -116,22 +144,150 @@ export class McpLoadingManager extends EventEmitter {
116
144
  // Return current connections (may be empty initially)
117
145
  return this.clientManager.getClients();
118
146
  }
147
+ /**
148
+ * Bring a single server online at runtime (config hot-reload add / rename).
149
+ *
150
+ * This is the canonical runtime counterpart to {@link startAsyncLoading}: it
151
+ * routes a hot-reload-added server through the SAME loading pipeline
152
+ * (`loadSingleServer`) that boot uses, so the server is tracked in the
153
+ * LoadingStateTracker and gets identical retry + OAuth handling. Previously
154
+ * the config-change path called `ServerManager.startServer` directly, which
155
+ * connected the client but never registered it with the tracker — so the new
156
+ * server was invisible to `/health/mcp` (stuck "connecting", no OAuth button).
157
+ *
158
+ * Idempotent: if the server already exists it is fully unloaded first (via
159
+ * `unloadServer`, which cancels any in-flight load operation), making renames
160
+ * and modified-restart correct without leaving ghost connections or stale
161
+ * tracker entries.
162
+ */
163
+ async loadServer(name, config) {
164
+ if (config.disabled) {
165
+ logger.info(`Server ${name} is disabled, skipping load`);
166
+ // Ensure no stale state/connection lingers for a now-disabled server.
167
+ await this.unloadServer(name);
168
+ return;
169
+ }
170
+ // Re-load cleanly if it already exists (rename / functional modify).
171
+ // unloadServer cancels any in-flight operation for this name first.
172
+ if (this.stateTracker.getServerState(name) || this.clientManager.getTransport(name)) {
173
+ await this.unloadServer(name);
174
+ }
175
+ else {
176
+ // Even if not tracked yet, cancel any lingering operation (e.g. a
177
+ // concurrent loadServer call that has not registered with the tracker yet).
178
+ this.cancelServerOperation(name);
179
+ }
180
+ // Claim a new operation slot for this load attempt.
181
+ const opController = new AbortController();
182
+ this.serverOpAbortControllers.set(name, opController);
183
+ let transport;
184
+ try {
185
+ const transports = createTransports({ [name]: config });
186
+ transport = transports[name];
187
+ }
188
+ catch (error) {
189
+ logger.error(`Failed to create transport for ${name}: ${error}`);
190
+ this.stateTracker.registerServer(name);
191
+ this.stateTracker.updateServerState(name, LoadingState.Failed, {
192
+ error: error instanceof Error ? error : new Error(String(error)),
193
+ });
194
+ this.serverOpAbortControllers.delete(name);
195
+ return;
196
+ }
197
+ if (!transport) {
198
+ logger.warn(`No transport created for ${name} (possibly disabled); skipping`);
199
+ this.serverOpAbortControllers.delete(name);
200
+ return;
201
+ }
202
+ // Register with the tracker, then run the shared single-server pipeline.
203
+ this.stateTracker.registerServer(name);
204
+ try {
205
+ await this.loadSingleServer(name, transport, opController.signal);
206
+ }
207
+ finally {
208
+ // Only clean up our own controller — a concurrent loadServer may have
209
+ // replaced it already.
210
+ if (this.serverOpAbortControllers.get(name) === opController) {
211
+ this.serverOpAbortControllers.delete(name);
212
+ }
213
+ }
214
+ }
215
+ /**
216
+ * Take a single server offline at runtime (config hot-reload remove / rename
217
+ * old name). Disconnects the client, closes the transport, and clears the
218
+ * server's entry from the LoadingStateTracker so it does not linger as a
219
+ * "ghost" in `/health/mcp`.
220
+ *
221
+ * Cancels any in-flight `loadServer` or background-retry operation for `name`
222
+ * before cleaning up, so that the loop cannot write state back after removal.
223
+ */
224
+ async unloadServer(name) {
225
+ // Cancel any in-flight load or background-retry for this server FIRST, so
226
+ // the retry loop cannot wake up after removal and re-add connections.
227
+ this.cancelServerOperation(name);
228
+ try {
229
+ await this.clientManager.removeClient(name);
230
+ }
231
+ catch (error) {
232
+ // Guard against: client not present / transport already closed; we still
233
+ // want to clear tracker state below.
234
+ debugIf(() => ({ message: `unloadServer: removeClient(${name}) noop/err: ${error}` }));
235
+ }
236
+ this.stateTracker.removeServer(name);
237
+ logger.info(`Unloaded MCP server: ${name}`);
238
+ }
239
+ /**
240
+ * Abort and remove the operation-level AbortController for `name`, if one
241
+ * exists. This is the single authoritative way to interrupt a `loadSingleServer`
242
+ * retry loop (including its sleep delays and connection attempt) for a specific
243
+ * server.
244
+ *
245
+ * Safe to call when no operation is in flight — it is a no-op in that case.
246
+ */
247
+ cancelServerOperation(name) {
248
+ const controller = this.serverOpAbortControllers.get(name);
249
+ if (controller) {
250
+ controller.abort();
251
+ this.serverOpAbortControllers.delete(name);
252
+ }
253
+ }
119
254
  /**
120
255
  * Load servers with concurrency control using ParallelExecutor
121
256
  */
122
257
  async loadServersWithConcurrency(transports) {
123
258
  const executor = new ParallelExecutor();
124
259
  const serverEntries = Object.entries(transports);
125
- await executor.execute(serverEntries, async ([name, transport]) => this.loadSingleServer(name, transport), {
260
+ await executor.execute(serverEntries, async ([name, transport]) => {
261
+ if (this.isShuttingDown)
262
+ return;
263
+ this.cancelServerOperation(name);
264
+ const opController = new AbortController();
265
+ this.serverOpAbortControllers.set(name, opController);
266
+ try {
267
+ await this.loadSingleServer(name, transport, opController.signal);
268
+ }
269
+ finally {
270
+ if (this.serverOpAbortControllers.get(name) === opController) {
271
+ this.serverOpAbortControllers.delete(name);
272
+ }
273
+ }
274
+ }, {
126
275
  maxConcurrent: this.config.maxConcurrentLoads,
127
276
  });
128
277
  logger.info('Initial server loading phase completed');
129
278
  }
130
279
  /**
131
- * Load a single server with retry logic
280
+ * Load a single server with retry logic.
281
+ *
282
+ * @param opSignal - Operation-level abort signal provided by the caller
283
+ * (`loadServer` or `performBackgroundRetry`). When this signal fires the
284
+ * retry loop terminates immediately — without writing a Failed state to the
285
+ * tracker — because the cancellation was intentional (e.g. `unloadServer`
286
+ * was called concurrently). The signal is also threaded down into
287
+ * `createClientWithTimeout` so the active connection attempt is aborted too.
132
288
  */
133
- async loadSingleServer(name, transport) {
134
- if (this.isShuttingDown)
289
+ async loadSingleServer(name, transport, opSignal) {
290
+ if (this.isShuttingDown || opSignal?.aborted)
135
291
  return;
136
292
  this.emit(McpLoadingEvent.ServerLoading, name);
137
293
  this.stateTracker.updateServerState(name, LoadingState.Loading, {
@@ -139,7 +295,7 @@ export class McpLoadingManager extends EventEmitter {
139
295
  });
140
296
  let lastError;
141
297
  let retryCount = 0;
142
- while (retryCount <= this.config.maxRetries && !this.isShuttingDown) {
298
+ while (retryCount <= this.config.maxRetries && !this.isShuttingDown && !opSignal?.aborted) {
143
299
  try {
144
300
  this.stateTracker.updateServerState(name, LoadingState.Loading, {
145
301
  progress: {
@@ -148,33 +304,51 @@ export class McpLoadingManager extends EventEmitter {
148
304
  },
149
305
  });
150
306
  // Attempt to create and connect client
151
- await this.createClientWithTimeout(name, transport);
307
+ await this.createClientWithTimeout(name, transport, opSignal);
152
308
  // Success!
153
309
  this.stateTracker.updateServerState(name, LoadingState.Ready);
154
310
  logger.info(`Successfully loaded MCP server: ${name} (${retryCount} retries)`);
155
311
  return;
156
312
  }
157
313
  catch (error) {
314
+ // If the operation was cancelled, exit cleanly without marking Failed.
315
+ if (opSignal?.aborted) {
316
+ debugIf(() => ({ message: `loadSingleServer: operation cancelled for ${name}` }));
317
+ return;
318
+ }
158
319
  lastError = error instanceof Error ? error : new Error(String(error));
159
320
  retryCount++;
160
321
  this.stateTracker.incrementRetryCount(name);
161
322
  // Handle OAuth case specially
162
323
  if (lastError.name === 'OAuthRequiredError') {
163
324
  logger.info(`OAuth required for ${name}`);
325
+ const authorizationUrl = this.extractAuthorizationUrl(name, transport);
164
326
  this.stateTracker.updateServerState(name, LoadingState.AwaitingOAuth, {
165
327
  error: lastError,
328
+ authorizationUrl,
166
329
  });
167
330
  return; // Don't retry OAuth errors
168
331
  }
169
332
  // Handle other errors
170
333
  logger.warn(`Failed to load ${name} (attempt ${retryCount}): ${lastError.message}`);
171
- if (retryCount <= this.config.maxRetries && !this.isShuttingDown) {
334
+ if (retryCount <= this.config.maxRetries && !this.isShuttingDown && !opSignal?.aborted) {
172
335
  const delay = this.config.retryDelayMs * Math.pow(2, retryCount - 1); // Exponential backoff
173
336
  logger.info(`Retrying ${name} in ${delay}ms...`);
174
- await this.sleep(delay);
337
+ try {
338
+ await this.sleep(delay, opSignal);
339
+ }
340
+ catch {
341
+ // sleep was interrupted by opSignal abort; exit cleanly.
342
+ return;
343
+ }
175
344
  }
176
345
  }
177
346
  }
347
+ // If we exited the loop due to intentional cancellation (per-server abort)
348
+ // or global shutdown, don't mark the server as Failed — the exit was
349
+ // deliberate, not a real failure.
350
+ if (opSignal?.aborted || this.isShuttingDown)
351
+ return;
178
352
  // All retries exhausted
179
353
  this.stateTracker.updateServerState(name, LoadingState.Failed, {
180
354
  error: lastError || new Error('Unknown error'),
@@ -188,12 +362,20 @@ export class McpLoadingManager extends EventEmitter {
188
362
  }
189
363
  }
190
364
  /**
191
- * Create client with timeout and cancellation support
365
+ * Create client with timeout and cancellation support.
366
+ *
367
+ * @param opSignal - Operation-level signal from `loadSingleServer`. When it
368
+ * fires (e.g. because `unloadServer` was called), it is linked to the
369
+ * internal per-connection-attempt AbortController so that the active
370
+ * connection and its timeout are both cancelled.
192
371
  */
193
- async createClientWithTimeout(name, transport) {
372
+ async createClientWithTimeout(name, transport, opSignal) {
194
373
  // Create abort controller for this specific server loading operation
195
374
  const abortController = new AbortController();
196
375
  this.abortControllers.set(name, abortController);
376
+ // Propagate operation-level cancellation to the connection-attempt abort.
377
+ const onOpAbort = () => abortController.abort();
378
+ opSignal?.addEventListener('abort', onOpAbort, { once: true });
197
379
  try {
198
380
  const timeoutPromise = new Promise((_, reject) => {
199
381
  const timeoutId = setTimeout(() => {
@@ -212,13 +394,21 @@ export class McpLoadingManager extends EventEmitter {
212
394
  finally {
213
395
  // Clean up abort controller
214
396
  this.abortControllers.delete(name);
397
+ opSignal?.removeEventListener('abort', onOpAbort);
215
398
  }
216
399
  }
217
400
  /**
218
- * Set up background retry for failed servers
401
+ * Set up background retry for failed servers.
402
+ *
403
+ * Idempotent: no-ops if a timer is already running. Without this guard,
404
+ * every hot-reload cycle that drives the tracker to a "complete" summary
405
+ * (e.g. unloadServer leaving all remaining servers ready) would fire
406
+ * LoadingComplete again and install a second interval on top of the first,
407
+ * causing failed servers to be retried N times per tick after N hot-reload
408
+ * cycles.
219
409
  */
220
410
  setupBackgroundRetry() {
221
- if (!this.config.enableBackgroundRetry || this.isShuttingDown) {
411
+ if (!this.config.enableBackgroundRetry || this.isShuttingDown || this.backgroundRetryTimer) {
222
412
  return;
223
413
  }
224
414
  this.backgroundRetryTimer = setInterval(() => {
@@ -242,13 +432,28 @@ export class McpLoadingManager extends EventEmitter {
242
432
  for (const serverInfo of serversToRetry) {
243
433
  if (this.isShuttingDown)
244
434
  break;
245
- const transport = this.clientManager.getTransport(serverInfo.name);
435
+ const { name } = serverInfo;
436
+ const transport = this.clientManager.getTransport(name);
246
437
  if (transport) {
247
- this.emit(McpLoadingEvent.BackgroundRetry, serverInfo.name, serverInfo.retryCount + 1);
438
+ this.emit(McpLoadingEvent.BackgroundRetry, name, serverInfo.retryCount + 1);
439
+ // Cancel any previous operation for this server and claim a new slot.
440
+ // This prevents a stale background-retry from racing with a concurrent
441
+ // loadServer or unloadServer call.
442
+ this.cancelServerOperation(name);
443
+ const opController = new AbortController();
444
+ this.serverOpAbortControllers.set(name, opController);
248
445
  // Don't wait for completion, let it run in background
249
- this.loadSingleServer(serverInfo.name, transport).catch((error) => {
446
+ this.loadSingleServer(name, transport, opController.signal)
447
+ .catch((error) => {
250
448
  const errorMessage = error instanceof Error ? error.message : String(error);
251
- debugIf(() => ({ message: `Background retry failed for ${serverInfo.name}: ${errorMessage}` }));
449
+ debugIf(() => ({ message: `Background retry failed for ${name}: ${errorMessage}` }));
450
+ })
451
+ .finally(() => {
452
+ // Clean up our own controller only — a concurrent operation may have
453
+ // replaced it.
454
+ if (this.serverOpAbortControllers.get(name) === opController) {
455
+ this.serverOpAbortControllers.delete(name);
456
+ }
252
457
  });
253
458
  }
254
459
  }
@@ -259,6 +464,22 @@ export class McpLoadingManager extends EventEmitter {
259
464
  getStateTracker() {
260
465
  return this.stateTracker;
261
466
  }
467
+ extractAuthorizationUrl(name, transport) {
468
+ const clientInfo = this.clientManager.getClients().get(name);
469
+ if (clientInfo?.authorizationUrl) {
470
+ return clientInfo.authorizationUrl;
471
+ }
472
+ try {
473
+ const oauthProvider = transport.oauthProvider;
474
+ if (oauthProvider && typeof oauthProvider.getAuthorizationUrl === 'function') {
475
+ return oauthProvider.getAuthorizationUrl();
476
+ }
477
+ }
478
+ catch (error) {
479
+ debugIf(() => ({ message: `Could not extract authorization URL for ${name}: ${error}` }));
480
+ }
481
+ return undefined;
482
+ }
262
483
  /**
263
484
  * Get current loading summary
264
485
  */
@@ -285,17 +506,37 @@ export class McpLoadingManager extends EventEmitter {
285
506
  return this.stateTracker.getServersByState(LoadingState.Failed).map((s) => s.name);
286
507
  }
287
508
  /**
288
- * Cancel loading of a specific server
509
+ * Cancel loading of a specific server.
510
+ *
511
+ * Cancels both the operation-level retry loop (serverOpAbortControllers) and
512
+ * the active connection-attempt timeout (abortControllers). Before this fix,
513
+ * only the connection-attempt abort was signalled, so a server sleeping
514
+ * between retries would continue uninterrupted and could resurface as Loading,
515
+ * Ready, or Failed after the caller believed it was cancelled.
289
516
  */
290
517
  cancelServerLoading(serverName) {
518
+ const hasOpController = this.serverOpAbortControllers.has(serverName);
519
+ const hasConnController = this.abortControllers.has(serverName);
520
+ if (!hasOpController && !hasConnController) {
521
+ logger.warn(`No active loading operation found for server: ${serverName}`);
522
+ return;
523
+ }
524
+ logger.info(`Cancelling loading of server: ${serverName}`);
525
+ // Cancel the full retry loop first (interrupts sleep delays and signals the
526
+ // loop to exit cleanly without writing state back).
527
+ this.cancelServerOperation(serverName);
528
+ // Also abort the active connection-attempt controller if one exists (covers
529
+ // the case where we are mid-connect and cancelServerOperation has not yet
530
+ // propagated through createClientWithTimeout).
291
531
  const abortController = this.abortControllers.get(serverName);
292
532
  if (abortController) {
293
- logger.info(`Cancelling loading of server: ${serverName}`);
294
533
  abortController.abort();
295
- this.stateTracker.updateServerState(serverName, LoadingState.Cancelled);
296
534
  }
297
- else {
298
- logger.warn(`No active loading operation found for server: ${serverName}`);
535
+ // Mark the tracker entry as Cancelled only if the server is still tracked.
536
+ // (cancelServerOperation may have already removed it via unloadServer; guard
537
+ // to avoid "unknown server" warning from updateServerState.)
538
+ if (this.stateTracker.getServerState(serverName)) {
539
+ this.stateTracker.updateServerState(serverName, LoadingState.Cancelled);
299
540
  }
300
541
  }
301
542
  /**
@@ -307,20 +548,28 @@ export class McpLoadingManager extends EventEmitter {
307
548
  }
308
549
  }
309
550
  /**
310
- * Cancel all currently loading servers
551
+ * Cancel all currently loading servers.
552
+ *
553
+ * Previously iterated only abortControllers (connection-attempt window), so
554
+ * servers sleeping between retries were invisible and never cancelled. Now
555
+ * collects the union of both maps so every in-flight operation is reached.
311
556
  */
312
557
  cancelAllLoading() {
313
- const loadingServers = Array.from(this.abortControllers.keys());
314
- if (loadingServers.length > 0) {
315
- logger.info(`Cancelling loading of ${loadingServers.length} servers`);
316
- this.cancelServersLoading(loadingServers);
558
+ // Union of servers that are either mid-connection-attempt or mid-retry-sleep.
559
+ const allActive = new Set([...this.abortControllers.keys(), ...this.serverOpAbortControllers.keys()]);
560
+ if (allActive.size > 0) {
561
+ logger.info(`Cancelling loading of ${allActive.size} servers`);
562
+ this.cancelServersLoading(Array.from(allActive));
317
563
  }
318
564
  }
319
565
  /**
320
- * Get list of servers that are currently being loaded and can be cancelled
566
+ * Get list of servers that are currently being loaded and can be cancelled.
567
+ *
568
+ * Returns the union of servers with an active connection attempt and servers
569
+ * sleeping between retries — both are cancellable via cancelServerLoading.
321
570
  */
322
571
  getCancellableServers() {
323
- return Array.from(this.abortControllers.keys());
572
+ return Array.from(new Set([...this.abortControllers.keys(), ...this.serverOpAbortControllers.keys()]));
324
573
  }
325
574
  /**
326
575
  * Shutdown the loading manager
@@ -331,6 +580,12 @@ export class McpLoadingManager extends EventEmitter {
331
580
  clearInterval(this.backgroundRetryTimer);
332
581
  this.backgroundRetryTimer = undefined;
333
582
  }
583
+ // Cancel all per-server operation controllers first (interrupts retry loops
584
+ // and sleep delays), then cancel the per-connection-attempt controllers.
585
+ for (const controller of this.serverOpAbortControllers.values()) {
586
+ controller.abort();
587
+ }
588
+ this.serverOpAbortControllers.clear();
334
589
  // Cancel any active loading operations
335
590
  this.cancelAllLoading();
336
591
  // Update state for any remaining pending/loading servers
@@ -342,10 +597,25 @@ export class McpLoadingManager extends EventEmitter {
342
597
  logger.info('MCP loading manager shutdown complete');
343
598
  }
344
599
  /**
345
- * Utility method for sleeping
600
+ * Utility method for sleeping.
601
+ *
602
+ * When `signal` is provided the sleep is cancellable: aborting the signal
603
+ * rejects the returned promise immediately (clearing the underlying timer),
604
+ * which causes the retry loop in `loadSingleServer` to exit without waiting
605
+ * for the full delay.
346
606
  */
347
- sleep(ms) {
348
- return new Promise((resolve) => setTimeout(resolve, ms));
607
+ sleep(ms, signal) {
608
+ return new Promise((resolve, reject) => {
609
+ if (signal?.aborted) {
610
+ reject(new Error('Sleep aborted'));
611
+ return;
612
+ }
613
+ const id = setTimeout(resolve, ms);
614
+ signal?.addEventListener('abort', () => {
615
+ clearTimeout(id);
616
+ reject(new Error('Sleep aborted'));
617
+ }, { once: true });
618
+ });
349
619
  }
350
620
  }
351
621
  //# sourceMappingURL=mcpLoadingManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcpLoadingManager.js","sourceRoot":"","sources":["../../../src/core/loading/mcpLoadingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,GAGpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAsBzD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqB;IACtD,eAAe,EAAE,KAAK,EAAE,wBAAwB;IAChD,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,IAAI,EAAE,0BAA0B;IAC9C,kBAAkB,EAAE,4BAA4B;IAChD,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,IAAI;IAC3B,yBAAyB,EAAE,KAAK,EAAE,qBAAqB;CACxD,CAAC;AAaF;;GAEG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,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjF,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEjF,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,cAAc,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;QAC3E,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;;OAOG;IACK,KAAK,CAAC,EAAU,EAAE,MAAoB;QAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;gBACnC,OAAO;YACT,CAAC;YAED,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAEnC,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE;gBACH,YAAY,CAAC,EAAE,CAAC,CAAC;gBACjB,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;YACrC,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
2
2
  import type { OutboundConnections } from '../../core/types/client.js';
3
- import { MCPServerParams } from '../../core/types/index.js';
3
+ import { AuthProviderTransport, MCPServerParams } from '../../core/types/index.js';
4
4
  /**
5
5
  * Manages the lifecycle of MCP server instances (start, stop, restart)
6
6
  */
@@ -31,6 +31,14 @@ export declare class MCPServerLifecycleManager {
31
31
  * Check if a specific MCP server is running
32
32
  */
33
33
  isMcpServerRunning(serverName: string): boolean;
34
+ /**
35
+ * Track a server whose connection is managed by another startup path.
36
+ */
37
+ trackServer(serverName: string, config: MCPServerParams, transport: AuthProviderTransport): void;
38
+ /**
39
+ * Remove lifecycle tracking without touching the already-cleaned-up transport.
40
+ */
41
+ untrackServer(serverName: string): void;
34
42
  /**
35
43
  * Update metadata for a running server without restarting it
36
44
  */
@@ -1 +1 @@
1
- {"version":3,"file":"mcpServerLifecycleManager.d.ts","sourceRoot":"","sources":["../../../src/core/server/mcpServerLifecycleManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAK1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAyB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIlF;;GAEG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,UAAU,CAAyF;IAC3G,OAAO,CAAC,aAAa,CAAC,CAAgB;;IAMtC;;OAEG;IACU,WAAW,CACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAyChB;;OAEG;IACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAkChB;;OAEG;IACU,aAAa,CACxB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAqBhB;;OAEG;IACI,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,eAAe,CAAA;KAAE,CAAC;IAavF;;OAEG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACU,oBAAoB,CAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,EAC1B,aAAa,EAAE,mBAAmB,GACjC,OAAO,CAAC,IAAI,CAAC;IA6ChB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA0B3B;;OAEG;YACW,qBAAqB;IAgCnC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,oBAAoB;CA0BnC"}
1
+ {"version":3,"file":"mcpServerLifecycleManager.d.ts","sourceRoot":"","sources":["../../../src/core/server/mcpServerLifecycleManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAK1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIlF;;GAEG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,UAAU,CAAyF;IAC3G,OAAO,CAAC,aAAa,CAAC,CAAgB;;IAMtC;;OAEG;IACU,WAAW,CACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAyChB;;OAEG;IACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAkChB;;OAEG;IACU,aAAa,CACxB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,mBAAmB,EAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC;IAqBhB;;OAEG;IACI,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,eAAe,CAAA;KAAE,CAAC;IAavF;;OAEG;IACI,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACI,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,qBAAqB,GAAG,IAAI;IAavG;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAM9C;;OAEG;IACU,oBAAoB,CAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,eAAe,EAC1B,aAAa,EAAE,mBAAmB,GACjC,OAAO,CAAC,IAAI,CAAC;IA6ChB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA0B3B;;OAEG;YACW,qBAAqB;IAgCnC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,oBAAoB;CA0BnC"}
@@ -121,6 +121,28 @@ export class MCPServerLifecycleManager {
121
121
  isMcpServerRunning(serverName) {
122
122
  return this.mcpServers.has(serverName);
123
123
  }
124
+ /**
125
+ * Track a server whose connection is managed by another startup path.
126
+ */
127
+ trackServer(serverName, config, transport) {
128
+ if (config.disabled) {
129
+ this.mcpServers.delete(serverName);
130
+ return;
131
+ }
132
+ this.mcpServers.set(serverName, { transport, config });
133
+ debugIf(() => ({
134
+ message: `Tracked MCP server lifecycle state: ${serverName}`,
135
+ meta: { serverName, tags: config.tags },
136
+ }));
137
+ }
138
+ /**
139
+ * Remove lifecycle tracking without touching the already-cleaned-up transport.
140
+ */
141
+ untrackServer(serverName) {
142
+ if (this.mcpServers.delete(serverName)) {
143
+ debugIf(() => ({ message: `Untracked MCP server lifecycle state: ${serverName}` }));
144
+ }
145
+ }
124
146
  /**
125
147
  * Update metadata for a running server without restarting it
126
148
  */