Control a real USB-connected iPhone from Linux (no Mac, no paid developer account) and expose it to AI agents as MCP tools
Rust ai-agentautomationclaudeclaude-codedockeriosiphonelinuxmcpmcp-servermodel-context-protocolrustwebdriveragent
新 logo 和架构图
Derrors5e0293eea222
diff --git a/README.md b/README.mdindex 5bd0df1..b52975a 100644--- a/README.md+++ b/README.md@@ -45,18 +45,12 @@ AI agents can drive browsers and desktops, but a real iPhone is harder: Apple'siphone-control does it all in **one Rust binary** on Linux, built on [idevice](https://github.com/jkcoxson/idevice), [Impactor](https://github.com/claration/impactor) and [WebDriverAgent](https://github.com/appium/WebDriverAgent). A long-running daemon owns the phone — tunnel, HID session, WebDriverAgent session — and exposes it to Claude Code or any MCP client. It succeeds [iphone-control-toolkit](https://github.com/Derrors/iphone-control-toolkit) and keeps its MCP tools compatible.-```-Claude Code / any MCP client- │ MCP over stdio- ▼-┌──────── iphone-control daemon (Docker or systemd) ────────┐-│ WebDriverAgent (primary) │-│ CoreDevice HID (fallback) │-│ supervisor: usbmuxd · reconnect · re-sign · notify │-└─────────────────────────────┬──────────────────────────────┘- │ USB (no network port opened)- iPhone-```+<p align="center">+ <picture>+ <source media="(prefers-color-scheme: dark)" srcset="website/public/architecture-dark.svg">+ <img src="website/public/architecture-light.svg" alt="Architecture: an MCP client talks to iphone-control mcp over stdio, which talks to the daemon over a Unix socket; the daemon drives the iPhone over USB through WebDriverAgent, with CoreDevice HID as fallback" width="900">+ </picture>+</p>## Featuresdiff --git a/README.zh-CN.md b/README.zh-CN.mdindex 065a334..b9514b5 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -45,18 +45,12 @@ AI agent 已经能操作浏览器和电脑桌面,但真实的 iPhone 难得多iphone-control 在 Linux 上用**一个 Rust 二进制**把这些事都做了,基于 [idevice](https://github.com/jkcoxson/idevice)、[Impactor](https://github.com/claration/impactor) 和 [WebDriverAgent](https://github.com/appium/WebDriverAgent)。一个常驻守护进程独占手机(隧道、HID 会话、WebDriverAgent 会话常驻复用),把它交给 Claude Code 或任何 MCP 客户端。它是 [iphone-control-toolkit](https://github.com/Derrors/iphone-control-toolkit) 的继任者,MCP 工具保持兼容。-```-Claude Code / any MCP client- │ MCP over stdio- ▼-┌──────── iphone-control daemon (Docker or systemd) ────────┐-│ WebDriverAgent (primary) │-│ CoreDevice HID (fallback) │-│ supervisor: usbmuxd · reconnect · re-sign · notify │-└─────────────────────────────┬──────────────────────────────┘- │ USB (no network port opened)- iPhone-```+<p align="center">+ <picture>+ <source media="(prefers-color-scheme: dark)" srcset="website/public/architecture-dark.svg">+ <img src="website/public/architecture-light.svg" alt="架构:MCP 客户端经 stdio 调用 iphone-control mcp,再经 Unix socket 交给守护进程;守护进程经 USB 用 WebDriverAgent 操作 iPhone,CoreDevice HID 作为后备" width="900">+ </picture>+</p>## 功能特性diff --git a/website/.vitepress/theme/custom.css b/website/.vitepress/theme/custom.cssindex 00bd380..7582d66 100644--- a/website/.vitepress/theme/custom.css+++ b/website/.vitepress/theme/custom.css@@ -30,3 +30,9 @@--vp-home-hero-image-filter: blur(68px);}}++/* 浅色/深色两版的图:跟随文档站的外观切换 */+.dark .light-only,+html:not(.dark) .dark-only {+ display: none;+}diff --git a/website/en/guide/what-is-iphone-control.md b/website/en/guide/what-is-iphone-control.mdindex 25783df..f23a9b4 100644--- a/website/en/guide/what-is-iphone-control.md+++ b/website/en/guide/what-is-iphone-control.md@@ -12,9 +12,8 @@ It works as a set of [MCP](https://modelcontextprotocol.io) (Model Context Proto## How it works-```-AI client ──stdio──▶ iphone-control mcp ──Unix socket──▶ iphone-control daemon ──USB──▶ iPhone-```+{.light-only}+{.dark-only}- A **daemon** runs all the time and owns the phone: it pairs, mounts the Developer Disk Image, opens a tunnel, and runs [WebDriverAgent](https://github.com/appium/WebDriverAgent) (WDA, an agent on top of Apple's XCTest automation) on the phone to read the screen, tap and type.- The **MCP server** is started by the AI client on demand and simply forwards tool calls to the daemon.diff --git a/website/guide/what-is-iphone-control.md b/website/guide/what-is-iphone-control.mdindex 8d02091..15572cc 100644--- a/website/guide/what-is-iphone-control.md+++ b/website/guide/what-is-iphone-control.md@@ -12,9 +12,8 @@ iphone-control 让 AI agent(例如 Claude)操作一台用数据线接在 Lin## 怎么工作-```-AI 客户端 ──stdio──▶ iphone-control mcp ──Unix socket──▶ iphone-control daemon ──USB──▶ iPhone-```+{.light-only}+{.dark-only}- **守护进程**常驻,独占手机:配对、挂载开发者镜像、建立隧道,在手机上运行 [WebDriverAgent](https://github.com/appium/WebDriverAgent)(WDA,苹果 XCTest 自动化框架上的代理),用它读界面、点击和输入。- **MCP 服务**由 AI 客户端按需拉起,只是把工具调用转给守护进程。diff --git a/website/public/architecture-dark.svg b/website/public/architecture-dark.svgnew file mode 100644index 0000000..200d3a4--- /dev/null+++ b/website/public/architecture-dark.svg@@ -0,0 +1,89 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600" width="1200" height="600" role="img" aria-label="iphone-control architecture: an MCP client talks to iphone-control mcp over stdio, which talks to the daemon over a Unix socket; the daemon drives the iPhone over USB through WebDriverAgent, with CoreDevice HID as fallback">+ <title>iphone-control architecture</title>+ <defs>+ <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">+ <path d="M0 0 L10 5 L0 10 Z" fill="#9198a1"/>+ </marker>+ <linearGradient id="screen" x1="0" y1="0" x2="0" y2="1">+ <stop offset="0" stop-color="#0e7490"/>+ <stop offset="1" stop-color="#083344"/>+ </linearGradient>+ <style>+ text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #e6edf3; }+ .h2 { font-size: 24px; font-weight: 700; }+ .h3 { font-size: 19px; font-weight: 600; }+ .sub { font-size: 15px; fill: #9198a1; }+ .label { font-size: 15px; fill: #9198a1; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }+ .pill { font-size: 14px; font-weight: 600; }+ .frame { font-size: 16px; fill: #9198a1; }+ </style>+ </defs>++ <!-- Linux host -->+ <rect x="16" y="16" width="900" height="568" rx="24" fill="none" stroke="#3d444d" stroke-width="2" stroke-dasharray="8 6"/>+ <text x="44" y="54" class="frame"><tspan style="font-weight:700;fill:#e6edf3">Linux host</tspan> · Docker or systemd user service</text>++ <!-- AI client -->+ <rect x="48" y="88" width="260" height="128" rx="16" fill="#151b23" stroke="#3d444d" stroke-width="1.5"/>+ <text x="72" y="134" class="h3">AI client</text>+ <text x="72" y="166" class="sub">Claude Code · Cursor ·</text>+ <text x="72" y="190" class="sub">any MCP client</text>++ <line x1="178" y1="218" x2="178" y2="300" stroke="#9198a1" stroke-width="2" marker-end="url(#arrow)"/>+ <text x="194" y="265" class="label">MCP · stdio</text>++ <!-- MCP server -->+ <rect x="48" y="304" width="260" height="128" rx="16" fill="#151b23" stroke="#3d444d" stroke-width="1.5"/>+ <text x="72" y="350" class="h3">iphone-control mcp</text>+ <text x="72" y="382" class="sub">one per agent session,</text>+ <text x="72" y="406" class="sub">a thin client</text>++ <line x1="310" y1="368" x2="388" y2="368" stroke="#9198a1" stroke-width="2" marker-end="url(#arrow)"/>+ <text x="349" y="350" class="label" text-anchor="middle">Unix</text>+ <text x="349" y="396" class="label" text-anchor="middle">socket</text>++ <text x="48" y="500" class="sub">Nothing listens on the network.</text>+ <text x="48" y="526" class="sub">WebDriverAgent is reached through usbmuxd.</text>++ <!-- daemon -->+ <rect x="392" y="88" width="496" height="468" rx="20" fill="#0b2a33" stroke="#22d3ee" stroke-width="2"/>+ <text x="420" y="130" class="h2" style="fill:#22d3ee">iphone-control daemon</text>+ <text x="420" y="160" class="sub">one long-running process owns the phone</text>+ <rect x="420" y="186" width="440" height="100" rx="14" fill="#0d1117" stroke="#155e75" stroke-width="1.5"/>+ <text x="444" y="228" class="h3">WebDriverAgent client</text>+ <rect x="752" y="206" width="88" height="30" rx="15" fill="#22d3ee"/>+ <text x="796" y="227" class="pill" style="fill:#0d1117" text-anchor="middle">primary</text>+ <text x="444" y="260" class="sub">element tree · tap · type · screenshot</text>+ <rect x="420" y="306" width="440" height="100" rx="14" fill="#0d1117" stroke="#155e75" stroke-width="1.5"/>+ <text x="444" y="348" class="h3">CoreDevice HID</text>+ <rect x="752" y="326" width="88" height="30" rx="15" fill="#fbbf24"/>+ <text x="796" y="347" class="pill" style="fill:#0d1117" text-anchor="middle">fallback</text>+ <text x="444" y="380" class="sub">tap · swipe · keys · screenshot while WDA is down</text>+ <rect x="420" y="426" width="440" height="100" rx="14" fill="#0d1117" stroke="#155e75" stroke-width="1.5"/>+ <text x="444" y="468" class="h3">Supervisor</text>+ <text x="444" y="500" class="sub">usbmuxd · reconnect · disk image · re-sign · notify</text>++ <!-- USB link -->+ <line x1="890" y1="270" x2="984" y2="270" stroke="#9198a1" stroke-width="2.5" marker-start="url(#arrow)" marker-end="url(#arrow)"/>+ <text x="937" y="256" class="label" text-anchor="middle">USB</text>+ <text x="937" y="296" class="label" text-anchor="middle">usbmuxd</text>++ <!-- iPhone -->+ <rect x="990" y="72" width="180" height="350" rx="36" fill="#e6edf3"/>+ <rect x="1002" y="84" width="156" height="326" rx="26" fill="url(#screen)"/>+ <rect x="1050" y="96" width="60" height="16" rx="8" fill="#0b1220"/>+ <text x="1080" y="196" text-anchor="middle" style="fill:#ffffff;font-size:22px;font-weight:700">iPhone</text>+ <text x="1080" y="222" text-anchor="middle" style="fill:#ffffff;font-size:15px;opacity:.8">iOS 17+</text>+ <rect x="1018" y="262" width="124" height="64" rx="12" fill="#ffffff" fill-opacity="0.14"/>+ <text x="1080" y="290" text-anchor="middle" style="fill:#ffffff;font-size:15px;font-weight:600">WebDriver</text>+ <text x="1080" y="312" text-anchor="middle" style="fill:#ffffff;font-size:15px;font-weight:600">Agent</text>+ <text x="1080" y="378" text-anchor="middle" style="fill:#ffffff;font-size:13px;opacity:.8">signed with a</text>+ <text x="1080" y="396" text-anchor="middle" style="fill:#ffffff;font-size:13px;opacity:.8">free Apple ID</text>++ <!-- outbound internet -->+ <path d="M862 476 C 904 476, 920 506, 944 506" fill="none" stroke="#9198a1" stroke-width="2" stroke-dasharray="6 5" marker-end="url(#arrow)"/>+ <rect x="948" y="456" width="236" height="100" rx="16" fill="#2b2111" stroke="#d4a72c" stroke-width="1.5"/>+ <text x="970" y="490" class="h3" style="font-size:17px">Outbound HTTPS</text>+ <text x="970" y="516" class="sub">Apple ID · anisette</text>+ <text x="970" y="538" class="sub">Bark · Telegram</text>+</svg>diff --git a/website/public/architecture-light.svg b/website/public/architecture-light.svgnew file mode 100644index 0000000..c60ad94--- /dev/null+++ b/website/public/architecture-light.svg@@ -0,0 +1,89 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600" width="1200" height="600" role="img" aria-label="iphone-control architecture: an MCP client talks to iphone-control mcp over stdio, which talks to the daemon over a Unix socket; the daemon drives the iPhone over USB through WebDriverAgent, with CoreDevice HID as fallback">+ <title>iphone-control architecture</title>+ <defs>+ <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">+ <path d="M0 0 L10 5 L0 10 Z" fill="#59636e"/>+ </marker>+ <linearGradient id="screen" x1="0" y1="0" x2="0" y2="1">+ <stop offset="0" stop-color="#0e7490"/>+ <stop offset="1" stop-color="#164e63"/>+ </linearGradient>+ <style>+ text { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif; fill: #1f2328; }+ .h2 { font-size: 24px; font-weight: 700; }+ .h3 { font-size: 19px; font-weight: 600; }+ .sub { font-size: 15px; fill: #59636e; }+ .label { font-size: 15px; fill: #59636e; font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; }+ .pill { font-size: 14px; font-weight: 600; }+ .frame { font-size: 16px; fill: #59636e; }+ </style>+ </defs>++ <!-- Linux host -->+ <rect x="16" y="16" width="900" height="568" rx="24" fill="none" stroke="#d0d7de" stroke-width="2" stroke-dasharray="8 6"/>+ <text x="44" y="54" class="frame"><tspan style="font-weight:700;fill:#1f2328">Linux host</tspan> · Docker or systemd user service</text>++ <!-- AI client -->+ <rect x="48" y="88" width="260" height="128" rx="16" fill="#f6f8fa" stroke="#d0d7de" stroke-width="1.5"/>+ <text x="72" y="134" class="h3">AI client</text>+ <text x="72" y="166" class="sub">Claude Code · Cursor ·</text>+ <text x="72" y="190" class="sub">any MCP client</text>++ <line x1="178" y1="218" x2="178" y2="300" stroke="#59636e" stroke-width="2" marker-end="url(#arrow)"/>+ <text x="194" y="265" class="label">MCP · stdio</text>++ <!-- MCP server -->+ <rect x="48" y="304" width="260" height="128" rx="16" fill="#f6f8fa" stroke="#d0d7de" stroke-width="1.5"/>+ <text x="72" y="350" class="h3">iphone-control mcp</text>+ <text x="72" y="382" class="sub">one per agent session,</text>+ <text x="72" y="406" class="sub">a thin client</text>++ <line x1="310" y1="368" x2="388" y2="368" stroke="#59636e" stroke-width="2" marker-end="url(#arrow)"/>+ <text x="349" y="350" class="label" text-anchor="middle">Unix</text>+ <text x="349" y="396" class="label" text-anchor="middle">socket</text>++ <text x="48" y="500" class="sub">Nothing listens on the network.</text>+ <text x="48" y="526" class="sub">WebDriverAgent is reached through usbmuxd.</text>++ <!-- daemon -->+ <rect x="392" y="88" width="496" height="468" rx="20" fill="#ecfeff" stroke="#0891b2" stroke-width="2"/>+ <text x="420" y="130" class="h2" style="fill:#0e7490">iphone-control daemon</text>+ <text x="420" y="160" class="sub">one long-running process owns the phone</text>+ <rect x="420" y="186" width="440" height="100" rx="14" fill="#ffffff" stroke="#a5f3fc" stroke-width="1.5"/>+ <text x="444" y="228" class="h3">WebDriverAgent client</text>+ <rect x="752" y="206" width="88" height="30" rx="15" fill="#0e7490"/>+ <text x="796" y="227" class="pill" style="fill:#ffffff" text-anchor="middle">primary</text>+ <text x="444" y="260" class="sub">element tree · tap · type · screenshot</text>+ <rect x="420" y="306" width="440" height="100" rx="14" fill="#ffffff" stroke="#a5f3fc" stroke-width="1.5"/>+ <text x="444" y="348" class="h3">CoreDevice HID</text>+ <rect x="752" y="326" width="88" height="30" rx="15" fill="#fbbf24"/>+ <text x="796" y="347" class="pill" style="fill:#1f2328" text-anchor="middle">fallback</text>+ <text x="444" y="380" class="sub">tap · swipe · keys · screenshot while WDA is down</text>+ <rect x="420" y="426" width="440" height="100" rx="14" fill="#ffffff" stroke="#a5f3fc" stroke-width="1.5"/>+ <text x="444" y="468" class="h3">Supervisor</text>+ <text x="444" y="500" class="sub">usbmuxd · reconnect · disk image · re-sign · notify</text>++ <!-- USB link -->+ <line x1="890" y1="270" x2="984" y2="270" stroke="#59636e" stroke-width="2.5" marker-start="url(#arrow)" marker-end="url(#arrow)"/>+ <text x="937" y="256" class="label" text-anchor="middle">USB</text>+ <text x="937" y="296" class="label" text-anchor="middle">usbmuxd</text>++ <!-- iPhone -->+ <rect x="990" y="72" width="180" height="350" rx="36" fill="#1f2328"/>+ <rect x="1002" y="84" width="156" height="326" rx="26" fill="url(#screen)"/>+ <rect x="1050" y="96" width="60" height="16" rx="8" fill="#0b1220"/>+ <text x="1080" y="196" text-anchor="middle" style="fill:#ffffff;font-size:22px;font-weight:700">iPhone</text>+ <text x="1080" y="222" text-anchor="middle" style="fill:#ffffff;font-size:15px;opacity:.8">iOS 17+</text>+ <rect x="1018" y="262" width="124" height="64" rx="12" fill="#ffffff" fill-opacity="0.14"/>+ <text x="1080" y="290" text-anchor="middle" style="fill:#ffffff;font-size:15px;font-weight:600">WebDriver</text>+ <text x="1080" y="312" text-anchor="middle" style="fill:#ffffff;font-size:15px;font-weight:600">Agent</text>+ <text x="1080" y="378" text-anchor="middle" style="fill:#ffffff;font-size:13px;opacity:.8">signed with a</text>+ <text x="1080" y="396" text-anchor="middle" style="fill:#ffffff;font-size:13px;opacity:.8">free Apple ID</text>++ <!-- outbound internet -->+ <path d="M862 476 C 904 476, 920 506, 944 506" fill="none" stroke="#59636e" stroke-width="2" stroke-dasharray="6 5" marker-end="url(#arrow)"/>+ <rect x="948" y="456" width="236" height="100" rx="16" fill="#fff8e6" stroke="#d4a72c" stroke-width="1.5"/>+ <text x="970" y="490" class="h3" style="font-size:17px">Outbound HTTPS</text>+ <text x="970" y="516" class="sub">Apple ID · anisette</text>+ <text x="970" y="538" class="sub">Bark · Telegram</text>+</svg>diff --git a/website/public/logo.svg b/website/public/logo.svgindex 864a92e..404ffa7 100644--- a/website/public/logo.svg+++ b/website/public/logo.svg@@ -1,7 +1,37 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">- <rect x="16" y="4" width="32" height="56" rx="8" fill="#0e7490"/>- <rect x="19.5" y="9" width="25" height="44" rx="4" fill="#ecfeff"/>- <rect x="27" y="5.8" width="10" height="2.6" rx="1.3" fill="#ecfeff"/>- <path d="M26 24l8 7-8 7" stroke="#0e7490" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>- <path d="M35 39h6" stroke="#22d3ee" stroke-width="3.2" stroke-linecap="round"/>+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512" role="img" aria-label="iphone-control logo">+ <title>iphone-control</title>+ <defs>+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">+ <stop offset="0" stop-color="#22d3ee"/>+ <stop offset="1" stop-color="#0e7490"/>+ </linearGradient>+ <linearGradient id="screen" x1="0" y1="0" x2="0" y2="1">+ <stop offset="0" stop-color="#164e63"/>+ <stop offset="1" stop-color="#082f49"/>+ </linearGradient>+ <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">+ <feDropShadow dx="0" dy="10" stdDeviation="14" flood-color="#083344" flood-opacity="0.35"/>+ </filter>+ </defs>++ <!-- app-icon tile -->+ <rect width="512" height="512" rx="116" fill="url(#bg)"/>++ <!-- phone -->+ <g filter="url(#shadow)">+ <rect x="148" y="64" width="216" height="384" rx="48" fill="#ffffff"/>+ </g>+ <rect x="166" y="82" width="180" height="348" rx="32" fill="url(#screen)"/>+ <rect x="226" y="98" width="60" height="18" rx="9" fill="#0b1220"/>++ <!-- AI sparkle on the screen -->+ <path d="M256 168 C263 214 278 229 324 236 C278 243 263 258 256 304 C249 258 234 243 188 236 C234 229 249 214 256 168 Z" fill="#ffffff"/>+ <path d="M310 150 C312 164 316 168 330 170 C316 172 312 176 310 190 C308 176 304 172 290 170 C304 168 308 164 310 150 Z" fill="#67e8f9"/>++ <!-- home indicator -->+ <rect x="226" y="404" width="60" height="8" rx="4" fill="#ffffff" fill-opacity="0.55"/>++ <!-- tap: amber ripple with a pointer -->+ <circle cx="366" cy="372" r="74" fill="#fbbf24" stroke="#ffffff" stroke-width="14"/>+ <path d="M346 330 L346 410 L366 390 L382 424 L398 416 L382 384 L410 382 Z" fill="#0b1220" stroke="#0b1220" stroke-width="6" stroke-linejoin="round"/></svg>