diff options
| author | Yoichiro Tanaka <[email protected]> | 2025-08-21 16:05:45 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-21 07:05:45 +0000 |
| commit | 63f9e86bc3b7c7007be1a73f0cadb59d8bbd1fdc (patch) | |
| tree | 31ae7bbc418a85af0e3a9e939960b7941f39ea49 /packages/core/src/tools/mcp-client.test.ts | |
| parent | a64394a4fa16b4920754a85f5f134dbab3a7990f (diff) | |
feat(mcp-client): Handle 401 error for httpUrl (#6640)
Diffstat (limited to 'packages/core/src/tools/mcp-client.test.ts')
| -rw-r--r-- | packages/core/src/tools/mcp-client.test.ts | 31 |
1 files changed, 31 insertions, 0 deletions
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); + }); + }); }); |
