ios-agent

ios-agent

Exposes native iPhone device services and UI automation through MCP, enabling agents to inspect and control trusted iPhones via a unified interface.

Category
访问服务器

README

Give Codex hands on your iPhone

ios-agent-bridge combines native iOS device services with UI automation and exposes them through one MCP interface.

It is an open-source control plane for devices you own or are authorized to administer. It lets Codex and other MCP agents select the best available iPhone provider instead of making the user learn AFC, DTX, WDA, Appium, RemoteXPC, or Web Inspector.

Status: v0.1.0 is an initial, installable integration release. Its physical-device support is always reported by live probes; it never claims that a capability works merely because a provider is installed.

What it can do

  • Discover trusted iPhones and report a live capability matrix.
  • Use pymobiledevice3 for deep, non-jailbreak device services such as device information, app/container work, diagnostics, and Web Inspector where upstream support and device setup allow it.
  • Use Appium + WebDriverAgent for accessible UI automation: screenshots, UI trees, semantic element lookup, taps, gestures, text entry, app activation, URLs, and web contexts.
  • Expose one tool surface over MCP and a matching ios-agent CLI.
  • Execute a bounded server-side multi-step flow so an agent does not need an MCP round trip for every tap.
  • Keep risky device actions locked behind an explicit safety policy.

What it deliberately cannot do

  • It does not jailbreak devices, bypass pairing/trust, defeat a passcode, obtain root filesystem access, or circumvent Apple signing/security controls.
  • It does not silently erase, restore, enter recovery/DFU, mutate security profiles, or delete an arbitrary tree of user files.
  • A UI tree is accessibility data, not a guarantee that every pixel or private element is visible.
  • Safari and embedded web inspection require the device/app settings Apple and Appium require; they are not fabricated when unavailable.

30-second quick start

git clone https://github.com/Joe15935/ios-agent-bridge.git
cd ios-agent-bridge
uv sync --all-groups
uv run ios-agent doctor
uv run ios-agent status
uv run ios-agent capabilities
uv run ios-agent setup-codex

doctor does not ask for, save, or print secrets. It tells you exactly which device-side action is needed when Apple requires one.

Requirements and setup

  • macOS on Apple Silicon or Intel, Python 3.12+, and uv.
  • A USB or paired Wi-Fi iPhone for real-device actions. The phone must be unlocked and trust this Mac.
  • For rich UI automation, full Xcode (not Command Line Tools), an Apple development team for WDA signing, iOS Developer Mode, and Settings → Developer → Enable UI Automation. Run ios-agent doctor for the precise live status.
  • For Safari/WebView DOM inspection, enable Web Inspector and Safari Remote Automation. Apps must expose inspectable WKWebViews.

Full Xcode, signing, trust, Developer Mode, and device unlocking are intentional user actions. The bridge never attempts to fake or bypass them.

Codex setup

ios-agent setup-codex uses the locally installed codex mcp add command rather than editing a guessed configuration format. It registers a local stdio MCP server named ios-agent and verifies it with codex mcp list. Start a new Codex task/session afterward so it loads the newly registered tools.

You can also run the server directly:

uv run ios-agent mcp

The project includes the ios-agent-operator skill, which teaches an agent to check status/capabilities first and use semantic UI operations before coordinate taps.

Provider routing

Provider Role Enabled by default
pymobiledevice3 Primary deep-device provider Yes, when installed and paired
Appium XCUITest + WebDriverAgent Primary UI provider Yes, when Appium/WDA are healthy
go-ios Fallback for a gap or a more reliable operation No
libimobiledevice / ifuse Compatibility layer for traditional iDevice utilities No

The router records its preferred provider, fallbacks, and selection reason. It never starts competing RemoteXPC/tunnel owners for the same device.

Capability states

ios-agent capabilities returns the following real-time states rather than a generic error:

State Meaning
READY A live probe found a usable provider and required setup.
DEGRADED A usable fallback exists with a stated limitation.
BLOCKED_SETUP Install/configure a Mac-side dependency, such as full Xcode or Appium.
BLOCKED_USER_ACTION The user must connect/unlock/trust the device, enable Developer Mode, or approve an Apple dialog.
UNSUPPORTED iOS security or all upstream providers prevent the capability.
DANGEROUS_LOCKED Intentionally unavailable in this release.

Safety and privacy

  • READ actions are normal inspection actions.
  • WRITE actions only run when a caller explicitly invokes the corresponding operation; file deletion also needs an explicit confirmation.
  • DANGEROUS actions are locked. Version 0.1.0 intentionally exposes no erase/restore/DFU action.
  • apps.uninstall and files.delete are destructive WRITE actions, require an exact target and confirm=true, and never recurse through a directory tree. File actions may target an app's vended Documents container only when that app explicitly permits it.
  • Real artifacts are stored beneath ignored .local/, artifacts/, or private/ folders. The repository ignores pair records, certificates, keys, provisioning material, backups, logs, crash dumps, screenshots, media, cookies, and tokens.

Tests and verification

uv run ruff format --check .
uv run ruff check .
uv run mypy src
uv run pytest
uv build
uv run python -c "from ios_agent_bridge.server import create_server; create_server()"
uv run ios-agent doctor --json
uv run ios-agent capabilities --json

pytest -m real_device is opt-in and never runs in public CI. A machine without a real iPhone reports LIVE_DEVICE_ACCEPTANCE_BLOCKED: NO_PHYSICAL_DEVICE rather than inventing evidence.

The release's conservative task-coverage evidence is recorded in the capability scorecard. It distinguishes implemented paths from simulator and physical-device verification.

Troubleshooting

Start with ios-agent doctor. The common remedies are:

  1. Install and select full Xcode, then open it once to accept its license.

  2. Connect, unlock, and trust the iPhone.

  3. Enable Developer Mode and UI Automation on the iPhone for WDA.

  4. Sign WDA with your own development team in Xcode.

  5. Install the narrow Appium XCUITest driver only after Xcode is ready:

    npm install -g appium@3.6.0
    appium driver install xcuitest@12.3.2
    appium driver doctor xcuitest
    

The bridge binds an auto-started Appium server to 127.0.0.1, uses Appium 3's root base path, and never enables --relaxed-security.

Credits and license

ios-agent-bridge is GPL-3.0-or-later. It integrates upstream projects rather than vendoring or forking their protocol implementations. See THIRD_PARTY_NOTICES.md for licenses and attribution.

Key upstream projects: pymobiledevice3, Ghost in the Droid, Appium, Appium XCUITest Driver, WebDriverAgent, go-ios, libimobiledevice, ifuse, and the official Model Context Protocol Python SDK.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选