@@ -76,7 +76,8 @@ const mcpClient = new MastraMCPClient({
7676 return fetch (input , { ... init , headers });
7777 }
7878 }
79- }
79+ },
80+ timeout: 300_000 , // 5 minutes tool call timeout
8081});
8182```
8283
@@ -169,21 +170,22 @@ process.env.OPENAI_API_KEY = "your-openai-api-key";
169170const mcpClient = new MastraMCPClient ({
170171 name: ' apify-client' ,
171172 server: {
172- url: new URL (' https://actors-mcp-server.apify.actor/sse' ),
173- requestInit: {
174- headers: { Authorization: ` Bearer ${process .env .APIFY_TOKEN } ` }
175- },
176- // The EventSource package augments EventSourceInit with a "fetch" parameter.
177- // You can use this to set additional headers on the outgoing request.
178- // Based on this example: https://github.com/modelcontextprotocol/typescript-sdk/issues/118
179- eventSourceInit: {
180- async fetch(input : Request | URL | string , init ? : RequestInit ) {
181- const headers = new Headers (init ?.headers || {});
182- headers .set (' authorization' , ` Bearer ${process .env .APIFY_TOKEN } ` );
183- return fetch (input , { ... init , headers });
173+ url: new URL (' https://actors-mcp-server.apify.actor/sse' ),
174+ requestInit: {
175+ headers: { Authorization: ` Bearer ${process .env .APIFY_TOKEN } ` }
176+ },
177+ // The EventSource package augments EventSourceInit with a "fetch" parameter.
178+ // You can use this to set additional headers on the outgoing request.
179+ // Based on this example: https://github.com/modelcontextprotocol/typescript-sdk/issues/118
180+ eventSourceInit: {
181+ async fetch(input : Request | URL | string , init ? : RequestInit ) {
182+ const headers = new Headers (init ?.headers || {});
183+ headers .set (' authorization' , ` Bearer ${process .env .APIFY_TOKEN } ` );
184+ return fetch (input , { ... init , headers });
185+ }
184186 }
185- }
186- }
187+ },
188+ timeout: 300_000 , // 5 minutes tool call timeout
187189});
188190
189191console .log (' Connecting to Mastra MCP server...' );
0 commit comments