🔧 fix: Fix rampant pings and rate limiting

- Skips idle connection checks in `getMCPManager` to avoid unnecessary pings.
- Introduces a skipOAuthTimeout flag during initial connection to prevent timeouts during server discovery.
- Uses a lightweight connection state check instead of ping to avoid rate limits.
- Prevents refetch spam and rate limit errors when checking connection status.
- Fixes an issue where the server connection was not being disconnected.
This commit is contained in:
Dustin Healy 2025-07-21 12:53:28 -07:00
parent 1da5365397
commit 10e06f2221
9 changed files with 90 additions and 39 deletions

View file

@ -11,12 +11,13 @@ let flowManager = null;
/**
* @param {string} [userId] - Optional user ID, to avoid disconnecting the current user.
* @param {boolean} [skipIdleCheck] - Skip idle connection checking to avoid unnecessary pings.
* @returns {MCPManager}
*/
function getMCPManager(userId) {
function getMCPManager(userId, skipIdleCheck = false) {
if (!mcpManager) {
mcpManager = MCPManager.getInstance();
} else {
} else if (!skipIdleCheck) {
mcpManager.checkIdleConnections(userId);
}
return mcpManager;