Skip to main content
Glama

IN PROGRESS

vphone-mcp

v1.0.0 Test Coverage Tests

vphone-mcp is a professional Model Context Protocol (MCP) server designed for controlling vPhone virtual iOS devices. It provides a comprehensive set of tools for LLMs to interact with virtual iOS environments, including hardware control, location simulation, filesystem management, and application installation.

๐Ÿ—๏ธ Architecture

The project implements a robust Python-Swift bridge architecture:

  • MCP Layer: Built with fastmcp in Python 3.13+, exposing high-level tools to MCP clients.

  • Communication: Uses a high-performance Unix Domain Socket (UDS) bridge for low-latency communication.

  • Bridge Client: A Python client (src/vphone_mcp/bridge/client.py) that communicates with the vphone-cli (Swift) daemon.

  • Protocol: A custom binary-framed JSON protocol (src/vphone_mcp/bridge/protocol.py) ensures reliable message delivery and state management.

Related MCP server: Simulator MCP

๐Ÿ›ก๏ธ Security Features

Security is a core pillar of vphone-mcp, implementing multiple layers of protection:

  • API Token Authentication: All connections require a valid VPHONE_API_TOKEN. Tokens are used for HMAC-SHA256 signing of sensitive operations.

  • Strict Path Validation: Filesystem operations are restricted to a whitelist of allowed directories (e.g., /var/mobile/Documents, /var/tmp) and protected against path traversal and symlink escape attacks.

  • Two-Step Confirmations: Destructive or sensitive operations (deletion, renaming, IPA installation) follow a Preview-Confirm pattern. The preview step returns a short-lived (5-minute), single-use HMAC-signed token that must be provided to execute the final action.

๐Ÿš€ Installation Guide

Prerequisites

  • Python 3.13 or higher

  • uv package manager

  • vphone-cli (Swift) daemon running on the host

Setup

  1. Clone the repository:

    git clone https://github.com/Lumysia/vphone-mcp.git
    cd vphone-mcp
  2. Configure Environment Variables: Set the following environment variables in your shell or a .env file:

    export VPHONE_API_TOKEN="your-secure-api-token"
    export VPHONE_BRIDGE_SOCKET="/tmp/vphone_bridge.sock" # Default path
    export VPHONE_LOG_LEVEL="INFO" # DEBUG, INFO, WARNING, ERROR
  3. Run the Server:

    uv run vphone-mcp

๐Ÿ› ๏ธ MCP Tool Reference

The server exposes 26 tools categorized for efficient device management:

Connection & Status

Tool

Description

vphone_connect

Connect to the vphone bridge and perform handshake.

vphone_disconnect

Disconnect from the bridge and clean up resources.

vphone_status

Get the current connection state (connected, disconnected, etc.).

vphone_ping

Measure round-trip latency to the bridge.

vphone_version

Retrieve protocol version and supported features.

Hardware & HID Control

Tool

Description

vphone_hid_press

Simulate a complete button press (down then up).

vphone_hid_down

Press and hold a HID button.

vphone_hid_up

Release a previously held HID button.

vphone_home

Simulate pressing the Home button.

vphone_power

Simulate pressing the Power button (sleep/wake/power dialog).

vphone_volume_up

Simulate pressing the Volume Up button.

vphone_volume_down

Simulate pressing the Volume Down button.

Location Simulation

Tool

Description

vphone_set_location

Set simulated GPS coordinates (lat, lon, alt, speed, course).

vphone_stop_location

Stop location simulation and revert to real GPS.

Filesystem Management

Tool

Description

vphone_file_list

List directory contents with metadata.

vphone_file_download

Download file content (base64/hex) or metadata.

vphone_file_upload

Upload file content to the device (no overwrite).

vphone_file_mkdir

Create a directory (optionally with parents).

vphone_file_delete_preview

(Secure) Preview deletion and get a confirmation token.

vphone_file_delete_confirm

(Secure) Execute deletion using a valid preview token.

vphone_file_rename_preview

(Secure) Preview rename/move and get a confirmation token.

vphone_file_rename_confirm

(Secure) Execute rename/move using a valid preview token.

Developer Mode & Apps

Tool

Description

vphone_devmode_status

Query the current developer mode status on the guest.

vphone_devmode_enable

Arm developer mode (requires a device reboot).

vphone_ipa_install_preview

(Secure) Validate an IPA and get an installation token.

vphone_ipa_install_confirm

