Don't run MCP servers for remote projects (#39243)

Closes #39213

Release Notes:

- Fixed a bug where we tried to run MCP servers in the remote project's
working directory on the local machine
This commit is contained in:
Conrad Irwin
2025-09-30 21:34:42 +00:00
committed by GitHub
parent 94a4c0c352
commit 83e5a3033e
+16 -15
View File
@@ -472,22 +472,23 @@ impl ContextServerStore {
configuration: Arc<ContextServerConfiguration>,
cx: &mut Context<Self>,
) -> Arc<ContextServer> {
let root_path = self
.project
.read_with(cx, |project, cx| project.active_project_directory(cx))
.ok()
.flatten()
.or_else(|| {
self.worktree_store.read_with(cx, |store, cx| {
store.visible_worktrees(cx).fold(None, |acc, item| {
if acc.is_none() {
item.read(cx).root_dir()
} else {
acc
let project = self.project.upgrade();
let mut root_path = None;
if let Some(project) = project {
let project = project.read(cx);
if project.is_local() {
if let Some(path) = project.active_project_directory(cx) {
root_path = Some(path);
} else {
for worktree in self.worktree_store.read(cx).visible_worktrees(cx) {
if let Some(path) = worktree.read(cx).root_dir() {
root_path = Some(path);
break;
}
})
})
});
}
}
}
};
if let Some(factory) = self.context_server_factory.as_ref() {
factory(id, configuration)