Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
47b365d
feat: rn-mcp CLI with Snapshot + Refs pattern
ohah Mar 20, 2026
9358a40
test: CLI (rn-mcp) E2E smoke test 추가
ohah Mar 20, 2026
39f023d
refactor: CLI 코드 리뷰 반영 — 중복 제거, 버그 수정
ohah Mar 20, 2026
0983edd
style: oxfmt 포맷팅 수정
ohah Mar 20, 2026
a28c673
fix: CLI E2E — MCP 서버 stdin EOF 종료 방지 + resolveUdid/Serial 인자 수정
ohah Mar 20, 2026
b3997e9
fix: CLI E2E — MCP 서버 stdin을 sleep infinity로 유지
ohah Mar 20, 2026
64a3c04
fix: CLI E2E — grep pipefail로 인한 스크립트 종료 방지
ohah Mar 20, 2026
5d5d398
fix: CLI E2E — 스크립트 내 CLI 경로를 절대 경로로 변경
ohah Mar 21, 2026
07f916a
fix: Android E2E — adb PATH 설정 및 서버 사전 시작
ohah Mar 21, 2026
e19711d
fix: Android E2E — 디스크 정리에서 libgl1-mesa-dri 제거 중지
ohah Mar 21, 2026
6d22ec4
fix: Android E2E — AVD 캐시 키 bump (v3→v4)
ohah Mar 21, 2026
7d54822
fix: CLI E2E — FIFO 기반 MCP 서버 stdin 관리 + cleanup 개선
ohah Mar 21, 2026
9e22c83
fix: CLI E2E — tail -f /dev/null 방식으로 MCP 서버 stdin 관리 단순화
ohah Mar 21, 2026
a2466e0
fix: CLI E2E — 서브셸 + pkill로 tail/node 프로세스 확실히 종료
ohah Mar 21, 2026
c4ffbe1
fix: CLI E2E — cleanup에서 tail -f 잔여 프로세스 강제 정리
ohah Mar 21, 2026
04f1e35
docs: rspress에 rn-mcp CLI 문서 추가 (한영)
ohah Mar 21, 2026
71e9cae
docs: CLI 문서 마이너 수정 — default값, 단위, help/version 옵션 추가
ohah Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/e2e-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: 디스크 공간 확보
run: |
sudo apt-get remove -y '^dotnet-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get remove -y '^dotnet-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
sudo rm -rf /usr/share/dotnet/ /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/share/powershell /usr/local/share/chromium
Expand Down Expand Up @@ -152,14 +152,21 @@ jobs:
mkdir -p examples/demo-app/android/app/build/outputs/apk/release
cp "${{ runner.temp }}/e2e-app-cache/android/app-release.apk" examples/demo-app/android/app/build/outputs/apk/release/

- name: Android SDK PATH 설정 및 adb 시작
run: |
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
echo "$ANDROID_HOME/emulator" >> $GITHUB_PATH
$ANDROID_HOME/platform-tools/adb start-server
$ANDROID_HOME/platform-tools/adb devices

- name: AVD 캐시
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ steps.avd.outputs.name }}-1080x1920-ram4096-v3
key: avd-${{ steps.avd.outputs.name }}-1080x1920-ram4096-v4

- name: AVD 스냅샷 생성 (캐시 미스 시)
if: steps.avd-cache.outputs.cache-hit != 'true'
Expand All @@ -173,6 +180,7 @@ jobs:
heap-size: 2048M
force-avd-creation: false
emulator-options: -no-window -skin 1080x1920 -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -cores 4
emulator-boot-timeout: 600
disable-animations: false
script: echo "Generated AVD snapshot for caching."

Expand All @@ -188,6 +196,7 @@ jobs:
heap-size: 2048M
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -skin 1080x1920 -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -cores 4
emulator-boot-timeout: 600
disable-animations: true
script: |
echo "=== Connected Android devices (adb devices -l) ==="
Expand Down Expand Up @@ -232,6 +241,16 @@ jobs:
E2E_CMD="node packages/react-native-mcp-server/dist/test/cli.js run examples/demo-app/e2e/all-steps.yaml -p android -o e2e-artifacts/yaml-results --no-auto-launch"
$E2E_CMD || { echo "--- E2E 1차 실패, 재시도 ---"; sleep 5; $E2E_CMD; }

# CLI (rn-mcp) E2E smoke test
echo ""
echo "=== CLI (rn-mcp) E2E smoke test ==="
# YAML 테스트 후 앱 재시작
adb shell am force-stop com.reactnativemcp.demo
sleep 2
adb shell monkey -p com.reactnativemcp.demo -c android.intent.category.LAUNCHER 1
sleep 8
bash examples/demo-app/e2e/cli-smoke.sh --platform android

- name: 실패 시 스크린샷·로그 저장
if: failure()
timeout-minutes: 2
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/e2e-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,19 @@ jobs:
max_attempts: 2
command: node packages/react-native-mcp-server/dist/test/cli.js run examples/demo-app/e2e/all-steps.yaml -p ios -o e2e-artifacts/yaml-results --no-auto-launch

- name: CLI (rn-mcp) E2E smoke test
if: success()
timeout-minutes: 5
env:
REACT_NATIVE_MCP_TAP_TIMEOUT_MS: 25000
run: |
# YAML 테스트 후 앱이 마지막 화면에 있으므로 재시작
xcrun simctl terminate booted org.reactnativemcp.demo 2>/dev/null || true
sleep 2
xcrun simctl launch booted org.reactnativemcp.demo 2>/dev/null || true
sleep 8
bash examples/demo-app/e2e/cli-smoke.sh --platform ios

- name: 실패 시 스크린샷·로그 저장
if: failure()
timeout-minutes: 2
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@ jobs:

- name: 테스트 실행
run: bun run test:unit

- name: CLI smoke test
run: |
node packages/react-native-mcp-server/dist/cli.js --version
node packages/react-native-mcp-server/dist/cli.js --help | grep -q "WORKFLOW"
echo "✓ CLI --help and --version work"

- name: CLI init-agent test
run: |
cd "$(mktemp -d)"
node "$GITHUB_WORKSPACE/packages/react-native-mcp-server/dist/cli.js" init-agent --lang en
grep -q "rn-mcp snapshot" AGENTS.md
grep -q "rn-mcp snapshot" CLAUDE.md
# 한국어로 교체
node "$GITHUB_WORKSPACE/packages/react-native-mcp-server/dist/cli.js" init-agent --lang ko
grep -q "연결 확인" AGENTS.md
grep -q "연결 확인" CLAUDE.md
echo "✓ init-agent creates and updates guide files"
55 changes: 55 additions & 0 deletions AGENTS.MD
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,58 @@ bun run format # oxfmt
- [E2E YAML Reference](document/docs/en/testing/e2e-yaml-reference.md) — YAML scenario syntax and steps
- Runner: `packages/react-native-mcp-server/src/e2e/`
- Config: `e2e.yaml` at project root

---

## CLI (rn-mcp) — AI 에이전트 권장 인터페이스

셸 접근이 가능한 AI 에이전트(Claude Code, Codex 등)는 MCP 도구 대신 `rn-mcp` CLI를 사용하세요.
Snapshot + Refs 패턴으로 토큰 소비를 크게 절감합니다.

### 필수 워크플로우

```bash
# 1. 연결 확인
rn-mcp status

# 2. 화면의 interactive 요소를 @ref로 조회
rn-mcp snapshot -i

# 3. ref로 요소 조작
rn-mcp tap @e3
rn-mcp type @e5 "user@example.com"

# 4. 화면이 바뀌었으면 snapshot 재호출
rn-mcp snapshot -i
```

### 핵심 규칙

1. **snapshot -i를 먼저** — 앱 화면을 모르는 상태에서 tap하지 마세요
2. **화면 전환 후 snapshot 재호출** — 탭 후 화면이 바뀌면 기존 refs는 무효
3. **ref "not found" = snapshot 필요** — `✗ @e3 not found` 에러 시 `rn-mcp snapshot -i`
4. **스크린샷보다 assert** — `rn-mcp assert text "Welcome"`이 스크린샷보다 토큰 절약
5. **iOS orientation 자동 처리** — CLI가 내부적으로 좌표 변환 (별도 조치 불필요)

### 명령어 빠른 참조

| 명령 | 용도 |
|------|------|
| `rn-mcp status` | 연결 상태 확인 |
| `rn-mcp snapshot -i` | interactive 요소 + @ref 할당 |
| `rn-mcp tap @e3` | 탭 |
| `rn-mcp tap @e3 --long 500` | 롱프레스 |
| `rn-mcp type @e5 "텍스트"` | 텍스트 입력 |
| `rn-mcp swipe @e2 down` | 스와이프 |
| `rn-mcp key back` | 하드웨어 키 (back, home, enter) |
| `rn-mcp assert text "Welcome"` | 텍스트 존재 확인 |
| `rn-mcp assert visible @e3` | 가시성 확인 |
| `rn-mcp query "#btn"` | 요소 조회 |
| `rn-mcp screenshot -o s.png` | 스크린샷 |

### CLI vs MCP 선택 기준

- **CLI 가능** (Claude Code, Codex 등) → `rn-mcp` CLI 사용 (토큰 효율)
- **CLI 불가** (Cursor, Windsurf 등 MCP만 지원) → 기존 MCP 도구 사용

자세한 사용법: `rn-mcp --help`
Loading
Loading