mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-31 20:00:00 -05:00
feat: enhance MCP server retrieval and logging for transport closure (#101)
This commit is contained in:
@@ -16,10 +16,16 @@ export const initMcpServer = async (name: string, version: string): Promise<void
|
||||
await registerAllTools(true);
|
||||
};
|
||||
|
||||
export const getMcpServer = (sessionId: string): Server => {
|
||||
export const getMcpServer = (sessionId?: string): Server => {
|
||||
if (!sessionId) {
|
||||
return createMcpServer(config.mcpHubName, config.mcpHubVersion);
|
||||
}
|
||||
|
||||
if (!servers[sessionId]) {
|
||||
const server = createMcpServer(config.mcpHubName, config.mcpHubVersion);
|
||||
servers[sessionId] = server;
|
||||
} else {
|
||||
console.log(`MCP server already exists for sessionId: ${sessionId}`);
|
||||
}
|
||||
return servers[sessionId];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user