From 63f9e86bc3b7c7007be1a73f0cadb59d8bbd1fdc Mon Sep 17 00:00:00 2001 From: Yoichiro Tanaka Date: Thu, 21 Aug 2025 16:05:45 +0900 Subject: feat(mcp-client): Handle 401 error for httpUrl (#6640) --- packages/core/src/tools/mcp-client.test.ts | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'packages/core/src/tools/mcp-client.test.ts') diff --git a/packages/core/src/tools/mcp-client.test.ts b/packages/core/src/tools/mcp-client.test.ts index b8f61856..32cffae1 100644 --- a/packages/core/src/tools/mcp-client.test.ts +++ b/packages/core/src/tools/mcp-client.test.ts @@ -12,6 +12,7 @@ import { isEnabled, hasValidTypes, McpClient, + hasNetworkTransport, } from './mcp-client.js'; import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; import * as SdkClientStdioLib from '@modelcontextprotocol/sdk/client/stdio.js'; @@ -566,4 +567,34 @@ describe('mcp-client', () => { expect(hasValidTypes(schema)).toBe(true); }); }); + + describe('hasNetworkTransport', () => { + it('should return true if only url is provided', () => { + const config = { url: 'http://example.com' }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return true if only httpUrl is provided', () => { + const config = { httpUrl: 'http://example.com' }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return true if both url and httpUrl are provided', () => { + const config = { + url: 'http://example.com/sse', + httpUrl: 'http://example.com/http', + }; + expect(hasNetworkTransport(config)).toBe(true); + }); + + it('should return false if neither url nor httpUrl is provided', () => { + const config = { command: 'do-something' }; + expect(hasNetworkTransport(config)).toBe(false); + }); + + it('should return false for an empty config object', () => { + const config = {}; + expect(hasNetworkTransport(config)).toBe(false); + }); + }); }); -- cgit v1.2.3