(Secure) Execute IPA installation using a valid token.

๐Ÿ–ฅ๏ธ Client Configuration

To integrate vphone-mcp with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "vphone": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/vphone-mcp",
        "run",
        "vphone-mcp"
      ],
      "env": {
        "VPHONE_API_TOKEN": "your-secure-api-token",
        "VPHONE_BRIDGE_SOCKET": "/tmp/vphone_bridge.sock",
        "VPHONE_LOG_LEVEL": "INFO"
      }
    }
  }
}

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Available Tools

26 tools
vphone_connectA

Connect to the vphone bridge.

Establishes a connection to the bridge daemon and performs handshake. Returns bridge capabilities and protocol version.

The connection uses authentication via VPHONE_API_TOKEN environment variable if set. The token is sent as a Bearer token in the handshake.

Inputs: timeout. Returns: Output from establishing connection to vphone bridge.

vphone_devmode_enableA

Arm developer mode on the guest device.

Arms developer mode which will be activated after the next reboot. This does not immediately enable developer mode - the device must be restarted for the change to take effect.

Returns: DevModeEnableOutput with success status and message

Raises: NotConnectedError: If not connected to bridge ConnectionUnavailableError: If bridge is reconnecting VPhoneError: If developer mode arm fails

Inputs: no named parameters. Returns: Output from developer mode enable action.

vphone_devmode_statusA

Query the current developer mode status on the guest.

Returns the current state of developer mode on the iOS guest. Developer mode is required for certain development operations.

Returns: DevModeStatusOutput with enabled status

Raises: NotConnectedError: If not connected to bridge ConnectionUnavailableError: If bridge is reconnecting

Inputs: no named parameters. Returns: Output from developer mode status query.

vphone_disconnectA

Disconnect from the vphone bridge.

Closes the UDS connection and transitions to DISCONNECTED state. All in-flight requests are cancelled with CONNECTION_LOST error.

Inputs: no named parameters. Returns: Output from querying current connection status.

vphone_file_delete_confirmA

Execute file deletion.

Executes the deletion after validating the preview token. The token must be valid, not expired, and match the path exactly.

Args: path: Absolute path to delete. preview_token: Token returned by vphone_file_delete_preview. confirm: Must be True to execute deletion.

Returns: FileDeleteConfirmOutput with deletion results.

Raises: PathSecurityError: If path validation fails. VPhoneError: If preview token is invalid or expired. NotConnectedError: If not connected to bridge.

Inputs: path (required), preview_token (required), confirm. Returns: Output from confirmed file deletion.

vphone_file_delete_previewA

Preview file deletion.

Generates a preview of what would be deleted. Returns a token that must be used to confirm the deletion within 5 minutes.

Args: path: Absolute path to delete (file or directory).

Returns: FileDeletePreviewOutput with preview token and would_delete list.

Raises: PathSecurityError: If path validation fails. FileNotFoundError: If path does not exist. NotConnectedError: If not connected to bridge.

Inputs: path (required). Returns: Output from deletion preview.

vphone_file_downloadA

Download file content or metadata.

Downloads a file from the device. Can retrieve just metadata or the full content. Content is returned encoded as base64 or hex.

Args: path: Absolute file path to download. encoding: Content encoding ("base64" or "hex"). include_content: If True, include file content in response. max_size_mb: Maximum file size to download in megabytes. follow_symlinks: If True, follow symlinks (blocked by default). offset: Start offset for partial reads. length: Number of bytes to read (0 = entire file).

Returns: FileGetOutput with metadata and optionally content.

Raises: PathSecurityError: If path validation fails or symlink detected. FileNotFoundError: If file does not exist. NotConnectedError: If not connected to bridge.

Inputs: path (required), length, offset, encoding, +3 more. Returns: Output from downloading a file.

vphone_file_listA

List directory contents.

Lists files and directories in the specified path. The path must be within an allowed directory (/var/mobile/Documents, /var/mobile/Media/DCIM, /var/mobile/Media/Pictures, or /var/tmp).

Args: path: Absolute directory path to list. recursive: If True, list contents recursively.

Returns: FileListOutput with list of FileInfo entries.

Raises: PathSecurityError: If path validation fails. NotConnectedError: If not connected to bridge.

Inputs: path (required), recursive. Returns: Output from listing directory contents.

vphone_file_mkdirA

Create a directory.

Creates a directory at the specified path. Optionally creates parent directories and/or ignores existing directories.

Args: path: Absolute directory path to create. parents: If True, create parent directories as needed. exist_ok: If True, don't error if directory exists.

Returns: FileMkdirOutput with path and creation status.

Raises: PathSecurityError: If path validation fails. NotConnectedError: If not connected to bridge.

Inputs: path (required), parents, exist_ok. Returns: Output from directory creation.

vphone_file_rename_confirmA

Execute file rename/move operation.

Executes the rename after validating the preview token. The token must be valid, not expired, and match both paths exactly.

Args: old_path: Current path of file or directory. new_path: New path for file or directory. preview_token: Token returned by vphone_file_rename_preview. confirm: Must be True to execute rename.

Returns: FileRenameConfirmOutput with rename results.

Raises: PathSecurityError: If either path validation fails. VPhoneError: If preview token is invalid or expired. NotConnectedError: If not connected to bridge.

Inputs: new_path (required), old_path (required), preview_token (required), confirm. Returns: Output from confirmed rename operation.

vphone_file_rename_previewA

Preview file rename/move operation.

Generates a preview of the rename operation. Returns a token that must be used to confirm the rename within 5 minutes.

Args: old_path: Current path of file or directory. new_path: New path for file or directory.

Returns: FileRenamePreviewOutput with preview token and overwrite status.

Raises: PathSecurityError: If either path validation fails. FileNotFoundError: If old_path does not exist. NotConnectedError: If not connected to bridge.

Inputs: new_path (required), old_path (required). Returns: Output from rename preview.

vphone_file_uploadA

Upload file content (no overwrite).

Uploads a file to the device. Fails if the file already exists. The path must be within an allowed directory.

Args: path: Absolute destination file path. data: File content encoded as base64 or hex. encoding: Content encoding ("base64" or "hex"). permissions: Unix file permissions (e.g., "644").

Returns: FilePutOutput with path and size.

Raises: PathSecurityError: If path validation fails. FileExistsError: If file already exists. NotConnectedError: If not connected to bridge.

Inputs: data (required), path (required), encoding, permissions. Returns: Output from file upload.

vphone_hid_downA

Press and hold a HID button.

Sends a HID button down event. The button remains pressed until vphone_hid_up is called with the same page and usage.

Args: page: HID usage page (e.g., 0x0C for Consumer page) usage: HID usage code within the page

Returns: HIDKeyOutput with success status

Inputs: page (required), usage (required). Returns: Output from HID key down or up event.

vphone_hid_pressA

Press and release a HID button.

Sends a HID button press and release event. This is a complete press cycle (down then up) in a single operation.

Args: page: HID usage page (e.g., 0x0C for Consumer page) usage: HID usage code within the page

Returns: HIDPressOutput with success status

Inputs: page (required), usage (required). Returns: Output from HID button press operation.

vphone_hid_upA

Release a held HID button.

Sends a HID button up event. Releases a button that was previously pressed with vphone_hid_down.

Args: page: HID usage page (e.g., 0x0C for Consumer page) usage: HID usage code within the page

Returns: HIDKeyOutput with success status

Inputs: page (required), usage (required). Returns: Output from HID key down or up event.

vphone_homeA

Press the Home button.

Simulates pressing the home button on the device. Equivalent to vphone_hid_press(HIDPage.CONSUMER, HIDUsage.HOME).

Inputs: no named parameters. Returns: Output from home button press convenience tool.

vphone_ipa_install_confirmA

Execute an IPA installation after preview confirmation.

Installs the IPA file that was previously previewed. The preview token must be valid, not expired, and match the IPA path exactly.

Args: ipa_path: Absolute path to the IPA file on the guest filesystem. preview_token: Token returned by vphone_ipa_install_preview.

Returns: IPAInstallConfirmOutput with installation result and app details

Raises: PathSecurityError: If path validation fails VPhoneError: If preview token is invalid or installation fails NotConnectedError: If not connected to bridge

Inputs: ipa_path (required), preview_token (required). Returns: Output from confirmed IPA installation.

vphone_ipa_install_previewA

Preview an IPA installation.

Validates the IPA file and returns installation preview information. The preview token must be used to confirm the installation within 5 minutes.

Args: ipa_path: Absolute path to the IPA file on the guest filesystem. Must be within an allowed directory. registration: Registration type for the app - "User" or "System". User registration installs for the current user. System registration installs for all users.

Returns: IPAInstallPreviewOutput with preview token and app information

