feat: implement keep-alive functionality for SSE connections (#166)

Co-authored-by: samanhappy@qq.com <my6051199>
This commit is contained in:
samanhappy
2025-06-07 20:41:51 +08:00
committed by GitHub
parent 56c6447469
commit d9cbc5381a
4 changed files with 55 additions and 1 deletions

View File

@@ -107,6 +107,11 @@ export const createServer = async (req: Request, res: Response): Promise<void> =
return;
}
// Set default keep-alive interval for SSE servers if not specified
if ((config.type === 'sse' || (!config.type && config.url)) && !config.keepAliveInterval) {
config.keepAliveInterval = 60000; // Default 60 seconds for SSE servers
}
const result = await addServer(name, config);
if (result.success) {
notifyToolChanged();
@@ -224,6 +229,11 @@ export const updateServer = async (req: Request, res: Response): Promise<void> =
return;
}
// Set default keep-alive interval for SSE servers if not specified
if ((config.type === 'sse' || (!config.type && config.url)) && !config.keepAliveInterval) {
config.keepAliveInterval = 60000; // Default 60 seconds for SSE servers
}
const result = await updateMcpServer(name, config);
if (result.success) {
notifyToolChanged();