@echo off title Hermes Portable - Windows MCP Server (UI Automation) setlocal enabledelayedexpansion cd /d "%~dp0" set MCP_PORT=8000 set MCP_HOST=127.0.0.1 set WHEELS_DIR=%~dp0bin\wheels-windows-mcp set PYTHON=%~dp0python\python.exe set MARKER=%~dp0bin\.windows-mcp-installed echo. echo ============================================ echo Windows MCP Server - UI Automation echo ============================================ echo. echo This starts the Windows-MCP server that gives echo Hermes AI the ability to click, type, take echo screenshots, run PowerShell, and navigate echo the Windows UI during diagnostics. echo. echo Server: http://%MCP_HOST%:%MCP_PORT% echo. :: --- Check if already running ------------------------------------------------ >nul 2>&1 curl -s http://%MCP_HOST%:%MCP_PORT%/mcp/health && ( echo [OK] Windows MCP Server is already running on port %MCP_PORT% echo. pause exit /b 0 ) :: --- Check Python exists ----------------------------------------------------- if not exist "!PYTHON!" ( echo [ERROR] Embedded Python 3.13 not found at !PYTHON! echo. pause exit /b 1 ) :: Verify it's 3.13+ "!PYTHON!" --version 2>nul | findstr /r /c:"Python 3\.1[3-9]" >nul if !errorlevel! neq 0 ( echo [ERROR] Embedded Python is not 3.13+ (need >=3.13 for windows-mcp) "!PYTHON!" --version echo. pause exit /b 1 ) echo [OK] Found Python 3.13: !PYTHON! :: --- Install from local wheels ----------------------------------------------- :install_and_run if not exist "!WHEELS_DIR!\windows_mcp-*-py3-none-any.whl" ( echo [WARN] Local wheels not found at !WHEELS_DIR! echo [*] Will download from internet (needs connection)... echo. ) else ( if not exist "!MARKER!" ( echo [*] Installing Windows-MCP from local wheels... "!PYTHON!" -m pip install --no-index --find-links "!WHEELS_DIR!" --quiet windows-mcp 2>&1 if errorlevel 1 ( echo [WARN] Offline install failed, trying online... "!PYTHON!" -m pip install --quiet windows-mcp 2>&1 ) if errorlevel 1 ( echo [ERROR] Failed to install windows-mcp. pause exit /b 1 ) echo. > "!MARKER!" echo [OK] Windows-MCP installed. ) else ( echo [OK] Windows-MCP already installed. ) ) goto run_server :: --- Run server -------------------------------------------------------------- :run_server echo. echo [*] Starting Windows-MCP Server... echo. echo Server: http://%MCP_HOST%:%MCP_PORT% echo Transport: SSE (Server-Sent Events) echo Tools: Screenshot, Click, Type, Snapshot, Mouse, Keyboard, echo FileSystem, Process, Clipboard, Notification, App, Scrape echo. echo NOTE: This tool requires Administrator privileges for some echo operations (screenshots, UI automation). echo. echo [*] Press Ctrl+C to stop the server. echo. "!PYTHON!" -m windows_mcp serve --transport sse --host %MCP_HOST% --port %MCP_PORT% --exclude-tools PowerShell,Registry echo. echo [*] Server exited with code !errorlevel! pause exit /b 0