File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ export async function connectMCPClient(
2121 let client : Client ;
2222 try {
2323 client = await createMCPStreamableClient ( url , token ) ;
24+ return client ;
2425 } catch ( error ) {
26+ // If streamable HTTP transport fails on not timeout error, continue with SSE transport
2527 if ( error instanceof TimeoutError ) {
2628 log . warning ( 'Connection to MCP server using streamable HTTP transport timed out' , { url } ) ;
2729 return null ;
@@ -35,6 +37,7 @@ export async function connectMCPClient(
3537
3638 try {
3739 client = await createMCPSSEClient ( url , token ) ;
40+ return client ;
3841 } catch ( error ) {
3942 if ( error instanceof TimeoutError ) {
4043 log . warning ( 'Connection to MCP server using SSE transport timed out' , { url } ) ;
@@ -44,8 +47,6 @@ export async function connectMCPClient(
4447 log . error ( 'Failed to connect to MCP server using SSE transport' , { cause : error } ) ;
4548 throw error ;
4649 }
47-
48- return client ;
4950}
5051
5152async function withTimeout < T > ( millis : number , promise : Promise < T > ) : Promise < T > {
Original file line number Diff line number Diff line change @@ -940,5 +940,21 @@ export function createIntegrationTestsSuite(
940940
941941 await client . close ( ) ;
942942 } ) ;
943+
944+ // Skipping tests, MCP actors are not available in staging environment
945+ // TODO: run this tests only for local environment
946+ it . skip . for ( [
947+ 'mcp-servers/slidespeak-mcp-server' ,
948+ 'mcp-servers/brave-search-mcp-server' ,
949+ 'jiri.spilka/weather-mcp-server' ,
950+ 'apify/actors-mcp-server' ,
951+ 'jakub.kopecky/browserbase-mcp-server' ,
952+ 'jakub.kopecky/arxiv-mcp-server' ,
953+ 'jiri.spilka/playwright-mcp-server' ,
954+ ] ) ( 'should connect to "%s" MCP server and at least one tool is available' , async ( mcpServer ) => {
955+ client = await createClientFn ( { tools : [ mcpServer ] } ) ;
956+ const tools = await client . listTools ( ) ;
957+ expect ( tools . tools . length ) . toBeGreaterThan ( 0 ) ;
958+ } ) ;
943959 } ) ;
944960}
You can’t perform that action at this time.
0 commit comments