You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] disconnectMCP() permanently wipes all custom tools from the registry #1034
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
I have searched existing issues to ensure this is not a duplicate
I can reproduce this issue consistently
This issue occurs with the latest version of nanocoder
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).
Activity
DeepamJha commentedon Aug 30, 2026
Hey @akramcodez, happy to help with this one if it's still available. Could you assign it to me?
fix(tools): keep custom tools registered when MCP disconnects