debug: add MCP spawn logging, revert cmd approach
This commit is contained in:
parent
5b50b1f514
commit
663e1018e7
|
|
@ -32,8 +32,7 @@
|
|||
{ "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": "cmd", "cmd": "cmd", "args": true }
|
||||
{ "name": "openpencil-mcp-http", "cmd": "openpencil-mcp-http", "args": true }
|
||||
]
|
||||
},
|
||||
"shell:allow-stdin-write",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export async function getAutomationAuthToken(): Promise<string | null> {
|
|||
|
||||
export async function spawnMCPIfNeeded(): Promise<AutomationServerHandle | null> {
|
||||
const isTauri = IS_BROWSER && '__TAURI_INTERNALS__' in window
|
||||
console.warn('[MCP] spawn check: DEV=', import.meta.env.DEV, 'isTauri=', isTauri, 'IS_BROWSER=', IS_BROWSER)
|
||||
if (import.meta.env.DEV || !isTauri) {
|
||||
return DEV_AUTOMATION_AUTH_TOKEN
|
||||
? { disconnect: noop, authToken: DEV_AUTOMATION_AUTH_TOKEN }
|
||||
|
|
@ -67,20 +68,12 @@ export async function spawnMCPIfNeeded(): Promise<AutomationServerHandle | null>
|
|||
runtimeAutomationAuthToken = authToken
|
||||
|
||||
const { Command } = await import('@tauri-apps/plugin-shell')
|
||||
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
|
||||
}
|
||||
})
|
||||
const command = 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