Perf: skip MCP/LSP runtime spawning when no servers are configured

This commit is contained in:
Vincent Koc 2026-03-18 00:25:53 -07:00
parent 80e681a60c
commit e6c6aaa11b
2 changed files with 8 additions and 0 deletions

View File

@ -288,6 +288,10 @@ export async function createBundleLspToolRuntime(params: {
for (const diagnostic of loaded.diagnostics) {
logWarn(`bundle-lsp: ${diagnostic.pluginId}: ${diagnostic.message}`);
}
// Skip spawning when no LSP servers are configured.
if (Object.keys(loaded.lspServers).length === 0) {
return { tools: [], sessions: [], dispose: async () => {} };
}
const reservedNames = new Set(
Array.from(params.reservedToolNames ?? [], (name) => name.trim().toLowerCase()).filter(Boolean),

View File

@ -131,6 +131,10 @@ export async function createBundleMcpToolRuntime(params: {
for (const diagnostic of loaded.diagnostics) {
logWarn(`bundle-mcp: ${diagnostic.pluginId}: ${diagnostic.message}`);
}
// Skip spawning when no MCP servers are configured.
if (Object.keys(loaded.mcpServers).length === 0) {
return { tools: [], dispose: async () => {} };
}
const reservedNames = new Set(
Array.from(params.reservedToolNames ?? [], (name) => name.trim().toLowerCase()).filter(Boolean),