fix: add disposed guard to MCP manager and guard unregister on pending connections

This commit is contained in:
YeonGyu-Kim
2026-03-12 00:51:02 +09:00
parent f564404015
commit aa1aad3bb1
6 changed files with 11 additions and 2 deletions
@@ -15,6 +15,10 @@ export async function getOrCreateClient(params: {
}): Promise<Client> {
const { state, clientKey, info, config } = params
if (state.disposed) {
throw new Error(`MCP manager for "${info.sessionID}" has been shut down, cannot create new connections.`)
}
const existing = state.clients.get(clientKey)
if (existing) {
existing.lastUsedAt = Date.now()