mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-24 02:39:19 -05:00
Compare commits
4 Commits
v0.11.6
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20a1d54f8a | ||
|
|
1c42b6802b | ||
|
|
f9a12b8ed1 | ||
|
|
d5cb4c7cc2 |
@@ -156,11 +156,6 @@ export const createServer = async (req: Request, res: Response): Promise<void> =
|
|||||||
return;
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set owner property - use current user's username, default to 'admin'
|
// Set owner property - use current user's username, default to 'admin'
|
||||||
if (!config.owner) {
|
if (!config.owner) {
|
||||||
const currentUser = (req as any).user;
|
const currentUser = (req as any).user;
|
||||||
@@ -299,11 +294,6 @@ export const updateServer = async (req: Request, res: Response): Promise<void> =
|
|||||||
return;
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set owner property if not provided - use current user's username, default to 'admin'
|
// Set owner property if not provided - use current user's username, default to 'admin'
|
||||||
if (!config.owner) {
|
if (!config.owner) {
|
||||||
const currentUser = (req as any).user;
|
const currentUser = (req as any).user;
|
||||||
|
|||||||
@@ -31,11 +31,16 @@ const servers: { [sessionId: string]: Server } = {};
|
|||||||
|
|
||||||
// Helper function to set up keep-alive ping for SSE connections
|
// Helper function to set up keep-alive ping for SSE connections
|
||||||
const setupKeepAlive = (serverInfo: ServerInfo, serverConfig: ServerConfig): void => {
|
const setupKeepAlive = (serverInfo: ServerInfo, serverConfig: ServerConfig): void => {
|
||||||
// Only set up keep-alive for SSE connections
|
// Only applicable to SSE connections
|
||||||
if (!(serverInfo.transport instanceof SSEClientTransport)) {
|
if (!(serverInfo.transport instanceof SSEClientTransport)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep-alive is disabled by default to avoid excessive API calls to external MCP servers
|
||||||
|
if (serverConfig.keepAlive !== true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear any existing interval first
|
// Clear any existing interval first
|
||||||
if (serverInfo.keepAliveIntervalId) {
|
if (serverInfo.keepAliveIntervalId) {
|
||||||
clearInterval(serverInfo.keepAliveIntervalId);
|
clearInterval(serverInfo.keepAliveIntervalId);
|
||||||
|
|||||||
@@ -266,7 +266,8 @@ export interface ServerConfig {
|
|||||||
headers?: Record<string, string>; // HTTP headers for SSE/streamable-http/openapi servers
|
headers?: Record<string, string>; // HTTP headers for SSE/streamable-http/openapi servers
|
||||||
enabled?: boolean; // Flag to enable/disable the server
|
enabled?: boolean; // Flag to enable/disable the server
|
||||||
owner?: string; // Owner of the server, defaults to 'admin' user
|
owner?: string; // Owner of the server, defaults to 'admin' user
|
||||||
keepAliveInterval?: number; // Keep-alive ping interval in milliseconds (default: 60000ms for SSE servers)
|
keepAlive?: boolean; // Enable keep-alive ping for SSE servers (default: false - disabled to avoid excessive API calls)
|
||||||
|
keepAliveInterval?: number; // Keep-alive ping interval in milliseconds (default: 60000ms when keepAlive is enabled)
|
||||||
tools?: Record<string, { enabled: boolean; description?: string }>; // Tool-specific configurations with enable/disable state and custom descriptions
|
tools?: Record<string, { enabled: boolean; description?: string }>; // Tool-specific configurations with enable/disable state and custom descriptions
|
||||||
prompts?: Record<string, { enabled: boolean; description?: string }>; // Prompt-specific configurations with enable/disable state and custom descriptions
|
prompts?: Record<string, { enabled: boolean; description?: string }>; // Prompt-specific configurations with enable/disable state and custom descriptions
|
||||||
options?: Partial<Pick<RequestOptions, 'timeout' | 'resetTimeoutOnProgress' | 'maxTotalTimeout'>>; // MCP request options configuration
|
options?: Partial<Pick<RequestOptions, 'timeout' | 'resetTimeoutOnProgress' | 'maxTotalTimeout'>>; // MCP request options configuration
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const createMockSettings = (overrides: Partial<McpSettings> = {}): McpSet
|
|||||||
args: ['-y', 'time-mcp'],
|
args: ['-y', 'time-mcp'],
|
||||||
env: {},
|
env: {},
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
keepAlive: false,
|
||||||
keepAliveInterval: 30000,
|
keepAliveInterval: 30000,
|
||||||
type: 'stdio',
|
type: 'stdio',
|
||||||
} as ServerConfig,
|
} as ServerConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user