🔐 fix: Remove OAuth handler cleanup at Connection Change (#9589)

This commit is contained in:
Danny Avila 2025-09-12 00:34:45 -04:00 committed by GitHub
parent b62ffb533c
commit 133312fb40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -220,18 +220,8 @@ export class MCPConnectionFactory {
connection.on('oauthRequired', oauthHandler);
/** Handler reference for cleanup when connection state changes to disconnected */
const cleanupHandler = (state: string) => {
if (state === 'disconnected') {
connection.removeListener('oauthRequired', oauthHandler);
connection.removeListener('connectionChange', cleanupHandler);
}
};
connection.on('connectionChange', cleanupHandler);
return () => {
connection.removeListener('oauthRequired', oauthHandler);
connection.removeListener('connectionChange', cleanupHandler);
};
}