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
# iphone-control 的设置,放在 ~/.config/iphone-control/env(首次运行 iphone-control 的引导、
# iphone-control setup --reconfigure 会替你写好;也可以照这个文件手改)。所有项都可以留空,用默认值。
# 改完运行 iphone-control service restart 让守护进程重新读取。这个文件里有通知密钥,不要提交、不要分享。
#
# Settings for iphone-control, in ~/.config/iphone-control/env (the first-run guide of `iphone-control` and
# `iphone-control setup --reconfigure` write it for you; you can also edit it by hand). Every entry may stay empty.
# After a change run iphone-control service restart. The file holds notification secrets: don't commit or share it.
# 界面语言:工具说明和结果、命令行输出、日志、通知。zh(默认)或 en。
# Language of tool texts, CLI output, logs and notifications: zh (default) or en.
# MCP 和命令行各自按自己的设置发请求,守护进程按请求的语言回答;这里的设置管守护进程自己写的日志和通知,
IPHONE_CONTROL_LANG=
# 开发者工具:设为 1 时 MCP 服务多出日志、崩溃报告、安装和卸载 App、网页检查(Web Inspector)六个工具(默认关闭,免得 agent 多读工具说明)
# Developer tools: 1 adds six MCP tools for logs, crash reports, installing and removing apps, and web pages (Web Inspector) (off by default).
# 守护进程和每个 iphone-control 命令(包括 MCP 服务)启动时都读这个文件;已经在环境里设了的变量优先,见文档的「配置」一页。
# The daemon and every iphone-control command (the MCP server too) read this file at start-up; a variable already set in the environment wins.
IPHONE_CONTROL_DEV_TOOLS=
# 控制台(iphone-control viewer)的画面:auto(默认:iOS 27 及以上用手机自己编的视频,HEVC;其余 H.264,macOS 上直接用 VideoToolbox,Linux 上要装 ffmpeg,先试显卡编码)、device(只用手机自己的视频)、mjpeg(只用 MJPEG),
# 或指定 nvenc、vaapi、qsv、v4l2m2m、videotoolbox、x264。H.264 的流量约为 MJPEG 的 1/15,走外网时更顺
# Viewer picture: auto (default: the phone's own HEVC video on iOS 27 and later, else H.264, on macOS with VideoToolbox directly, on Linux with ffmpeg; GPU encoding first), device (only the phone's own video), mjpeg (only MJPEG), or one of
# nvenc, vaapi, qsv, v4l2m2m, videotoolbox, x264. H.264 is about 1/15 of MJPEG's traffic.
IPHONE_CONTROL_VIEWER_CODEC=
# H.264 的画质:1~51,越小越清晰、流量越大。默认 20,正常使用看不出和原画的差别;24 约省三分之一流量,快速滚动时小字略糊
# H.264 quality, 1 to 51: lower is sharper and larger. Default 20 looks like the source; 24 saves about a third, small text blurs a little while scrolling fast.
IPHONE_CONTROL_VIEWER_QP=
# 设为 1:控制台也对局域网开放(同一个端口,局域网里用 HTTPS,要令牌登录:iphone-control viewer token),只接受局域网地址来的连接
# Set to 1: the viewer is also open to the local network (same port, HTTPS there, login with the token: iphone-control viewer token); only local-network addresses may connect.
IPHONE_CONTROL_VIEWER_LAN=
# 控制台的端口(默认 8200)和 --lan 时还认可的主机名(逗号分隔);控制台服务(iphone-control service viewer install)也读它们
# The viewer's port (default 8200) and, with --lan, more host names it answers to (comma-separated); the viewer service reads them too.
IPHONE_CONTROL_VIEWER_PORT=
IPHONE_CONTROL_VIEWER_LAN_HOSTS=
# 控制台的 HTTPS:auto(默认,对局域网开放或给了证书时开启)、on、off;证书和私钥(PEM)不设就用本机生成的自签证书
# The viewer's HTTPS: auto (default: on when open to the network or given a certificate), on, off; without a certificate and key (PEM) a self-signed one made here.
IPHONE_CONTROL_VIEWER_TLS=
IPHONE_CONTROL_VIEWER_TLS_CERT=
IPHONE_CONTROL_VIEWER_TLS_KEY=
# 控制台同一个端口上的 MCP over HTTP(/mcp):on(默认)、off
# MCP over HTTP on the viewer's port (/mcp): on (default), off.
IPHONE_CONTROL_VIEWER_MCP=
# 固定控制哪台设备,设了就不能切换。留空为自动选:正在控制的那台一直用到它断开;
# 运行中可以用 `iphone-control select` 或 iphone_select_device 工具切换
IPHONE_UDID=
# HID 后备路线换算坐标用的屏幕尺寸(点):WDA 不可用、又没有这台设备的尺寸记录时才用(从没连上过 WDA,或切到记录里没有尺寸的设备)。
# 不分设备,接多台时要小心;一般留空
SCREEN_W=
SCREEN_H=
# 代理:下载开发者镜像、Apple ID 登录、下载 WDA、发 Telegram 都会用;留空表示直连
HTTP_PROXY=
HTTPS_PROXY=
NO_PROXY=localhost,127.0.0.1,::1
# 描述文件(免费账号 7 天有效)剩余不到几天时重签;每隔几小时检查一次(手机重新连上或切换设备后 1 分钟内也查一次)
RESIGN_MIN_DAYS=2
RESIGN_CHECK_HOURS=6
# 手机离线超过几分钟推送提醒;0 表示不提醒
OFFLINE_ALERT_MIN=10
# 通知:配了哪个就发哪个。触发场景:重签失败、Apple ID 会话失效、手机离线/恢复、重启后需要输密码、自动解锁失败
TG_BOT_TOKEN=
TG_CHAT_ID=
BARK_SERVER=https://api.day.app
BARK_KEY=
# 高级
# 自建 anisette 服务(默认用 Impactor 的第三方服务)
ICTL_ANISETTE_URL=
# 开发者镜像下载地址(默认社区维护的 doronz88/DeveloperDiskImage)
ICTL_DDI_URL=
# 自己从 Xcode 提取的开发者镜像目录。设了就不下载,也不会删里面的文件;缺文件时报错说明缺哪个
ICTL_DDI_DIR=
# 未签名 WDA 的路径。默认是数据目录的 wda/WDA-unsigned.ipa,首次签名前下载
# ICTL_WDA_UNSIGNED=/path/to/WDA-unsigned.ipa
# iOS 27 及以上怎么控制:auto(默认,原生:不用 WDA,经 HID、无障碍服务和 CoreDevice)、native、wda(仍用 WDA)
# ICTL_IOS_BACKEND=auto
# 数据目录和控制接口(同 --data-dir、--socket)。要改时不能留空,守护进程、命令行和 MCP 要用同样的值。
# 默认:root 是 /var/lib/iphone-control 和 /run/iphone-control/ctl.sock;
# 普通用户是 $XDG_DATA_HOME/iphone-control(没设时 ~/.local/share/iphone-control)和 $XDG_RUNTIME_DIR/iphone-control/ctl.sock(没有 XDG_RUNTIME_DIR 时放在数据目录里)
# ICTL_DATA_DIR=/path/to/data
# ICTL_SOCKET=/path/to/ctl.sock
# 日志级别(tracing EnvFilter 语法)
# ICTL_LOG=info,ictl_wda::http=debug