Skip to content

Commit debfd72

Browse files
committed
Add MCP preflight workflow and update NL suite
1 parent d144d9c commit debfd72

File tree

2 files changed

+66
-9
lines changed

2 files changed

+66
-9
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Claude MCP Preflight (no Unity)
2+
3+
on: [workflow_dispatch]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
mcp-preflight:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: astral-sh/setup-uv@v4
19+
with:
20+
python-version: "3.11"
21+
22+
- name: Install MCP server deps
23+
run: |
24+
set -eux
25+
uv venv
26+
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> "$GITHUB_ENV"
27+
echo "$GITHUB_WORKSPACE/.venv/bin" >> "$GITHUB_PATH"
28+
if [ -f Server/pyproject.toml ]; then
29+
uv pip install -e Server
30+
elif [ -f Server/requirements.txt ]; then
31+
uv pip install -r Server/requirements.txt
32+
else
33+
echo "No MCP Python deps found" >&2
34+
exit 1
35+
fi
36+
37+
- name: Preflight MCP server (stdio)
38+
env:
39+
PYTHONUNBUFFERED: "1"
40+
MCP_LOG_LEVEL: debug
41+
UNITY_PROJECT_ROOT: ${{ github.workspace }}/TestProjects/UnityMCPTests
42+
UNITY_MCP_STATUS_DIR: ${{ github.workspace }}/.unity-mcp-dummy
43+
UNITY_MCP_HOST: 127.0.0.1
44+
run: |
45+
set -euxo pipefail
46+
mkdir -p "$UNITY_MCP_STATUS_DIR"
47+
# Create a dummy status file with an unreachable port; help should not require it
48+
cat > "$UNITY_MCP_STATUS_DIR/unity-mcp-status-dummy.json" <<JSON
49+
{ "unity_port": 0, "reason": "dummy", "reloading": false, "project_path": "$UNITY_PROJECT_ROOT/Assets" }
50+
JSON
51+
uv run --active --directory Server mcp-for-unity --transport stdio --help \
52+
> /tmp/mcp-preflight.log 2>&1 || { cat /tmp/mcp-preflight.log; exit 1; }
53+
cat /tmp/mcp-preflight.log
54+
55+

.github/workflows/claude-nl-suite.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
121121
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
122122
run: |
123-
set -euxo pipefail
123+
set -euo pipefail
124124
# host dirs to receive the full Unity config and local-share
125125
mkdir -p "$RUNNER_TEMP/unity-config" "$RUNNER_TEMP/unity-local"
126126
@@ -156,7 +156,7 @@ jobs:
156156

157157
# ---------- Warm up project (import Library once) ----------
158158
- name: Warm up project (import Library once)
159-
if: steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true'
159+
if: steps.detect.outputs.anthropic_ok == 'true' && (steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true')
160160
shell: bash
161161
env:
162162
UNITY_IMAGE: ${{ env.UNITY_IMAGE }}
@@ -172,6 +172,7 @@ jobs:
172172
-v "${{ github.workspace }}:/workspace" -w /workspace \
173173
-v "$RUNNER_TEMP/unity-config:/root/.config/unity3d" \
174174
-v "$RUNNER_TEMP/unity-local:/root/.local/share/unity3d" \
175+
-v "$RUNNER_TEMP/unity-cache:/root/.cache/unity3d" \
175176
"$UNITY_IMAGE" /opt/unity/Editor/Unity -batchmode -nographics -logFile - \
176177
-projectPath /workspace/TestProjects/UnityMCPTests \
177178
"${manual_args[@]}" \
@@ -186,7 +187,7 @@ jobs:
186187
187188
# ---------- Start headless Unity (persistent bridge) ----------
188189
- name: Start Unity (persistent bridge)
189-
if: steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true'
190+
if: steps.detect.outputs.anthropic_ok == 'true' && (steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true')
190191
shell: bash
191192
env:
192193
UNITY_IMAGE: ${{ env.UNITY_IMAGE }}
@@ -218,10 +219,11 @@ jobs:
218219
219220
# ---------- Wait for Unity bridge ----------
220221
- name: Wait for Unity bridge (robust)
222+
if: steps.detect.outputs.anthropic_ok == 'true' && (steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true')
221223
shell: bash
222224
run: |
223225
set -euo pipefail
224-
deadline=$((SECONDS+900)) # 15 min max
226+
deadline=$((SECONDS+600)) # 10 min max
225227
fatal_after=$((SECONDS+120)) # give licensing 2 min to settle
226228
227229
# Fail fast only if container actually died
@@ -272,7 +274,7 @@ jobs:
272274
273275
# ---------- Debug Unity bridge status ----------
274276
- name: Debug Unity bridge status
275-
if: always()
277+
if: always() && (steps.lic.outputs.use_ulf == 'true' || steps.lic.outputs.use_ebl == 'true')
276278
shell: bash
277279
run: |
278280
set -euxo pipefail
@@ -341,11 +343,11 @@ jobs:
341343
"permissions": {
342344
"allow": [
343345
"mcp__unity",
344-
"Edit(reports/**)"
346+
"Edit(reports/**)",
347+
"MultiEdit(reports/**)"
345348
],
346349
"deny": [
347350
"Bash",
348-
"MultiEdit",
349351
"WebFetch",
350352
"WebSearch",
351353
"Task",
@@ -357,7 +359,7 @@ jobs:
357359
}
358360
JSON
359361
360-
# ---------- Reports & helper ----------
362+
# ---------- Reports & helper ----------
361363
- name: Prepare reports and dirs
362364
run: |
363365
set -eux
@@ -405,7 +407,7 @@ jobs:
405407
export UNITY_PROJECT_ROOT="$GITHUB_WORKSPACE/TestProjects/UnityMCPTests"
406408
export UNITY_MCP_STATUS_DIR="$HOME/.unity-mcp"
407409
export UNITY_MCP_HOST=127.0.0.1
408-
uv run --active --directory Server mcp-for-unity --help \
410+
uv run --active --directory Server mcp-for-unity --transport stdio --help \
409411
> /tmp/mcp-preflight.log 2>&1 || { cat /tmp/mcp-preflight.log; exit 1; }
410412
cat /tmp/mcp-preflight.log
411413

0 commit comments

Comments
 (0)