Description
Whenever an MCP server disconnects (due to a restart, shutdown, or crash), tool-manager.ts handles the cleanup by completely resetting the tool registry back to static defaults. It calls this.customTools.clear(), completely wiping out all user-defined custom tools. The only way to recover them is to restart Nanocoder.
Environment
- OS: Any
- Node version: Node 18+
- Nanocoder version: 1.30.0
- Provider: N/A
- Model: N/A
Steps to Reproduce
- Start Nanocoder and ensure you have custom tools loaded in your workspace.
- Connect to an MCP server.
- Have the MCP server disconnect or explicitly disconnect it.
- Try to use your custom tools—they are gone.
Expected Behavior
Disconnecting from an MCP server should only unregister the MCP-provided tools, leaving workspace custom tools intact.
Actual Behavior
disconnectMCP() resets the entire registry to allToolExports (built-ins only) and clears this.customTools.
Additional Context
Implementation Notes
Fix in source/tools/tool-manager.ts lines 370-385. Remove this.registry = ToolRegistry.fromToolExports(...) and this.customTools.clear(). Only call this.registry.unregisterMany(mcpToolNames).
Description
Whenever an MCP server disconnects (due to a restart, shutdown, or crash),
tool-manager.tshandles the cleanup by completely resetting the tool registry back to static defaults. It callsthis.customTools.clear(), completely wiping out all user-defined custom tools. The only way to recover them is to restart Nanocoder.Environment
Steps to Reproduce
Expected Behavior
Disconnecting from an MCP server should only unregister the MCP-provided tools, leaving workspace custom tools intact.
Actual Behavior
disconnectMCP()resets the entire registry toallToolExports(built-ins only) and clearsthis.customTools.Additional Context
Implementation Notes
Fix in
source/tools/tool-manager.tslines 370-385. Removethis.registry = ToolRegistry.fromToolExports(...)andthis.customTools.clear(). Only callthis.registry.unregisterMany(mcpToolNames).