diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 520482e8..5d6ec098 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -29,11 +29,14 @@ jobs: run: | cd backend python build_binary.py + python build_binary.py --shim PLATFORM=$(rustc --print host-tuple) mkdir -p ../tauri/src-tauri/binaries cp dist/voicebox-server.exe ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}.exe + cp dist/voicebox-mcp.exe ../tauri/src-tauri/binaries/voicebox-mcp-${PLATFORM}.exe echo "Built voicebox-server-${PLATFORM}.exe" + echo "Built voicebox-mcp-${PLATFORM}.exe" - name: Setup Bun uses: oven-sh/setup-bun@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f864c55..e94bcd70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,6 +114,7 @@ jobs: run: | cd backend python build_binary.py + python build_binary.py --shim # Get platform tuple PLATFORM=$(rustc --print host-tuple) @@ -123,7 +124,9 @@ jobs: # Copy with platform suffix cp dist/voicebox-server.exe ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}.exe + cp dist/voicebox-mcp.exe ../tauri/src-tauri/binaries/voicebox-mcp-${PLATFORM}.exe echo "Built voicebox-server-${PLATFORM}.exe" + echo "Built voicebox-mcp-${PLATFORM}.exe" - name: Setup Bun uses: oven-sh/setup-bun@v2 diff --git a/app/src/components/ServerTab/MCPPage.tsx b/app/src/components/ServerTab/MCPPage.tsx index b952a59a..ddb4de1f 100644 --- a/app/src/components/ServerTab/MCPPage.tsx +++ b/app/src/components/ServerTab/MCPPage.tsx @@ -16,6 +16,21 @@ import { useServerStore } from '@/stores/serverStore'; import { formatDate } from '@/lib/utils/format'; import { SettingRow, SettingSection } from './SettingRow'; +function getStdioShimCommand(): string { + if (typeof navigator === 'undefined') { + return '/Applications/Voicebox.app/Contents/MacOS/voicebox-mcp'; + } + + const platform = `${navigator.platform} ${navigator.userAgent}`.toLowerCase(); + if (platform.includes('win')) { + return 'C:\\Program Files\\Voicebox\\voicebox-mcp.exe'; + } + if (platform.includes('linux')) { + return '/opt/voicebox/voicebox-mcp'; + } + return '/Applications/Voicebox.app/Contents/MacOS/voicebox-mcp'; +} + /** * Settings → MCP — configure per-agent voice binding and show copy-paste * install snippets for major MCP clients. Backend runs at /mcp on the @@ -30,6 +45,7 @@ export function MCPPage() { const defaultProfileId = captureSettings?.default_playback_voice_id ?? ''; const mcpUrl = `${serverUrl}/mcp`; + const stdioShimCommand = getStdioShimCommand(); const [newClientId, setNewClientId] = useState(''); const [newLabel, setNewLabel] = useState(''); @@ -88,8 +104,7 @@ export function MCPPage() { { mcpServers: { voicebox: { - command: - '/Applications/Voicebox.app/Contents/MacOS/voicebox-mcp', + command: stdioShimCommand, env: { VOICEBOX_CLIENT_ID: 'claude-code' }, }, }, diff --git a/scripts/build-server.sh b/scripts/build-server.sh index d9eb72c5..7247d7d1 100755 --- a/scripts/build-server.sh +++ b/scripts/build-server.sh @@ -6,7 +6,7 @@ set -e # Determine platform PLATFORM=$(rustc --print host-tuple 2>/dev/null || echo "unknown") -echo "Building voicebox-server for platform: $PLATFORM" +echo "Building Voicebox sidecars for platform: $PLATFORM" # Build Python binary # Resolve PATH to absolute paths before changing directory @@ -19,23 +19,29 @@ if ! python -c "import PyInstaller" 2>/dev/null; then python -m pip install pyinstaller fi -# Build binary -python build_binary.py - # Create binaries directory if it doesn't exist mkdir -p ../tauri/src-tauri/binaries -# Copy binary with platform suffix -if [ -f dist/voicebox-server ]; then - cp dist/voicebox-server ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM} - chmod +x ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM} - echo "Built voicebox-server-${PLATFORM}" -elif [ -f dist/voicebox-server.exe ]; then - cp dist/voicebox-server.exe ../tauri/src-tauri/binaries/voicebox-server-${PLATFORM}.exe - echo "Built voicebox-server-${PLATFORM}.exe" -else - echo "Error: Binary not found in dist/" - exit 1 -fi +copy_sidecar() { + local name="$1" + + if [ -f "dist/${name}" ]; then + cp "dist/${name}" "../tauri/src-tauri/binaries/${name}-${PLATFORM}" + chmod +x "../tauri/src-tauri/binaries/${name}-${PLATFORM}" + echo "Built ${name}-${PLATFORM}" + elif [ -f "dist/${name}.exe" ]; then + cp "dist/${name}.exe" "../tauri/src-tauri/binaries/${name}-${PLATFORM}.exe" + echo "Built ${name}-${PLATFORM}.exe" + else + echo "Error: ${name} binary not found in dist/" + exit 1 + fi +} + +python build_binary.py +copy_sidecar voicebox-server + +python build_binary.py --shim +copy_sidecar voicebox-mcp echo "Build complete!"