2b7a8290a5
- New start-windows-mcp.bat — starts Windows-MCP SSE server on :8000 - Windows-MCP auto-starts when Hermes CLI launches (options 1/2) - Pre-downloaded wheels: hermes-agent (47), windows-mcp (95) - Offline Python 3.13 embedded + get-pip.py bootstrapper - Hermes config wired with mcp_servers.windows-mcp - Updated Makefile with targets: wheels-hermes, wheels-windows-mcp, python-portable, get-pip, deps - Recreated: run-hermes.ps1, start-hermes-dashboard.bat - Pure ASCII .bat files with CRLF line endings
149 lines
4.6 KiB
Batchfile
149 lines
4.6 KiB
Batchfile
@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_MAIN=%~dp0python\python.exe
|
|
set PYTHON313=%~dp0python313\python.exe
|
|
set MARKER=%~dp0bin\.windows-mcp-installed
|
|
set PYTHON_CMD=
|
|
|
|
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
|
|
)
|
|
|
|
:: --- Find Python 3.13+ -------------------------------------------------------
|
|
echo [*] Looking for Python 3.13+...
|
|
|
|
:: Tier 1: Dedicated python313\ directory
|
|
if exist "!PYTHON313!" (
|
|
"!PYTHON313!" --version 2>nul | findstr /r /c:"Python 3\.1[3-9]" >nul
|
|
if !errorlevel! equ 0 (
|
|
echo [OK] Found dedicated Python 3.13: !PYTHON313!
|
|
set PYTHON_CMD=!PYTHON313!
|
|
goto install_and_run
|
|
)
|
|
)
|
|
|
|
:: Tier 2: Main portable Python (if 3.13+)
|
|
if exist "!PYTHON_MAIN!" (
|
|
"!PYTHON_MAIN!" --version 2>nul | findstr /r /c:"Python 3\.1[3-9]" >nul
|
|
if !errorlevel! equ 0 (
|
|
echo [OK] Found Python 3.13: !PYTHON_MAIN!
|
|
set PYTHON_CMD=!PYTHON_MAIN!
|
|
goto install_and_run
|
|
) else (
|
|
"!PYTHON_MAIN!" --version 2>nul
|
|
echo [INFO] Main Python version is not 3.13+ (need >=3.13 for windows-mcp)
|
|
)
|
|
)
|
|
|
|
:: Tier 3: uv/uvx (handles its own Python)
|
|
where uvx >nul 2>&1
|
|
if !errorlevel! equ 0 (
|
|
echo [OK] Using uvx (auto-manages Python)
|
|
goto use_uvx
|
|
)
|
|
where uvx.exe >nul 2>&1
|
|
if !errorlevel! equ 0 (
|
|
echo [OK] Using uvx (auto-manages Python)
|
|
goto use_uvx
|
|
)
|
|
|
|
:: No Python 3.13+ found
|
|
echo.
|
|
echo [ERROR] No Python 3.13+ found and uvx is not available.
|
|
echo.
|
|
echo To use Windows-MCP, you need one of:
|
|
echo A) Place Python 3.13 portable in: python313\
|
|
echo (Download from https://www.python.org/downloads/)
|
|
echo B) Install uv and ensure it's in PATH:
|
|
echo winget install astral.uv
|
|
echo or: npm install -g uv
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
|
|
:: --- 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_CMD!" -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_CMD!" -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
|
|
|
|
:: --- Use uvx -----------------------------------------------------------------
|
|
:use_uvx
|
|
echo [*] Starting via uvx (auto-manages dependencies)...
|
|
echo.
|
|
echo [*] Press Ctrl+C to stop the server.
|
|
echo.
|
|
uvx 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
|
|
|
|
:: --- 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_CMD!" -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
|