Skip to main content
Glama
README.md
# mcp-ios

[![CI](https://github.com/dockndevai/mcp-ios/actions/workflows/ci.yml/badge.svg)](https://github.com/dockndevai/mcp-ios/actions/workflows/ci.yml)
[![CodeQL](https://github.com/dockndevai/mcp-ios/actions/workflows/codeql.yml/badge.svg)](https://github.com/dockndevai/mcp-ios/actions/workflows/codeql.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![npm](https://img.shields.io/npm/v/@dockndevai/mcp-ios)](https://www.npmjs.com/package/@dockndevai/mcp-ios)

A [Model Context Protocol](https://modelcontextprotocol.io) server to drive an **iPhone/iPad** — the iOS counterpart to `mcp-android`. **Read this first: iOS is fundamentally more locked down than Android or macOS**, so this server takes the only legitimate route to real UI control.

## The honest landscape

A stock iPhone does **not** allow a background app to see and control other apps the way Android's Accessibility service (or macOS) does. Apple's sandbox forbids it. So there is **no on-device "iOS-use" agent** like the Mac/Android ones. The viable routes, in order of capability:

| Route | Control level | Needs | Notes |
| --- | --- | --- | --- |
| **Appium + WebDriverAgent (XCUITest)** ✅ *(this server)* | Full UI: tap, type, swipe, read elements, screenshots, launch apps | A **Mac** with Xcode; iPhone connected by **USB** (or same-network); WDA signed to the device | The real "phone-use". Built for automation/QA — perfect for a personal agent on your own device. |
| **Shortcuts** | Run user-defined actions (set alarm, send message, toggles) | Shortcuts app; a URL/x-callback bridge | No arbitrary UI control, but great for safe, specific actions. Exposed here via `run_shortcut`. |
| **MDM** | Policy/config, app install | Enrollment | Device management, not interactive control. |

This server implements the **Appium/WDA** route: it runs on a Mac, talks to a local Appium server driving WebDriverAgent on the tethered iPhone, and exposes the same safe-by-default MCP shape as the rest of the suite. A `set_alarm`-style action can also go through **Shortcuts** (`run_shortcut`) when the device isn't tethered.

> If you want control *from the phone itself with nothing attached*, that isn't possible on iOS — use `mcp-android` on the Fold 7 for that experience, or the Shortcuts subset here.

## Setup (Appium route)

```bash
brew install node
npm i -g appium
appium driver install xcuitest
# Xcode + command line tools installed; sign WebDriverAgent to your device once (Xcode)
# Connect the iPhone by USB, Trust the Mac, enable Developer Mode on the device
appium        # starts the Appium server (default http://127.0.0.1:4723)
```

The server creates the XCUITest session **lazily** on the first tool call, so it starts even before Appium or the device are up — the first call that needs the device returns a clear "start `appium` / sign WDA / connect the device" message if it can't connect.

## Security model

| Concern | Flag | Default | Effect |
| --- | --- | --- | --- |
| What can the server do? | `IOS_MODE` | `read-only` | `read-only` exposes inspection only; `read-write` adds UI control; `admin` adds app management. Tools above the mode are **never registered**. |
| Which apps are in scope? | `IOS_APP_ALLOWLIST` | *(all)* | When set, launching/managing any other bundle ID is refused. `install_app` checks the bundle ID read from the `.ipa`/`.app` (before the approval prompt, also in dry-run) and refuses a bundle whose ID cannot be read. `open_url` and `run_shortcut` count as launching the stock app that handles them (Safari for http(s), Phone for `tel:`, Mail for `mailto:`, FaceTime, Maps, and `com.apple.shortcuts`), so those must be allowlisted too; an `IOS_EXTRA_URL_SCHEMES` scheme (handler unknown) is refused while an allowlist is set. |
| Which apps are read-only forever? | `IOS_PROTECTED_APPS` | `com.apple.Preferences`, `com.apple.springboard` | Inspectable/launchable but never terminated, reset, or uninstalled. `install_app` counts as replacing the app: a bundle whose ID is protected is refused, and so is one whose ID cannot be read (the protected list is non-empty by default). |
| Which URLs can `open_url` open? | `IOS_EXTRA_URL_SCHEMES` | *(none)* | Only `http`, `https`, `tel`, `mailto`, `facetime` and `maps` URLs are opened; other schemes (`shortcuts:`, `prefs:`/`App-Prefs:`, `itms-services:`, custom app schemes, ...) are refused, as are URLs containing control characters. Comma-separated list adds more. The check runs before the dry-run branch. |
| Can it install/terminate/reset apps? | `IOS_ALLOW_MANAGE` | `false` | The admin tools need this **and** admin mode; otherwise they aren't even advertised. |
| Interactive confirmation | *(automatic)* | — | `install_app`, `terminate_app` and `reset_app` prompt the human to approve via MCP elicitation before running. The prompt shows the tool, the exact arguments and a fingerprint; for `install_app` also the bundle path, the bundle ID/version read from it, the device, and whether it replaces an installed app. The target's version (the app's installed version, or the `.ipa`/`.app` file's size + mtime + inode) and the device are pinned across the prompt and the action is refused if they changed; a prompt nobody answers is a refusal. `IOS_DRY_RUN` returns before the prompt. |
| Require a human | `IOS_REQUIRE_HUMAN_APPROVAL` | `false` | When `true`, `install_app` / `terminate_app` / `reset_app` are **refused** if the client cannot elicit (instead of falling back to the `IOS_ALLOW_MANAGE` gate alone). |
| Preview without touching the device | `IOS_DRY_RUN` | `false` | Write/admin tools validate + log intent, then return. |
| Audit trail | `IOS_AUDIT_LOG` | `true` | Emits a JSON line to stderr per guarded operation. |

Connection: `IOS_APPIUM_URL` (default `http://127.0.0.1:4723`), `IOS_UDID` (target device), `IOS_BUNDLE_ID` (optional default app). See [`.env.example`](.env.example) for all variables and [docs/CLIENTS.md](docs/CLIENTS.md) for the full per-client install guide.

## Tools

**Read** (`read-only`+): `list_targets`, `device_info`, `screenshot`, `page_source` (element tree), `current_app`, `list_apps`

**Write** (`read-write`+): `tap`, `swipe`, `input_text`, `press_button` (home/volume), `launch_app`, `open_url`, `run_shortcut` (via Shortcuts)

**Admin** (`admin` + `IOS_ALLOW_MANAGE`): `install_app`, `terminate_app`, `reset_app` (all three confirm via elicitation; `install_app` takes a local `.ipa`/`.app` path only, not a URL; protected apps refused for terminate/reset)

Every tool also advertises MCP **tool annotations** (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so hosts can decide what to auto-approve.

`screenshot` returns an MCP image content block so the agent can see the screen before acting.

## Quickstart — add to your agent

Published on npm as [`@dockndevai/mcp-ios`](https://www.npmjs.com/package/@dockndevai/mcp-ios). No clone or build needed — your MCP client runs it on demand with `npx`. It must run **on the Mac** with a running Appium server. **Start in `read-only` mode.**

**Claude Code** (CLI)

```bash
claude mcp add ios -e IOS_APPIUM_URL="http://127.0.0.1:4723" -e IOS_MODE="read-only" -- npx -y @dockndevai/mcp-ios
```

**Claude Desktop · Cursor · Windsurf** — same block in `claude_desktop_config.json`, `.cursor/mcp.json`, or `~/.codeium/windsurf/mcp_config.json`:

```json
{
  "mcpServers": {
    "ios": {
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-ios"
      ],
      "env": {
        "IOS_APPIUM_URL": "http://127.0.0.1:4723",
        "IOS_MODE": "read-only"
      }
    }
  }
}
```

**VS Code (GitHub Copilot, Agent mode)** — in `.vscode/mcp.json`:

```json
{
  "servers": {
    "ios": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dockndevai/mcp-ios"
      ],
      "env": {
        "IOS_APPIUM_URL": "http://127.0.0.1:4723",
        "IOS_MODE": "read-only"
      }
    }
  }
}
```

## Example prompts

- *"Take a screenshot of my phone and tell me what's on screen."*
- *"Open Safari and go to news.ycombinator.com."* (needs `read-write`)
- *"Run my 'Good morning' Shortcut."* (needs `read-write`)

## Run from source (development)

```bash
npm install
npm run build
node dist/index.js   # with the environment variables set, and `appium` running
```

## Develop

```bash
npm run dev
npm test          # security policy + elicitation confirmation (pure; no device needed)
npm run typecheck
```

> The policy and elicitation tests are pure and run anywhere. The device-driving path can't be smoke-tested without a Mac + Xcode + signed WDA + a tethered iPhone, so it's built against your real device setup.

## Publishing

This server ships a [`server.json`](server.json) for the official MCP registry and an [`mcpName`](package.json) for npm ownership validation. See **[PUBLISHING.md](PUBLISHING.md)** for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.

## License

MIT

TDQS

B3.4/5.0

Scored across 6 tools

Disambiguation4/5

Each tool targets a distinct slice of device state: element tree, foreground app, installed apps, Appium config, device capabilities, and pixels. The main overlap is between device_info and list_targets, both of which report device/connection details, but the descriptions draw a reasonable line. page_source vs screenshot are both 'screen state' but clearly differentiated by format and use case.

Naming Consistency4/5

All names are snake_case and read as noun phrases describing the returned data (page_source, current_app, list_apps, list_targets, device_info, screenshot). There is no verb_noun action pattern, but the style is uniform and predictable. The lone bare noun 'screenshot' is a minor deviation.

Tool Count3/5

Six tools is on the thin side for an iOS automation server, and the set is entirely read-only inspection with no interaction verbs. The count is internally coherent but leaves the surface feeling under-built for its apparent purpose.

Completeness2/5

The surface covers observation only — no tap, swipe, type, launch/terminate app, or session control. Notably, page_source's description tells the agent to use it 'to find exact tap coordinates' yet no tap tool exists, creating an explicit dead end. This is a significant gap for an iOS driving server.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues