Skip to content

Commit 8ad0741

Browse files
committed
fix: improve based on code review feedback
1 parent 22f4c9d commit 8ad0741

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

src/errors.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export class TimeoutError extends Error {
2+
override readonly name = 'TimeoutError';
3+
}

src/mcp/client.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/
44

55
import log from '@apify/log';
66

7+
import { TimeoutError } from '../errors.js';
78
import { ACTORIZED_MCP_CONNECTION_TIMEOUT_MSEC } from './const.js';
89
import { getMCPServerID } from './utils.js';
910

10-
class TimeoutError extends Error {
11-
override readonly name = 'TimeoutError';
12-
}
13-
1411
/**
1512
* Creates and connects a ModelContextProtocol client.
1613
* First tries streamable HTTP transport, then falls back to SSE transport.
@@ -91,7 +88,7 @@ async function createMCPSSEClient(
9188
headers.set('authorization', `Bearer ${token}`);
9289
return fetch(input, { ...init, headers });
9390
},
94-
// We have to cast to "any" to use it, since it's non-standard
91+
// We have to cast to "any" to use it, since it's non-standard
9592
} as any, // eslint-disable-line @typescript-eslint/no-explicit-any
9693
});
9794

tests/integration/suite.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export function createIntegrationTestsSuite(
398398
limit: 5,
399399
},
400400
});
401-
const content = result.content as {text: string}[];
401+
const content = result.content as { text: string }[];
402402
expect(content.some((item) => item.text.includes(ACTOR_PYTHON_EXAMPLE))).toBe(true);
403403
});
404404

@@ -415,7 +415,7 @@ export function createIntegrationTestsSuite(
415415
limit: 100,
416416
},
417417
});
418-
const content = result.content as {text: string}[];
418+
const content = result.content as { text: string }[];
419419
expect(content.length).toBe(1);
420420
const outputText = content[0].text;
421421

@@ -941,18 +941,8 @@ export function createIntegrationTestsSuite(
941941
await client.close();
942942
});
943943

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] });
944+
it('should connect to MCP server and at least one tool is available', async () => {
945+
client = await createClientFn({ tools: [ACTOR_MCP_SERVER_ACTOR_NAME] });
956946
const tools = await client.listTools();
957947
expect(tools.tools.length).toBeGreaterThan(0);
958948
});

0 commit comments

Comments
 (0)