diff --git a/src/agents/pi-bundle-lsp-runtime.ts b/src/agents/pi-bundle-lsp-runtime.ts index c971da811d6..cecc95bb475 100644 --- a/src/agents/pi-bundle-lsp-runtime.ts +++ b/src/agents/pi-bundle-lsp-runtime.ts @@ -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), diff --git a/src/agents/pi-bundle-mcp-tools.ts b/src/agents/pi-bundle-mcp-tools.ts index 159cd8bfe12..bbe3aa200ae 100644 --- a/src/agents/pi-bundle-mcp-tools.ts +++ b/src/agents/pi-bundle-mcp-tools.ts @@ -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),