feat: lazy load mcp server

This commit is contained in:
dswbx
2025-09-23 13:46:39 +02:00
parent 54eee8cd34
commit 49aee37199
13 changed files with 56 additions and 32 deletions

View File

@@ -302,13 +302,13 @@ export class App<
}
getMcpClient() {
if (!this.mcp) {
const config = this.modules.get("server").config.mcp;
if (!config.enabled) {
throw new Error("MCP is not enabled");
}
const mcpPath = this.modules.get("server").config.mcp.path;
return new McpClient({
url: "http://localhost" + mcpPath,
url: "http://localhost" + config.path,
fetch: this.server.request,
});
}