From 1332f52839dcb40f5c8acf875ca14760612ca311 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 26 Sep 2025 10:42:46 -0700 Subject: [PATCH] fix: negated condition --- core/context/mcp/MCPConnection.ts | 10 +++++----- extensions/cli/src/services/MCPService.ts | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 88df530cd..b79647c57 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -221,7 +221,11 @@ class MCPConnection { ); await this.client.connect(transport, {}); this.transport = transport; - } else if (!this.options.type) { + } else if (this.options.type) { + throw new Error( + `Unsupported transport type: ${this.options.type}`, + ); + } else { try { const transport = this.constructHttpTransport({ ...this.options, @@ -243,10 +247,6 @@ class MCPConnection { ); } } - } else { - throw new Error( - `Unsupported transport type: ${this.options.type}`, - ); } } diff --git a/extensions/cli/src/services/MCPService.ts b/extensions/cli/src/services/MCPService.ts index 89b5b44fb..069171fef 100644 --- a/extensions/cli/src/services/MCPService.ts +++ b/extensions/cli/src/services/MCPService.ts @@ -372,7 +372,9 @@ export class MCPService } else if (serverConfig.type === "streamable-http") { const transport = this.constructHttpTransport(serverConfig); await client.connect(transport, {}); - } else if (!serverConfig.type) { + } else if (serverConfig.type) { + throw new Error(`Unsupported transport type: ${serverConfig.type}`); + } else { try { const transport = this.constructHttpTransport(serverConfig); await client.connect(transport, {}); @@ -392,8 +394,6 @@ export class MCPService ); } } - } else { - throw new Error(`Unsupported transport type: ${serverConfig.type}`); } }