Skip to content

Commit 9e09811

Browse files
authored
⌛ feat: initTimeout for Slow Starting MCP Servers (danny-avila#6383)
* feat: make mcp server connect timeout configurable with initTimeout * style: add missing semicolon to connection.ts
1 parent 2f1313f commit 9e09811

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/data-provider/src/mcp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { extractEnvVariable } from './utils';
44
const BaseOptionsSchema = z.object({
55
iconPath: z.string().optional(),
66
timeout: z.number().optional(),
7+
initTimeout: z.number().optional(),
78
});
89

910
export const StdioOptionsSchema = BaseOptionsSchema.extend({

packages/mcp/src/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export class MCPConnection extends EventEmitter {
269269
this.transport = this.constructTransport(this.options);
270270
this.setupTransportDebugHandlers();
271271

272-
const connectTimeout = 10000;
272+
const connectTimeout = this.options.initTimeout ?? 10000;
273273
await Promise.race([
274274
this.client.connect(this.transport),
275275
new Promise((_resolve, reject) =>

0 commit comments

Comments
 (0)