Skip to content

Commit bae7a28

Browse files
committed
update setup scripts
1 parent 8db2723 commit bae7a28

3 files changed

Lines changed: 66 additions & 81 deletions

File tree

examples/MCP/README.md

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,21 @@ sequenceDiagram
5252

5353
## Prerequisites
5454

55-
- Python 3.8+ (64-bit, matching your build architecture: x64 or ARM64)
56-
- Project built with `build.bat` / `build.sh` (the TACDev library is loaded from `__Builds`)
55+
| Requirement | Details |
56+
| :-- | :-- |
57+
| Python | 3.10+ matching your target architecture (x64 Python on x64, ARM64 Python on ARM64) |
58+
| OpenSSL | Required to build the `cryptography` package (a fastmcp dependency). Install the version matching your architecture from [slproweb.com](https://slproweb.com/products/Win32OpenSSL.html) or via package manager on Linux. On ARM64 Windows, also set `OPENSSL_DIR` to the install path before running `setup.bat ARM64` - the ARM64 wheel must be compiled from source |
59+
| QTAC build | Project must be built with `build.bat` / `build.sh` - TACDev library is loaded from `__Builds` |
5760

5861
## Setup
5962

60-
Run from the `examples/MCP` directory:
61-
62-
```cmd
63-
setup.bat (Windows x64, auto-detected)
64-
setup.bat ARM64 (Windows ARM64)
65-
```
66-
```bash
67-
./setup.sh (Linux)
68-
```
63+
| Platform | Command |
64+
| :-- | :-- |
65+
| Windows x64 (auto-detected) | `setup.bat` |
66+
| Windows ARM64 | `setup.bat ARM64` |
67+
| Linux | `./setup.sh` |
6968

70-
Each script builds the project, installs the TACDev Python library, and installs MCP dependencies.
69+
Each script checks for an existing build, installs the TACDev Python library, and installs MCP dependencies.
7170

7271
For full setup guidance see [Bootcamp guide](../../docs/bootcamp/01-Bootcamp.md) and
7372
[Python API reference](../../docs/bootcamp/02-Python-API.md).
@@ -76,17 +75,14 @@ For full setup guidance see [Bootcamp guide](../../docs/bootcamp/01-Bootcamp.md)
7675

7776
All runtime parameters are in `config.yaml`:
7877

79-
```yaml
80-
server:
81-
host: "127.0.0.1"
82-
port: 8000
83-
84-
logging:
85-
file: "tacdev_mcp.log"
86-
level: "INFO"
87-
max_bytes: 10485760
88-
backup_count: 5
89-
```
78+
| Parameter | Default | Description |
79+
| :-- | :-- | :-- |
80+
| `server.host` | `127.0.0.1` | Host to bind the server on |
81+
| `server.port` | `8000` | Port the server listens on |
82+
| `logging.file` | `tacdev_mcp.log` | Log file path |
83+
| `logging.level` | `INFO` | Log level: DEBUG, INFO, WARNING, ERROR |
84+
| `logging.max_bytes` | `10485760` | Max log file size before rotation (10 MB) |
85+
| `logging.backup_count` | `5` | Number of rotated backup files to retain |
9086

9187
## Usage
9288

@@ -119,51 +115,15 @@ async def main():
119115
asyncio.run(main())
120116
```
121117

122-
## Available tools
123-
124-
| Category | Tools |
125-
| :-- | :-- |
126-
| Devices | `list_devices` |
127-
| Diagnostics | `get_alpaca_version`, `get_tac_version`, `get_last_tac_error` |
128-
| Logging | `get_logging_state`, `set_logging_state` |
129-
| Device enumeration | `get_device_count`, `get_port_data` |
130-
| Handle management | `open_handle_by_description`, `close_tac_handle` |
131-
| Device info | `get_name`, `get_firmware_version`, `get_hardware`, `get_hardware_version`, `get_uuid` |
132-
| External power | `set_external_power_control` |
133-
| Dynamic commands | `list_commands`, `get_command`, `list_quick_commands` |
134-
| Script variables | `list_script_variables`, `update_script_variable` |
135-
| Command interface | `get_command_state`, `send_command` |
136-
| Help / queue | `get_help_text`, `is_command_queue_clear` |
137-
| Raw pin | `set_pin_state` |
138-
| Battery | `set_battery_state`, `get_battery_state` |
139-
| USB | `set_usb0`, `get_usb0_state`, `set_usb1`, `get_usb1_state` |
140-
| Buttons | `set_power_key`, `get_power_key_state`, `set_volume_up`, `get_volume_up_state`, `set_volume_down`, `get_volume_down_state` |
141-
| SIM / SD | `set_disconnect_uim1`, `get_disconnect_uim1_state`, `set_disconnect_uim2`, `get_disconnect_uim2_state`, `set_disconnect_sd_card`, `get_disconnect_sd_card_state` |
142-
| EDL | `set_primary_edl`, `get_primary_edl_state`, `set_secondary_edl`, `get_secondary_edl_state` |
143-
| PS_HOLD / RESIN | `set_force_ps_hold_high`, `get_force_ps_hold_high_state`, `set_secondary_pm_resin_n`, `get_secondary_pm_resin_n_state` |
144-
| EUD | `set_eud`, `get_eud_state` |
145-
| Headset | `set_headset_disconnect`, `get_headset_disconnect_state` |
146-
| Device name / resets | `set_name`, `get_reset_count`, `clear_reset_count` |
147-
| Button sequences | `power_on_button`, `power_off_button`, `boot_to_fastboot_button`, `boot_to_uefi_menu_button`, `boot_to_edl_button`, `boot_to_secondary_edl_button` |
148-
149118
## Troubleshooting
150119

151-
**`ModuleNotFoundError: No module named 'TACDev'`**
152-
Run `pip install interfaces/Python` from the repo root, or use `setup.bat` / `setup.sh`.
153-
154-
**`TACDev library not found`**
155-
Build the project first with `build.bat` / `build.sh` and run scripts from the repo root.
156-
157-
**`Architecture mismatch`**
158-
Use a 64-bit Python build matching your target architecture (x64 or ARM64).
159-
160-
**`get_device_count` returns 0**
161-
Check the debug board is connected. On Windows, look for Unknown Device in Device Manager and
162-
run `FTDICheck.exe` from `__Builds\x64\Release\bin` to diagnose the FTDI connection.
163-
On Linux, ensure udev rules are installed:
164-
```bash
165-
sudo cp udev-rules/99-QTAC-USB.rules /etc/udev/rules.d/
166-
sudo udevadm control --reload
167-
```
120+
| Error | Fix |
121+
| :-- | :-- |
122+
| `ModuleNotFoundError: No module named 'TACDev'` | Run `pip install interfaces/Python` from the repo root, or use `setup.bat` / `setup.sh` |
123+
| `TACDev library not found` | Build the project first with `build.bat` / `build.sh` and run from repo root |
124+
| `Architecture mismatch` | Use a 64-bit Python matching your target architecture (x64 or ARM64) |
125+
| `ModuleNotFoundError: No module named 'fastmcp'` | Requires Python 3.10+. Run `pip install -r requirements.txt` |
126+
| `cryptography` build failure on ARM64 | Set `OPENSSL_DIR` to the ARM64 OpenSSL install path before running `setup.bat ARM64`. Download the ARM64 OpenSSL installer from [slproweb.com](https://slproweb.com/products/Win32OpenSSL.html), then: `setx OPENSSL_DIR "C:\Program Files\OpenSSL-ARM64"` and reopen the prompt |
127+
| `get_device_count` returns 0 | Check debug board is connected. On Windows run `FTDICheck.exe` from `__Builds\x64\Release\bin`. On Linux ensure udev rules are installed: `sudo cp udev-rules/99-QTAC-USB.rules /etc/udev/rules.d/ && sudo udevadm control --reload` |
168128

169129
See [Bootcamp troubleshooting](../../docs/bootcamp/01-Bootcamp.md#troubleshooting) for more.

examples/MCP/setup.bat

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,51 @@
33

44
@echo off
55

6-
@REM Resolve repo root (two levels up from examples\MCP)
76
set SCRIPT_DIR=%~dp0
87
pushd "%SCRIPT_DIR%\..\.."
98
set REPO_ROOT=%CD%
109
popd
1110

12-
@REM Step 1: build the project
13-
echo [1/3] Building QTAC...
14-
call "%REPO_ROOT%\build.bat" %1
15-
if errorlevel 1 exit /b 1
11+
set ARCH=%1
12+
if "%ARCH%"=="" set ARCH=x64
13+
14+
@REM On ARM64, the cryptography package (required by fastmcp) must be compiled
15+
@REM from source. This requires OpenSSL development headers. Check early.
16+
if /i "%ARCH%"=="ARM64" (
17+
if "%OPENSSL_DIR%"=="" (
18+
echo.
19+
echo ERROR: OPENSSL_DIR is not set.
20+
echo ARM64 builds require OpenSSL development headers to compile the
21+
echo cryptography package. Install OpenSSL ARM64 and set OPENSSL_DIR:
22+
echo.
23+
echo 1. Download the ARM64 OpenSSL installer from https://slproweb.com/products/Win32OpenSSL.html
24+
echo 2. Install it, then run:
25+
echo setx OPENSSL_DIR "C:\Program Files\OpenSSL-ARM64"
26+
echo 3. Open a new command prompt and re-run setup.bat ARM64
27+
echo.
28+
exit /b 1
29+
)
30+
echo OpenSSL : %OPENSSL_DIR% [OK]
31+
)
32+
33+
set BUILD_DIR=%REPO_ROOT%\__Builds
34+
35+
if not exist "%BUILD_DIR%" (
36+
echo [1/3] Build not found. Running root build...
37+
call "%REPO_ROOT%\build.bat" %ARCH%
38+
if errorlevel 1 exit /b 1
39+
) else (
40+
echo [1/3] Build found at %BUILD_DIR%, skipping recompile.
41+
)
1642

17-
@REM Step 2: install TACDev Python library
1843
echo [2/3] Installing TACDev Python library...
1944
pip install "%REPO_ROOT%\interfaces\Python"
2045
if errorlevel 1 exit /b 1
2146

22-
@REM Step 3: install MCP dependencies
2347
echo [3/3] Installing MCP dependencies...
2448
pip install -r "%SCRIPT_DIR%requirements.txt"
2549
if errorlevel 1 exit /b 1
2650

2751
echo.
28-
echo Setup complete. Run the MCP server from the repo root:
52+
echo Setup complete. Start the MCP server:
2953
echo python examples\MCP\tacdev_mcp_server.py

examples/MCP/setup.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ set -e
88
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
1010

11-
# Step 1: build the project
12-
echo "[1/3] Building QTAC..."
13-
"$REPO_ROOT/build.sh"
11+
if [ ! -d "$REPO_ROOT/__Builds" ]; then
12+
echo "[1/3] Build not found. Running root build..."
13+
"$REPO_ROOT/build.sh"
14+
else
15+
echo "[1/3] Build found at $REPO_ROOT/__Builds, skipping recompile."
16+
fi
1417

15-
# Step 2: install TACDev Python library
1618
echo "[2/3] Installing TACDev Python library..."
1719
pip install "$REPO_ROOT/interfaces/Python"
1820

19-
# Step 3: install MCP dependencies
2021
echo "[3/3] Installing MCP dependencies..."
2122
pip install -r "$SCRIPT_DIR/requirements.txt"
2223

2324
echo ""
24-
echo "Setup complete. Run the MCP server from the repo root:"
25+
echo "Setup complete. Start the MCP server:"
2526
echo " python examples/MCP/tacdev_mcp_server.py"

0 commit comments

Comments
 (0)