virtual-device-mcp
Controls Android emulators: boots and stops devices, captures screenshots, taps/swipes/pinches, sends key events, installs/launches/stops apps, reads logs, records video, and inspects UI elements via adb and the emulator console.
Controls Apple virtual devices and Mac apps: manages iOS/tvOS/visionOS simulators, captures screenshots, sends touch/key/controller input, installs and launches apps, reads logs, records video, and drives macOS apps through native helpers.
Drives the Apple TV/tvOS simulator using a virtual remote/controller, captures screenshots, presses labelled system elements, launches and stops apps, reads logs, and records video.
Controls iOS simulators: manages devices, captures screenshots, performs taps/swipes/pinches, sends keys and virtual gamepad input, installs/launches/stops apps, reads logs, records video, and interacts with labelled native elements through an XCUITest agent.
Controls apps on the Mac: captures app-window screenshots, sends mouse and keyboard input via CGEvent, reads accessibility elements, launches and stops apps, and records video.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@virtual-device-mcp Take a screenshot on the iOS simulator and tap the Allow button"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Claude (or any MCP client, or a plain script) takes screenshots, touches the screen by position, presses keys and controller buttons, presses system popups by their label, reads logs, records video, and starts and stops the virtual devices itself. Point it at a build and ask it to try the app and report what breaks.
Works with any app. Nothing is added to the app under test: no SDK, no test hooks. Unity games, other engines and ordinary apps are driven the same way.
Five targets, one set of tools. Android emulator, iOS, tvOS and visionOS simulators, and macOS apps.
Positions are fractions of the screenshot, so one script fits every screen size.
System popups by name.
tap_element label=Allowanswers a permission request.Zero dependencies. Node, Xcode and the Android SDK you already have; everything else is in this repository.
Virtual devices only. A real phone on USB is never listed and never touched.
Install
Requirements: macOS, Node 24 or newer, Xcode 27 (for simulators), and the Android SDK (for emulators; found through
ANDROID_HOME or ~/Library/Android/sdk). There are no npm dependencies.
Add it to Claude Code, for every project on this machine:
claude mcp add --scope user virtual-device -- npx -y virtual-device-mcp mcp--scope decides where the server is available:
Scope | Available in | Stored in |
| every project of yours on this machine | your Claude Code user settings |
| only the folder you ran the command in, only for you | your Claude Code user settings, under that folder's path |
| that project, for everyone who checks it out |
|
A virtual-device server is a tool of the machine rather than of one project, so user is the usual choice. Use
project to share it with a team working on the same app.
Any other MCP client: run npx -y virtual-device-mcp mcp as a stdio server.
From a checkout instead of npm:
git clone https://github.com/Bitfaring/virtual-device-mcp.git
claude mcp add --scope user virtual-device -- node /path/to/virtual-device-mcp/src/server.tsPermissions (System Settings > Privacy & Security), for the terminal or app that runs the server:
Accessibility: needed for apps on the Mac and for touches on Apple Vision Pro (both post mouse events).
Screen Recording: needed for screenshots and video of apps on the Mac.
Android emulators and iOS / tvOS simulators need no permission.
The first call on a simulator takes about 30 seconds: the server builds its XCUITest agent with xcodebuild and
starts it. The small native helpers are compiled on first use too. Everything is cached in
~/Library/Caches/VirtualDeviceMCP.
Related MCP server: ios-sim-mcp
Tools
Tool | What it does |
| List the virtual devices and whether they are running |
| Boot / shut down an emulator or simulator |
| The screen (on the Mac: the app's window), scaled to 1280 px on its long edge; |
| Touch a position; |
| Drag one finger from one position to another |
| Two fingers: spread, pinch and / or rotate (Android: anywhere; iOS: around the centre of the screen) |
| Keys and hardware buttons: arrows, enter, back, home; the Apple TV remote |
| Buttons of a virtual game controller on a simulator: d-pad, |
| Type into the focused text field |
| The labelled native elements on screen (system popups, dialogs, ads, native controls) with their positions |
| Press an element by its label, for example |
| Install, start, quit an app |
| Back to first-launch state, so first-run popups show again (deletes the app's data on that device) |
| Recent log lines of the device or of one app, filtered by a regular expression |
| Record a video of the screen (Android: |
| A whole smoke test in one call: reset, launch, press through system popups, run your steps, background and return, scan the log; returns a report with a screenshot per step |
Positions are always fractions of the screenshot: x=0, y=0 is the top left corner, x=1, y=1 the bottom right.
The same script works on any screen size.
tap, swipe, pinch, key, gamepad, tap_element and app_launch take screenshotAfterMs: wait, then return
a screenshot too, so one call both acts and shows the result.
A game that draws its own UI (Unity, for example) has no labelled elements: look at the screenshot and tap by
position. ui_elements and tap_element are for what the system or native toolkits draw.
Example prompts
"Boot an iPhone simulator, install
Build/MyGame.app, launch it, allow notifications, play one round and tell me about any exception in the log.""Run a playtest of
com.example.gameon the Android emulator: tap START, wait 5 seconds, and show me each screen."
Command line
The same tools without an MCP client, for scripts and for trying things by hand:
npx virtual-device-mcp devices
npx virtual-device-mcp app_launch device="Medium_Phone_API_37.0" app=com.example.game
npx virtual-device-mcp tap device=<id> x=0.5 y=0.87 screenshotAfterMs=800 --out after.png
npx virtual-device-mcp tap_element device=<id> label=Allow
npx virtual-device-mcp logs device=<id> app=com.example.game filter="exception|error"
npx virtual-device-mcp playtest device=<id> app=com.example.game \
'steps=[{"tool":"tap","x":0.5,"y":0.87},{"tool":"wait","ms":3000}]' --out report.pngIn a checkout, node src/cli.ts <tool> ... does the same.
How it works
MCP client ──stdio──> virtual-device-mcp (Node, src/)
│
├─ Android emulator ───── adb + emulator (Android SDK tools)
├─ iOS / tvOS / visionOS ─ simctl
│ ├─ agent/ XCUITest agent inside the simulator, HTTP on 127.0.0.1
│ ├─ vdevice-pad virtual game controller (mac/)
│ └─ vdevice-mac clicks on the simulator's display in DeviceHub (mac/)
└─ This Mac ───────────── screencapture + vdevice-mac (CGEvent, Accessibility)All input code is in this repository; no third-party automation tool is used.
Target | Touch | Keys / buttons | Screenshot | Labelled elements |
Android emulator |
|
|
|
|
iOS simulator | XCUITest agent |
|
| XCUITest agent |
tvOS simulator | no touch screen | virtual controller (the remote); |
| XCUITest agent (press with the remote) |
visionOS simulator | click on the display in DeviceHub | virtual controller |
| XCUITest agent |
This Mac |
|
|
| Accessibility tree |
Apple simulators need three mechanisms, because none covers everything:
The XCUITest agent (public API). A UI test that never finishes: it serves commands over HTTP on
127.0.0.1. It touches the screen on iOS, presses system popups by label and reads labelled elements. The server builds it once per platform, keeps it running between calls and restarts it when it stops.A virtual game controller (
vdevice-pad). It creates aGCExtendedGamepadand forwards its state into the simulator throughSimulatorKit, the way Xcode forwards a controller connected to the Mac. Apple TV needs it: a Unity game reads the remote as a controller and ignoresXCUIRemote, keyboard keys and DeviceHub's remote buttons, which only drive tvOS's own UI.SimulatorKitis a private Xcode framework, so this part may need changes for a new Xcode.DeviceHub (
vdevice-mac hub). On visionOS, XCUITest cannot touch a window without an accessibility scene (a Unity game). The helper finds the simulator's display in the DeviceHub window through Accessibility and clicks there; a click is a look-and-pinch at that spot.
Node 24+ runs the TypeScript sources directly. The npm package ships dist/ (the sources with types stripped,
because Node does not run .ts inside node_modules), agent/ and mac/.
What has been verified
Run on 2026-11-28 with a Unity 6 game (Brick Race), Xcode 27.2, through the command line.
Android emulator | iOS simulator | tvOS simulator | visionOS simulator | This Mac | |
List, start, stop devices | pass | pass | pass | pass | n/a |
Screenshot | pass | pass | pass | pass (whole room) | pass |
Tap, long press | pass | pass | no touch | pass | pass |
Swipe | pass | pass | no touch | runs, effect not checked | runs, effect not checked |
Two fingers ( | pass | runs, effect not checked | no touch | not available | not available |
Keys | pass |
| pass (remote) | d-pad: pass | pass |
Virtual controller ( | not available | runs, effect not checked | pass | pass in game | not available |
System popup by label | pass | pass | not tried | not tried | not tried |
Labelled elements | pass | pass | pass | pass | pass (Calculator) |
Type text | pass | pass | not tried | not tried | not tried |
Install, launch, stop, reset | pass | pass | launch, reset: pass | install, launch, reset: pass | launch, stop, reset: pass |
Logs | pass | pass | pass | pass | pass |
Record video | file written, not viewed | pass | pass | file written, not viewed | pass |
A full round played by a screenshot-reading bot | pass | pass | pass | pass | not tried |
| pass | pass | not tried | not tried | not tried |
Known limits
visionOS touches take over the DeviceHub window. DeviceHub has to be open and is brought to the front for each touch; it ignores pointer events while another app is in front. Two booted simulators with the same name are refused, because DeviceHub lists them by name only.
Two-finger gestures on iOS happen at the centre of the screen, because XCUITest only offers them on elements. They are not available on visionOS or the Mac.
A game's own popup may ignore the controller. On visionOS, one Unity UI popup did not react to the virtual controller while the game behind it did;
tapworked.The virtual controller uses a private Xcode framework (
SimulatorKit) and was only run with Xcode 27.2.Injecting touches through that private framework was tried and dropped: the events did not reach the app, and a wrong value restarted the simulator's
backboardd. It is used for the controller only.Each call takes 0.3 to 2 seconds (Android taps are fastest, controller presses slowest), so this is for turn-based driving and slow games, not for fast real-time play.
Development
npm test # unit tests and an MCP protocol test over stdio
npm run build # writes dist/ (no dependencies needed)
npm pack # builds and creates the package tarballThe backends need real virtual devices, so they are exercised through src/cli.ts.
Releasing
Publishing a GitHub release publishes that version to npm (.github/workflows/publish.yml, through npm trusted
publishing, so no token is stored anywhere):
npm version patch # or minor / major: bumps package.json, commits and tags vX.Y.Z
git push origin main --follow-tags
gh release create "v$(node -p "require('./package.json').version")" --generate-notesLicense
MIT. See LICENSE.
Available Tools
20 toolsapp_installB
Install a build on the device: an .apk on Android, an .app bundle built for the simulator on Apple platforms.
Inputs: path (required), device (required).
app_launchC
Start an app (on "mac": a bundle identifier or the path of an .app).
Inputs: app (required), device (required), screenshotAfterMs.
app_resetA
Put an app back in first-launch state: its saved data and, on simulators, its permission answers are removed, so first-run popups show again. This deletes the app's data on that device.
Inputs: app (required), device (required).
app_stopC
Force an app to quit.
Inputs: app (required), device (required).
devicesA
List the virtual devices Virtual Device MCP can drive: Android emulators (AVDs), iOS / tvOS / visionOS simulators and this Mac. Real phones are never listed.
Inputs: running.
device_startA
Boot an emulator or simulator and wait until it is ready. Simulators boot without a window.
Inputs: device (required).
device_stopA
Shut an emulator or simulator down (and stop Virtual Device MCP's agent on it).
Inputs: device (required).
gamepadA
Press buttons on a virtual game controller connected to a simulator (iOS, tvOS, visionOS). For games that take a controller. Buttons: up, down, left, right (d-pad), a, b, x, y, menu, options, l1, r1, l2, r2. Several buttons are pressed one after another.
Inputs: device (required), buttons (required), holdMs, screenshotAfterMs.
keyA
Press a key or hardware button. Android: up, down, left, right, select, enter, escape, back, home, menu, space, letters, digits. Apple TV (the remote): up, down, left, right, select, menu, playpause, home. iOS: home. Apple Vision Pro: up, down, left, right. mac: arrows, enter, escape, space, tab, letters, digits.
Inputs: key (required), device (required), app, times, +1 more.
logsA
Read recent log lines of the device, or of one app. Use filter to keep only matching lines, for example "exception|error".
Inputs: device (required), app, lines, filter, +1 more.
pinchA
A two-finger gesture: spread the fingers apart (scale above 1, zooms in), pinch them together (scale below 1) and / or turn them (rotateDeg). Android emulators: around any position. iOS simulators: around the centre of the screen only.
Inputs: device (required), x, y, app, +4 more.
playtestA
Run a standard smoke test of an app in one call and return a report with screenshots: (optionally install and) reset it to first-launch state, launch it, press through system popups, run your steps, send it to the background and bring it back, then scan its log for exceptions and crashes. Steps are other tools' calls, for example {"tool":"tap","x":0.5,"y":0.87} or {"tool":"wait","ms":3000}; a screenshot is taken after each.
Inputs: app (required), device (required), path, fresh, +6 more.
record_startA
Start recording a video of the device screen (on "mac": of the app's window where it is now). One recording per device; finish it with record_stop.
Inputs: device (required), app, path.
record_stopA
Stop the recording started by record_start and return the path of the finished video.
Inputs: device (required).
screenshotA
Take a screenshot of the device (on "mac": of the app's window). Positions for tap and swipe are fractions of this image.
Inputs: device (required), app, maxSize.
swipeB
Drag one finger from one position to another (a mouse drag on "mac").
Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +4 more.
tapA
Touch the screen at a position (a click on "mac", a look-and-pinch on Apple Vision Pro, sent through the DeviceHub window). Works on anything in front: the game, an ad, a system popup. Not available on Apple TV, which has no touch screen: use key there.
Inputs: x (required), y (required), device (required), app, +2 more.
tap_elementA
Tap a native element by its label, for example "Allow" on a permission popup. Looks in the system UI first, then in the app.
Inputs: label (required), device (required), app, screenshotAfterMs.
type_textB
Type text into the focused text field.
Inputs: text (required), device (required), app.
ui_elementsA
List the labelled native elements on screen with their positions: system popups (permission requests, alerts), native dialogs and ads. A game that draws its own UI shows nothing here: use screenshot for it.
Inputs: device (required), app.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool targets a distinct resource+action: device lifecycle (devices, device_start, device_stop), app lifecycle (app_install, app_launch, app_stop, app_reset), input primitives (tap, swipe, pinch, key, gamepad, type_text), and observation (screenshot, ui_elements, logs). The near-pairs are clearly separated by descriptions: tap (coordinates) vs tap_element (label), ui_elements (native labels) vs screenshot (rendered pixels), and playtest (one-call orchestration) vs issuing individual tool calls. No two tools appear to do the same thing.
Compound tools follow a readable resource_action pattern (app_install, app_reset, device_start, record_stop, tap_element), but a large share of the surface uses bare single words (tap, swipe, pinch, key, gamepad, screenshot, playtest, logs) and even plural nouns (devices, logs, ui_elements) alongside singular action names (device_start). It is still readable and each name hints at its purpose, but there is no single predictable convention across the set.
Twenty tools is slightly above the ideal band but each one maps to a genuinely distinct device capability: lifecycle for devices and apps, six input primitives that differ by platform/gesture type, three observation tools, two recording tools, and one composite playtest. Nothing looks redundant or padded, though the surface could be trimmed by folding some primitives together (e.g. key vs gamepad).
Coverage is strong for driving and testing an app on a virtual device: discover/boot/shutdown devices, install/launch/stop/reset apps, all major input modalities, screenshots, native UI inspection, logs, screen recording, and an end-to-end smoke-test helper. Gaps remain at the edges — no uninstall, no device/AVD creation, no orientation or rotation control, no clipboard/location/network-condition tools — but agents can work around most of these.
Maintenance
Related MCP Connectors
Cloud iOS simulators and Android emulators your agent can create, drive, and throw away.
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Cloud Android devices for AI agents: install an APK, read the screen, tap, type, read logcat.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to automate Android and iOS devices, including emulators and physical devices, by capturing screenshots, reading UI accessibility trees, performing touch and text input, and managing app lifecycle and logs.184MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to drive iOS Simulators on macOS by listing devices, launching apps, tapping, typing, swiping, inspecting the UI tree, and taking screenshots.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to control Android emulators and iOS Simulators with fast screenshots, UI tree reads, taps, typing, logs, crash reports, test capabilities, and resets for efficient build-run-check loops.13MIT
- AlicenseBqualityCmaintenanceEnables AI agents to inspect and control React Native apps running in iOS simulators or Android emulators, including screenshots, UI hierarchy, interactions, console logs, and JavaScript execution.169 npm4MIT