Skip to content

Commit 0449700

Browse files
authored
fix: clientSse example, update README.md (#27)
* fix: Correct clientSse.ts example * fix: Correct claude-desktop.png image
1 parent 2cd2e66 commit 0449700

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ To configure Claude Desktop to work with the MCP server, follow these steps. For
251251
- Look for the 🔌 icon to confirm that the Exa server is connected.
252252

253253
6. Open the Claude Desktop chat and ask "What Apify Actors I can use?"
254+
254255
![Claude-desktop-with-Actors-MCP-server](https://raw.githubusercontent.com/apify/actors-mcp-server/refs/heads/master/docs/claude-desktop.png)
255256

256257
7. Examples

docs/claude-desktop.png

-13.2 KB
Loading

src/examples/clientSse.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Connect to the MCP server using SSE transport and call a tool.
44
* The Actors MCP Server will load default Actors.
55
*
6-
* !!! NOT WORKING - This example needs to be fixed as it does not work !!!
76
*/
87

98
import path from 'path';
@@ -15,15 +14,17 @@ import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
1514
import dotenv from 'dotenv';
1615
import { EventSource } from 'eventsource';
1716

17+
const REQUEST_TIMEOUT = 120_000; // 2 minutes
1818
// Resolve dirname equivalent in ES module
1919
const filename = fileURLToPath(import.meta.url);
2020
const dirname = path.dirname(filename);
2121

2222
dotenv.config({ path: path.resolve(dirname, '../../.env') });
2323

24-
const SERVER_URL = 'https://actors-mcp-server/sse';
24+
const SERVER_URL = 'https://actors-mcp-server.apify.actor/sse';
2525
// We need to change forward slash / to underscore _ in the tool name as Anthropic does not allow forward slashes in the tool name
2626
const SELECTED_TOOL = 'apify_rag-web-browser';
27+
const QUERY = 'web browser for Anthropic';
2728

2829
if (!process.env.APIFY_TOKEN) {
2930
console.error('APIFY_TOKEN is required but not set in the environment variables.');
@@ -81,10 +82,11 @@ async function main(): Promise<void> {
8182
}
8283

8384
// Call a tool
84-
console.log('Calling actor ...');
85+
console.log(`Calling actor ... ${SELECTED_TOOL}`);
8586
const result = await client.callTool(
86-
{ name: SELECTED_TOOL, arguments: { query: 'web browser for Anthropic' } },
87+
{ name: SELECTED_TOOL, arguments: { query: QUERY } },
8788
CallToolResultSchema,
89+
{ timeout: REQUEST_TIMEOUT },
8890
);
8991
console.log('Tool result:', JSON.stringify(result, null, 2));
9092
} catch (error: unknown) {

0 commit comments

Comments
 (0)