fix(mcp): configure mcp_client allowlist on project switch

Previously mcp_client.configure() was only called during ai_client.send()
which meant GUI buttons (Slices/Inspect) couldn't access files when
project was switched to an external project like gencpp. Now _switch_project
reconfigures mcp_client with the new project's root and file_items.
This commit is contained in:
2026-05-10 20:57:11 -04:00
parent c8d2dda763
commit 6861ce0dca
4 changed files with 29 additions and 23 deletions
+3
View File
@@ -2347,6 +2347,9 @@ class AppController:
self.ai_status = f"failed to load project: {e}"
return
self._refresh_from_project()
import mcp_client
file_items_as_dicts = [{"path": f.path if hasattr(f, "path") else str(f)} for f in self.files]
mcp_client.configure(file_items_as_dicts, [str(new_root)])
self.ai_status = f"switched to: {Path(path).stem}"
def _refresh_from_project(self) -> None: