Skip to content

Mirroring section (screen, control, sound, recording, iPhone stats) + local API + built-in MCP server - #21

Merged
YK3D merged 11 commits into
devfrom
feature/screen-mirroring
Nov 25, 2026
Merged

YK3D merged 11 commits into
devfrom
feature/screen-mirroring

Conversation

@YK3D

@YK3D YK3D commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

iPhone screen mirroring for iOS 27+ in its own Mirroring section, plus the local API and a built-in MCP server for AI agents. Based on dev (which carries the iDevBench rename, so it shows up in this diff while feature-testing is behind dev). Goes through feature-testing as a new device transport.

First real-device test result (after the first build): the picture mirrored and touch input worked, but there were freezes (Siri, screen recording, at random), 'x' must be a number errors, Lock did nothing, and the second build lagged. Those are addressed below; still to confirm on a real iPhone.

What it does

  • Picture, sound, control: com.apple.coredevice.displayservice HEVC over RTP inside the developer tunnel, decoded in the window with WebCodecs. Sound is AAC-ELD: FDK AAC in the standalone app; in the browser edition only on macOS. Touch, two-finger pinch, long press, system gestures (drawn for the phone's rotation), hardware buttons, keys and typing go through the CoreDevice HID services.
  • Staying alive: the server repeats unanswered keyframe requests and restarts the stream after three, or after 6 s of silence. The window rebuilds its decoder after a decoding error. Restart stream does the same on request.
  • Lag fixes:
    • Orientation and the new performance figures run on tasks of their own; before, the orientation query blocked the loop that receives the picture.
    • Input runs off that loop (Siri's 1 s hold no longer stalls the picture), and piled-up finger moves are merged.
    • The window draws only the newest frame once per screen refresh.
  • Rotation: getdisplayinfo → status.rotation; the window turns the picture and maps touches back. Rotate is the fallback.
  • iPhone stats: GET /api/screen/perf returns CPU, memory, GPU, the phone's frame rate, battery and temperature (DVT sysmontap and graphics, plus the diagnostics relay). They are shown in Stats with the stream's fps, bitrate and decode delay.
  • UI:
    • Location / Mirroring switch; a minimal side panel; icon buttons with plain labels next to the screen.
    • A phone outline while there is no picture; a small dot cursor that dips on click; a faint swipe trail.
    • Mouse wheel scrolls; Ctrl + wheel or a trackpad pinch zooms.
    • Screenshots and recordings are saved by the app to Downloads or a folder chosen with Browse (the system dialog) in Settings › Mirroring.
  • Lock: longer press (250 ms). Not confirmed.
  • MCP: POST /mcp in both editions (Streamable HTTP, JSON answers), plus --mcp over stdio for apps that start programs (Claude Desktop). There are 31 tools covering location (teleport, drive_route, play_track, playback, joystick, search) and mirroring. They are listed once in ui/mcp-tools.json as calls to the local API, so both editions behave the same. The skill is in agents/skills/idevbench.
  • Docs: docs/API.md (API, WebSocket format, inputs, MCP setup), README, CHANGELOG, Terms and Privacy (AI agents receive screenshots).

Checks

  • cd browser && python -m pytest -q: 148 passed.
  • cd standalone && cargo test --locked: 73 passed, including MCP driving the simulator (connect, teleport, route playing, gestures).
  • cargo check --target x86_64-pc-windows-gnu: clean.
  • Headless Chromium against both editions with the simulator: section switch, phone outline, rotation pixels, cursor press classes, trail, tap/wheel/pinch coordinates, gesture and button messages, Stats, saving to a chosen folder.
  • --mcp bridge (both editions) end to end against a running app.

To check on a real iPhone (iOS 27)

  1. No freezes after Siri or screen recording; if one happens, it recovers within a few seconds.
  2. Touch latency compared with the first build.
  3. The picture turns when the phone does.
  4. Lock.
  5. Ctrl + wheel pinch in Maps or Photos.
  6. Stats shows CPU, RAM, GPU and temperature after a few seconds.
  7. Browse opens the folder dialog on Windows.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV

claude and others added 6 commits November 4, 2026 14:46
…tions)

- More iPhones: extra phones follow the main one. The player still talks to
  one device; every position is also handed to each mirror, which sends it
  from its own coalescing queue (Python: mirrors.py MirrorLink/FanOut, Rust:
  device/mirror.rs), so a slow or lost phone never holds up playback. Lost
  phones are marked until removed; removing one clears its location.
  API: POST /api/mirrors, DELETE /api/mirrors/{udid}, status "mirrors".
  In Rust a mirror connects without the device lock held.
- Connection choice (auto / usb / network) for connect and mirrors, a
  device list that shows USB, Wi-Fi or both, and "Allow Wi-Fi connection"
  (lockdown EnableWifiConnections). Browser edition: a second iOS 17+ phone
  or an iOS 17+ phone over Wi-Fi falls back to tunneld, because
  pymobiledevice3 allows one userspace tunnel per process.
- The Simulator has two phones. Tests in both editions; test notes in
  docs/testing/multiple-iphones-and-wifi.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdn8QS1XrFZScnrMdvK
… (experimental)

Experimental: several iPhones at once and Wi-Fi connections
# Conflicts:
#	browser/spoofer/server.py
Sync feature-testing with dev (offline maps, map menu, developer feature tests)
…eloper tunnel

Both editions get the same /api/mirror routes and WebSocket:
GET /api/mirror, POST /api/mirror/start|stop|input, GET /api/mirror/screenshot,
GET /api/mirror/ws (decoder setup, frames as length-prefixed HEVC, PCM sound,
status JSON; input JSON the other way).

iOS 27+ streams its display through com.apple.coredevice.displayservice as
HEVC over RTP inside the developer tunnel. Frames are reassembled into whole
access units (Apple's 14-byte slice footer removed, frames held back after a
lost packet until the next keyframe) and sent with an hvcC description and
codec string for WebCodecs. Receiver reports keep both streams alive, frames
are acknowledged and keyframes requested for new viewers, after losses and
after 4 s of a still screen. Touch, buttons, keys and typing go through the
CoreDevice HID services, which only accept input while a stream runs.

Standalone: idevice's display_stream support on its own thread and tunnel;
sound decoded from AAC-ELD with FDK AAC (not in MinGW builds, whose headers
clash; the release uses MSVC). The iOS 27 developer image mount now tries the
personalized image instead of refusing.
Browser edition: pymobiledevice3's services (needs 11.63+); sound on macOS
only. Its WebSocket repeats the local-only check, which HTTP middleware skips.

The simulator driver accepts mirroring and input without a screen, for tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
…API docs

A sixth tab (shortcut 6) swaps the map for the iPhone's screen:
- frames decoded with WebCodecs from the hvcC setup the server sends; a
  clear message when the PC can't decode HEVC;
- click to tap, drag to swipe (moves sent once per frame), right-click for
  Home, buttons for Home, Lock, Volume and Siri;
- typing: the picture takes the keyboard while focused (Esc or a click
  outside gives it back), Ctrl maps to the iPhone's Command key; or send a
  line of text;
- sound played through Web Audio with a small jitter cushion;
- screenshots (PNG from the picture) and recordings with sound
  (MediaRecorder: MP4 where supported, else WebM).

docs/API.md documents the local API for other programs: device and location
endpoints, mirroring, inputs and the WebSocket format, with examples.
README, changelog and roadmap describe the feature. THIRD_PARTY_NOTICES lists
FDK AAC with its full licence text in docs/licenses/fdk-aac.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
iphone-spoofer Ready Ready Preview Nov 25, 2026 10:15pm UTC

feature-testing now has "mirrors" (more iPhones that follow the main one's
location, /api/mirrors). To keep the two features apart, especially in the
public API, screen mirroring's server side is renamed: /api/screen,
/api/screen/start|stop|input|screenshot|ws, spoofer/screen.py and
standalone/src/screen. The tab is still called Mirror.

Conflicts: idev::find_device now takes the connection (USB/Wi-Fi); the screen
session asks for Auto. The browser server imports both modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
…tats, save folder; MCP server for AI agents

- Picture freezes: the page now rebuilds its decoder after a decoding error (WebCodecs closes
  it) and on a new stream setup asks for a keyframe (the old code could wait forever); both
  servers repeat unanswered keyframe requests and restart the stream after three, or after 6 s
  of silence; inputs (Siri's 1 s hold, swipes, typing) run on their own task so they no longer
  stall the picture. New "refresh" input restarts it on demand.
- "'x' must be a number" error: a touch move could be sent after the finger lifted.
- Rotation: the phone's display orientation (CoreDevice getdisplayinfo) as status.rotation;
  the page turns the picture and maps touches back. Rotate button as a fallback.
- Screen is its own section (Location / Screen switch); buttons and gestures (app switcher,
  Control Centre, Notification Centre, Back) beside the screen; mouse wheel scrolls; touch dot
  and ripple; Stats overlay (fps, Mbit/s, decode delay, dropped frames, sound buffer).
- Screenshots and recordings saved by the app (POST /api/screen/save) to Downloads or the
  folder chosen in Settings > Screen.
- Lock: longer press (unconfirmed on a device).
- agents/: stdlib MCP server over the local API, and a skill; Terms and Privacy cover it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
# Conflicts:
#	CHANGELOG.md
#	README.md
…tats, pinch, minimal UI; built-in MCP server

- Lag: the standalone app asked the phone for its orientation inside the loop that receives the
  picture and forwards input, so every slow answer stalled both. Orientation and the new
  performance figures now run on tasks of their own; piled-up finger moves are merged, and the
  page draws only the newest frame once per screen refresh.
- Phone stats (GET /api/screen/perf): CPU, memory, GPU, its own frame rate, battery and
  temperature (DVT sysmontap and graphics, diagnostics relay), shown in Stats.
- New inputs in both editions: second finger on touch (pinch), long_press, gesture (drawn for
  the phone's rotation), key press with optional command. Ctrl + wheel pinches.
- UI: the section is called Mirroring; minimal side panel (no typing box or hints), icon
  buttons with plain labels, a phone outline while there is no picture, a small dot cursor that
  dips on click, a faint swipe trail. Settings > Mirroring gets Browse (the system folder dialog).
- "device locked" while mounting the developer image now just says to unlock the phone.
- MCP: /mcp in both editions (and --mcp over stdio for Claude Desktop) with 31 tools covering
  location (routes, tracks, joystick, playback) and mirroring, listed once in ui/mcp-tools.json;
  the stdlib script is gone, the skill is updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
@YK3D YK3D changed the title Screen mirroring, control, sound and recording (Mirror tab) + local API Mirroring section (screen, control, sound, recording, iPhone stats) + local API + built-in MCP server Nov 25, 2026
… iOS version, one-prompt AI agent setup, Claude Code plugin

- Browse: the standalone app opens Windows' own folder dialog in-process (rfd), so it comes
  up in front; the browser edition's PowerShell dialog gets a topmost owner and writes the path
  as UTF-8 bytes (a background process has no console encoding to set).
- Mirroring: an iPhone-style placeholder (Dynamic Island, status bar, a page of app icons, dock)
  until the picture arrives; the phone's name and iOS version above it (new status fields
  device_name and ios, from the session or the chosen device).
- AI agents: Settings > AI agents has one prompt to paste into any agent, generated with this
  app's real address and program; Add to Claude Desktop merges iDevBench into its config
  (Microsoft Store copy included). GET /api/mcp/setup, POST /api/mcp/claude-desktop, both
  editions. The guide is a tool now (ui/mcp-guide.md) and the server's instructions point to
  it, so no skill files to install; it includes the passcode rule (only when the user asks and
  gives it, never stored, one attempt).
- Claude Code plugin in plugins/idevbench with a marketplace at the repository root; passes
  claude plugin validate --strict.
- CHANGELOG: the multi-iPhone and Wi-Fi features ship as experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWYAdk7FBJL1zvtWFNTApV
@YK3D
YK3D changed the base branch from feature-testing to dev November 25, 2026 22:15
@YK3D
YK3D merged commit 6751cf2 into dev Nov 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants