fix(tauri): fix MCP server spawn on Windows and PATH on macOS
- Windows: npm installs .cmd wrappers, not direct executables. Spawn via 'cmd /c openpencil-mcp-http' on Windows to resolve .cmd files. - macOS/Linux: add fix-path-env-rs to inherit shell PATH in GUI apps. - Add 'cmd' to shell spawn capabilities for Windows. Fixes #226
This commit is contained in:
parent
1f073859c9
commit
fbf582a493
|
|
@ -32,7 +32,8 @@
|
|||
{ "name": "claude-agent-acp", "cmd": "claude-agent-acp", "args": true },
|
||||
{ "name": "codex-acp", "cmd": "codex-acp", "args": true },
|
||||
{ "name": "gemini", "cmd": "gemini", "args": true },
|
||||
{ "name": "openpencil-mcp-http", "cmd": "openpencil-mcp-http", "args": true }
|
||||
{ "name": "openpencil-mcp-http", "cmd": "openpencil-mcp-http", "args": true },
|
||||
{ "name": "cmd", "cmd": "cmd", "args": true }
|
||||
]
|
||||
},
|
||||
"shell:allow-stdin-write",
|
||||
|
|
|
|||
|
|
@ -66,12 +66,20 @@ export async function spawnMCPIfNeeded(): Promise<AutomationServerHandle | null>
|
|||
runtimeAutomationAuthToken = authToken
|
||||
|
||||
const { Command } = await import('@tauri-apps/plugin-shell')
|
||||
const command = Command.create('openpencil-mcp-http', [], {
|
||||
env: {
|
||||
OPENPENCIL_MCP_AUTH_TOKEN: authToken,
|
||||
OPENPENCIL_MCP_CORS_ORIGIN: window.location.origin
|
||||
}
|
||||
})
|
||||
const isWindows = navigator.userAgent.includes('Windows')
|
||||
const command = isWindows
|
||||
? Command.create('cmd', ['/c', 'openpencil-mcp-http'], {
|
||||
env: {
|
||||
OPENPENCIL_MCP_AUTH_TOKEN: authToken,
|
||||
OPENPENCIL_MCP_CORS_ORIGIN: window.location.origin
|
||||
}
|
||||
})
|
||||
: Command.create('openpencil-mcp-http', [], {
|
||||
env: {
|
||||
OPENPENCIL_MCP_AUTH_TOKEN: authToken,
|
||||
OPENPENCIL_MCP_CORS_ORIGIN: window.location.origin
|
||||
}
|
||||
})
|
||||
|
||||
command.stderr.on('data', (raw: Uint8Array | number[] | string) => {
|
||||
console.error('[MCP]', decodeTauriStderr(raw))
|
||||
|
|
|
|||
Loading…
Reference in a new issue