The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(mcp): a Finder-started Mac LU finds uvx and npx for every MCP server
purplee0f42292ffdc
diff --git a/src-tauri/src/commands/mobile_guard.rs b/src-tauri/src/commands/mobile_guard.rsindex f84ffdb3..054826e5 100644--- a/src-tauri/src/commands/mobile_guard.rs+++ b/src-tauri/src/commands/mobile_guard.rs@@ -49,6 +49,7 @@ pub const BLOCKED: &[&str] = &["trash_model_file","comfy_torch_plan","plugin_rea_status",+ "mcp_child_path","plugin_rea_fetch","plugin_rea_guard","storage_status",diff --git a/src-tauri/src/commands/plugin_rea.rs b/src-tauri/src/commands/plugin_rea.rsindex 074df77f..c4520a99 100644--- a/src-tauri/src/commands/plugin_rea.rs+++ b/src-tauri/src/commands/plugin_rea.rs@@ -81,6 +81,14 @@ fn child_path() -> Option<String> {}}+/// The PATH every external MCP server starts with (api/mcp/external-client,+/// `spawnEnv`): the login shell's on a Mac, where a Finder start has only+/// launchd's and an installed uvx or npx is not found; None elsewhere.+#[tauri::command]+pub async fn mcp_child_path() -> Result<Option<String>, String> {+ tokio::task::spawn_blocking(child_path).await.map_err(|e| e.to_string())+}+/// The file name of Node on this platform.const NODE_EXE: &str = if cfg!(windows) { "node.exe" } else { "node" };diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 0153e0ee..67a8125b 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -786,6 +786,7 @@ pub fn run() {// Shell// REA as an agent plugin: the pinned package and what its start needs.commands::plugin_rea::plugin_rea_status,+ commands::plugin_rea::mcp_child_path,commands::plugin_rea::plugin_rea_fetch,commands::plugin_rea::plugin_rea_guard,commands::shell::shell_execute,diff --git a/src/api/backend.ts b/src/api/backend.tsindex f3a32d8a..90ca542a 100644--- a/src/api/backend.ts+++ b/src/api/backend.ts@@ -609,6 +609,7 @@ export async function backendCall<T = unknown>(// REA, the reverse engineering plugin of the agents: the pinned package// is fetched and checked by the Rust process only (commands/plugin_rea.rs).plugin_rea_status: { path: "/local-api/plugin-rea-status" },+ mcp_child_path: { path: "/local-api/mcp-child-path" },plugin_rea_fetch: { path: "/local-api/plugin-rea-fetch", method: "POST" },plugin_rea_guard: { path: "/local-api/plugin-rea-guard", method: "POST" },// Astra computer use: mouse, keyboard and screen belong to the Rustdiff --git a/src/api/mcp/__tests__/ein-finder-start-findet-uvx.test.ts b/src/api/mcp/__tests__/ein-finder-start-findet-uvx.test.tsnew file mode 100644index 00000000..0dd8f91b--- /dev/null+++ b/src/api/mcp/__tests__/ein-finder-start-findet-uvx.test.ts@@ -0,0 +1,58 @@+/**+ * Ein Mac-LU aus dem Finder hat den launchd-PATH, und ein installiertes uvx in+ * ~/.local/bin wurde nicht gefunden: im gebauten Testbau am 28.10.2026 kam+ * "`uvx` was not found", obwohl uv dort lag. REA bekam den PATH der+ * Login-Shell schon, jeder andere Server nicht. Jetzt startet jeder Server mit+ * dem PATH, den `mcp_child_path` liefert, ausser der Nutzer hat selbst einen+ * eingetragen.+ *+ * Run: npx vitest run src/api/mcp/__tests__/ein-finder-start-findet-uvx.test.ts+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'++const LOGIN_PATH = '/Users/x/.local/bin:/opt/homebrew/bin:/usr/bin:/bin'+const gestartet: { name: string; env?: Record<string, string> }[] = []+let antwort: string | null = LOGIN_PATH++vi.mock('../../in-tauri', () => ({ isTauri: () => true }))+vi.mock('@tauri-apps/api/core', () => ({+ invoke: async (cmd: string) => {+ if (cmd === 'mcp_child_path') return antwort+ throw new Error(`unexpected ${cmd}`)+ },+}))+vi.mock('@tauri-apps/plugin-shell', () => ({+ Command: {+ create: (name: string, _args: string[], opts: { env?: Record<string, string> }) => {+ gestartet.push({ name, env: opts.env })+ const leer = { on: () => {} }+ return { stdout: leer, stderr: leer, on: () => {}, spawn: async () => { throw 'program not found' } }+ },+ },+}))++import { MCPExternalClient, spawnEnv } from '../external-client'++beforeEach(() => { gestartet.length = 0; antwort = LOGIN_PATH; vi.stubGlobal('navigator', { platform: 'MacIntel' }) })++describe('ein MCP-Server startet mit dem PATH der Login-Shell', () => {+ it('der Start bekommt ihn', async () => {+ const k = new MCPExternalClient({ id: 't', name: 'time', command: 'uvx', args: ['mcp-server-time==2026.8.18'], enabled: true })+ await k.connect().catch(() => {})+ expect(gestartet).toHaveLength(1)+ expect(gestartet[0].env?.PATH).toBe(LOGIN_PATH)+ })++ it('andere Variablen des Eintrags bleiben', async () => {+ expect(await spawnEnv({ TZ: 'Asia/Tokyo' })).toEqual({ TZ: 'Asia/Tokyo', PATH: LOGIN_PATH })+ })++ it('ein selbst eingetragener PATH bleibt seiner', async () => {+ expect(await spawnEnv({ Path: 'C:\\mine' })).toEqual({ Path: 'C:\\mine' })+ })++ it('wo Rust keinen liefert (Windows, Linux), bleibt die Umgebung der App', async () => {+ antwort = null+ expect(await spawnEnv(undefined)).toBeUndefined()+ })+})diff --git a/src/api/mcp/external-client.ts b/src/api/mcp/external-client.tsindex 1ecdc04b..aa9eb44b 100644--- a/src/api/mcp/external-client.ts+++ b/src/api/mcp/external-client.ts@@ -230,6 +230,7 @@ export class MCPExternalClient {if (!isStartableMcpCommand(this.config.command)) {throw new Error(notStartableMessage(this.config.name, this.config.command))}+ const env = await spawnEnv(this.config.env)const candidates = commandCandidatesForPlatform(this.config.command)// Every failed attempt is kept, not just the last one. The last one used// to be the only one thrown, and on Windows that was the `.cmd`@@ -239,7 +240,7 @@ export class MCPExternalClient {const spawnErrors: unknown[] = []for (const program of candidates) {const command = Command.create(program, this.config.args, {- env: this.config.env,+ env,...(this.config.cwd ? { cwd: this.config.cwd } : {}),})@@ -592,6 +593,32 @@ export function notStartableMessage(name: string, command: string): string {)}+/**+ * Die Umgebung, mit der ein Server startet.+ *+ * Ein Mac-LU aus dem Finder hat den launchd-PATH `/usr/bin:/bin:/usr/sbin:/sbin`.+ * uvx liegt nach Astrals Installer in `~/.local/bin`, nach Homebrew in+ * `/opt/homebrew/bin`, npx bei nvm in dessen Ordner: alles unsichtbar. Am+ * 28.10.2026 im gebauten Testbau nachgestellt: ein installiertes uvx brachte+ * "`uvx` was not found", und "LU neu oeffnen" aenderte daran nichts. REA bekam+ * den PATH der Login-Shell schon (commands/plugin_rea.rs); jetzt jeder Server.+ * Rust sucht das Programm unter Unix in genau diesem PATH. Ein PATH, den der+ * Nutzer selbst eingetragen hat, bleibt seiner. Windows und Linux antworten+ * mit null und behalten die Umgebung der App.+ */+export async function spawnEnv(configured?: Record<string, string>): Promise<Record<string, string> | undefined> {+ if (configured && Object.keys(configured).some((k) => k.toUpperCase() === 'PATH')) return configured+ if (!isTauri()) return configured+ try {+ const { invoke } = await import('@tauri-apps/api/core')+ const path = await invoke<string | null>('mcp_child_path')+ if (!path) return configured+ return { ...(configured ?? {}), PATH: path }+ } catch {+ return configured+ }+}+/*** Scope-Name des Eintrags, der uvx an seinem offiziellen Windows-Ort startet.*