mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
⌛ feat: initTimeout for Slow Starting MCP Servers (#6383)
* feat: make mcp server connect timeout configurable with initTimeout * style: add missing semicolon to connection.ts
This commit is contained in:
parent
efb616d600
commit
19446cb864
2 changed files with 2 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import { extractEnvVariable } from './utils';
|
||||||
const BaseOptionsSchema = z.object({
|
const BaseOptionsSchema = z.object({
|
||||||
iconPath: z.string().optional(),
|
iconPath: z.string().optional(),
|
||||||
timeout: z.number().optional(),
|
timeout: z.number().optional(),
|
||||||
|
initTimeout: z.number().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const StdioOptionsSchema = BaseOptionsSchema.extend({
|
export const StdioOptionsSchema = BaseOptionsSchema.extend({
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ export class MCPConnection extends EventEmitter {
|
||||||
this.transport = this.constructTransport(this.options);
|
this.transport = this.constructTransport(this.options);
|
||||||
this.setupTransportDebugHandlers();
|
this.setupTransportDebugHandlers();
|
||||||
|
|
||||||
const connectTimeout = 10000;
|
const connectTimeout = this.options.initTimeout ?? 10000;
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
this.client.connect(this.transport),
|
this.client.connect(this.transport),
|
||||||
new Promise((_resolve, reject) =>
|
new Promise((_resolve, reject) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue