UNPKG

@darbotlabs/darbot-windows-mcp

Version:

🪟 Darbot Windows MCP - Professional Windows desktop automation server for AI agents via Model Context Protocol (MCP). Control Windows like a human with 15 powerful tools. Includes Python dependencies, UV, and VS Code configuration.

109 lines (91 loc) • 3.68 kB
const { spawn } = require('child_process'); const chalk = require('chalk'); const path = require('path'); function runCommand(command, args = [], options = {}) { return new Promise((resolve, reject) => { const process = spawn(command, args, { stdio: 'pipe', ...options }); let stdout = ''; let stderr = ''; process.stdout?.on('data', (data) => { stdout += data.toString(); }); process.stderr?.on('data', (data) => { stderr += data.toString(); }); process.on('close', (code) => { if (code === 0) { resolve({ stdout, stderr }); } else { reject(new Error(`Command failed with code ${code}: ${stderr}`)); } }); process.on('error', reject); }); } async function test() { console.log(chalk.blue.bold('🪟 Testing Darbot Windows MCP Installation')); console.log(chalk.gray(' Desktop automation for AI agents')); console.log(''); const packageDir = path.dirname(__dirname); const mainPyPath = path.join(packageDir, 'main.py'); // Test 1: Check if main.py exists console.log(chalk.cyan('1. Checking main.py...')); try { require('fs').accessSync(mainPyPath); console.log(chalk.green(' āœ… main.py found')); } catch (error) { console.log(chalk.red(' āŒ main.py not found')); return false; } // Test 2: Test UV if available console.log(chalk.cyan('2. Testing UV...')); try { await runCommand('uv', ['--version']); console.log(chalk.green(' āœ… UV available')); // Test UV run try { await runCommand('uv', ['--directory', packageDir, 'run', 'python', mainPyPath, '--help'], { timeout: 10000 }); console.log(chalk.green(' āœ… UV can run the server')); } catch (error) { console.log(chalk.yellow(' āš ļø UV found but server test failed')); } } catch (error) { console.log(chalk.yellow(' āš ļø UV not available, will use Python')); } // Test 3: Test Python console.log(chalk.cyan('3. Testing Python...')); try { const result = await runCommand('python', ['--version']); console.log(chalk.green(` āœ… Python available: ${result.stdout.trim()}`)); // Test Python run try { await runCommand('python', [mainPyPath, '--help'], { cwd: packageDir, timeout: 10000 }); console.log(chalk.green(' āœ… Python can run the server')); } catch (error) { console.log(chalk.red(' āŒ Python server test failed')); console.log(chalk.red(` Error: ${error.message}`)); return false; } } catch (error) { console.log(chalk.red(' āŒ Python not available')); return false; } console.log(chalk.green.bold('\nšŸŽ‰ All tests passed! The installation is working correctly.')); console.log(chalk.cyan('\nTo get started:')); console.log('• Run "darbot-setup" to configure VS Code and Claude Desktop'); console.log('• Or run "darbot-windows-mcp" to start the server directly'); return true; } if (require.main === module) { test().catch((error) => { console.error(chalk.red('āŒ Test failed:'), error.message); process.exit(1); }); } module.exports = { test };