Raises: PathSecurityError: If path validation fails FileNotFoundError: If IPA file does not exist VPhoneError: If registration type is invalid NotConnectedError: If not connected to bridge

Inputs: ipa_path (required), registration. Returns: Output from IPA installation preview.

vphone_pingA

Ping the bridge to check connectivity.

Sends a ping message and measures round-trip latency. Requires an active connection.

Raises: NotConnectedError: If not connected to bridge ConnectionUnavailableError: If bridge is reconnecting

Inputs: no named parameters. Returns: Output from health check to guest.

vphone_powerA

Press the Power button.

Simulates pressing the power button on the device. Short press: sleep/wake. Long press: power dialog. Equivalent to vphone_hid_press(HIDPage.CONSUMER, HIDUsage.POWER).

Inputs: no named parameters. Returns: Output from power button press convenience tool.

vphone_set_locationB

Set the simulated GPS location of the device.

Simulates a complete GPS location fix with all standard Core Location parameters. The device will report this location to all apps requesting location services.

Args: latitude: Latitude in degrees (-90.0 to 90.0) longitude: Longitude in degrees (-180.0 to 180.0) altitude: Altitude in meters (default: 0.0) horizontal_accuracy: Horizontal accuracy in meters (default: 5.0) vertical_accuracy: Vertical accuracy in meters (default: 5.0) speed: Speed in meters per second (default: 0.0) course: Direction of travel in degrees, 0=north, 90=east (default: 0.0) timestamp: Unix timestamp for the location fix (default: current time)

Returns: SetLocationOutput with success status and confirmed coordinates

Raises: NotConnectedError: If not connected to bridge ConnectionUnavailableError: If bridge is reconnecting

Inputs: latitude (required), longitude (required), speed, course, +4 more. Returns: Output from location simulation.

vphone_statusA

Get the current connection status.

Returns the current state of the bridge connection without sending any messages to the bridge. This queries the internal state machine.

States:

  • disconnected: No active connection

  • connecting: Connection in progress

  • connected: Active connection ready for requests

  • reconnecting: Connection lost, attempting recovery

  • error: Connection failed

Inputs: no named parameters. Returns: Output from querying current connection status.

vphone_stop_locationA

Stop location simulation.

Resets the device location to real GPS.

Inputs: no named parameters. Returns: Output from stopping location simulation.

vphone_versionA

Get the bridge version information.

Returns protocol version and supported features. Requires an active connection.

Raises: NotConnectedError: If not connected to bridge ConnectionUnavailableError: If bridge is reconnecting

Inputs: no named parameters. Returns: Output from querying guest daemon version.

vphone_volume_downA

Press the Volume Down button.

Simulates pressing the volume down button on the device. Equivalent to vphone_hid_press(HIDPage.CONSUMER, HIDUsage.VOLUME_DOWN).

Inputs: no named parameters. Returns: Output from volume button press convenience tool.

vphone_volume_upA

Press the Volume Up button.

Simulates pressing the volume up button on the device. Equivalent to vphone_hid_press(HIDPage.CONSUMER, HIDUsage.VOLUME_UP).

Inputs: no named parameters. Returns: Output from volume button press convenience tool.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.7/5.0

    Scored across 26 tools

    Disambiguation4/5

    Each tool targets a distinct resource/action, and preview/confirm pairs are clearly separated with explicit token requirements. The main overlap is that vphone_power, vphone_volume_up/down, and vphone_home are convenience wrappers explicitly documented as equivalent to vphone_hid_press, so an agent may hesitate between the specific button and the generic HID tool, but descriptions resolve this.

    Naming Consistency5/5

    All tools use snake_case with a uniform vphone_ prefix and a consistent resource_action pattern (vphone_file_list, vphone_ipa_install_preview, vphone_hid_press). Domain groupings (file_, ipa_, devmode_, hid_) are consistently applied.

    Tool Count3/5

    At 26 tools this is on the heavy side. Several are arguably redundantโ€”power/volume/home duplicate hid_press, and five connection tools (connect, disconnect, status, ping, version) plus preview/confirm duos inflate the surface beyond what's strictly needed.

    Completeness4/5

    File lifecycle (list, download, upload, mkdir, delete, rename) is well covered, and location/HID/connection/IPA/devmode areas have their core operations. Minor gaps exist: no in-place file update or overwrite (upload fails if file exists), no file copy, and no IPA uninstall or devmode disable, though these are workaround-able.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers