diff --git a/mcp/packages/plugin/src/main.ts b/mcp/packages/plugin/src/main.ts index 4cd19e1947..4b57738974 100644 --- a/mcp/packages/plugin/src/main.ts +++ b/mcp/packages/plugin/src/main.ts @@ -255,6 +255,15 @@ function connectToMcpServer(baseUrl?: string, token?: string): void { updateCurrentTask(null); } ws = null; + if (event.code === 1008) { + // Policy violation (e.g. duplicate connection for the same user + // token - another tab already holds the connection). Retrying + // would be refused again immediately, so stay disconnected + // until the user explicitly reconnects. + shouldReconnect = false; + cancelReconnect(); + return; + } scheduleReconnect(); };