Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions librechat.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ mcpServers:
everything:
# type: sse # type can optionally be omitted
url: http://localhost:3001/sse
timeout: 60000 # 1 minute timeout for this server, this is the default timeout for MCP servers.
puppeteer:
type: stdio
command: npx
args:
- -y
- "@modelcontextprotocol/server-puppeteer"
timeout: 300000 # 5 minutes timeout for this server
filesystem:
# type: stdio
command: npx
Expand Down
1 change: 1 addition & 0 deletions packages/data-provider/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { extractEnvVariable } from './utils';

const BaseOptionsSchema = z.object({
iconPath: z.string().optional(),
timeout: z.number().optional(),
});

export const StdioOptionsSchema = BaseOptionsSchema.extend({
Expand Down
2 changes: 2 additions & 0 deletions packages/mcp/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ export class MCPConnection extends EventEmitter {
private isInitializing = false;
private reconnectAttempts = 0;
iconPath?: string;
timeout?: number;

constructor(serverName: string, private readonly options: t.MCPOptions, private logger?: Logger) {
super();
this.serverName = serverName;
this.logger = logger;
this.iconPath = options.iconPath;
this.timeout = options.timeout;
this.client = new Client(
{
name: 'librechat-mcp-client',
Expand Down
5 changes: 3 additions & 2 deletions packages/mcp/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class MCPManager {
};
}
} catch (error) {
this.logger.warn(`[MCP][${serverName}] Not connected, skipping tool fetch`);
this.logger.warn(`[MCP][${serverName}] Error fetching tools:`, error);
}
}
}
Expand All @@ -183,7 +183,7 @@ export class MCPManager {
});
}
} catch (error) {
this.logger.error(`[MCP][${serverName}] Error fetching tools`, error);
this.logger.error(`[MCP][${serverName}] Error fetching tools:`, error);
}
}
}
Expand All @@ -209,6 +209,7 @@ export class MCPManager {
},
},
CallToolResultSchema,
{ timeout: connection.timeout },
);
return formatToolContent(result, provider);
}
Expand Down
Loading