diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b67178015..79da60894c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -236,6 +236,9 @@ importers: isbinaryfile: specifier: ^5.0.2 version: 5.0.4 + kontroll: + specifier: ^1.0.5 + version: 1.0.5 mammoth: specifier: ^1.8.0 version: 1.9.0 @@ -5881,6 +5884,10 @@ packages: kolorist@1.8.0: resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + kontroll@1.0.5: + resolution: {integrity: sha512-Fc9SZ3JGGkSrOo8rIGoZMjhfaaXY0DvJaewSdKve2KuT98icylO2J130Zsb/7Hzm9BnQ+88avT0ka51A4qBGuQ==} + engines: {node: '>=18.0.0'} + langium@3.3.1: resolution: {integrity: sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==} engines: {node: '>=16.0.0'} @@ -15354,6 +15361,8 @@ snapshots: kolorist@1.8.0: {} + kontroll@1.0.5: {} + langium@3.3.1: dependencies: chevrotain: 11.0.3 diff --git a/src/package.json b/src/package.json index 681039cb94..e90d2bf0c9 100644 --- a/src/package.json +++ b/src/package.json @@ -381,6 +381,7 @@ "i18next": "^24.2.2", "ignore": "^7.0.3", "isbinaryfile": "^5.0.2", + "kontroll": "^1.0.5", "mammoth": "^1.8.0", "monaco-vscode-textmate-theme-converter": "^0.1.7", "node-cache": "^5.1.2", diff --git a/src/services/mcp/McpHub.ts b/src/services/mcp/McpHub.ts index 64b2991dca..db650fab74 100644 --- a/src/services/mcp/McpHub.ts +++ b/src/services/mcp/McpHub.ts @@ -17,6 +17,7 @@ import * as path from "path" import * as vscode from "vscode" import { z } from "zod" import { t } from "../../i18n" +import { countdown } from "kontroll" import { ClineProvider } from "../../core/webview/ClineProvider" import { GlobalFileNames } from "../../shared/globalFileNames" @@ -354,6 +355,17 @@ export class McpHub { } public async reloadMcpServers() { + if (this.isConnecting) { + countdown( + 2000, + () => { + this.reloadMcpServers() + }, + { key: "reloadMcpServers" }, + ) + return + } + await this.initializeProjectMcpServers() await this.initializeGlobalMcpServers() }