appstore截图mcp
MCP(模型上下文协议)服务器,用于从iOS模拟器自动捕获App Store屏幕截图。针对2026年App Store的要求进行了优化,配备了6.9英寸的iPhone和13英寸的iPad存储桶,以及可接受的回退像素大小。
特性
- 模拟器管理:使用App Store特定的预设列出、启动和关闭iOS模拟器
- 电脑屏幕截图工具:以本机分辨率捕获屏幕截图,并自动清理状态栏
- 应用商店优化:为iPhone 6.9英寸和iPad 13英寸的存储桶预配置了所有可接受的像素大小
- 状态栏控件:自动设置清洁状态栏(9:41,电池已满,WiFi)
- 应用管理:安装、启动和导航应用程序以实现屏幕截图自动化
- UI交互:点击、滑动、滚动和键入,将应用程序导航到特定屏幕
- 视频录制:为App Store预览视频录制模拟器交互
- 外观控制:切换暗/亮模式,设置区域设置,调整文本大小
- 无障碍:检查UI层次结构,查找元素,配置辅助功能设置
- 隐私权限:授予、撤销或重置应用程序权限(相机、位置、照片等)
- 推送通知:发送模拟推送通知以进行UI测试
- 位置模拟:设置GPS坐标或使用预设位置
- 系统警报:自动接受或取消权限对话框
- 钥匙链和生物识别:管理钥匙扣,触发Face ID/Touch ID
- 设备框架:为专业屏幕截图添加设备边框
- 验证:验证屏幕截图是否符合App Store要求
安装
通过npx(推荐)
npx appstore-screenshot-mcp
来源
git clone https://github.com/your-org/mcp-screen-iOS.git
cd mcp-screen-iOS
npm install
npm run build
需求
- 安装了Xcode的macOS
- Xcode命令行工具(
xcode-select --install) - iOS 26+模拟器运行时
- Node.js 18+
配置
克劳德代码
添加到 ~/.claude.json 或项目 .mcp.json:
{
"mcpServers": {
"appstore-screenshots": {
"type": "stdio",
"command": "npx",
"args": ["-y", "appstore-screenshot-mcp"]
}
}
}
或者通过CLI:
claude mcp add appstore-screenshots npx appstore-screenshot-mcp
Codex CLI
添加到 ~/.codex/config.toml:
[mcp_servers.appstore-screenshots]
command = "npx"
args = ["-y", "appstore-screenshot-mcp"]
可用工具
模拟器管理
| 工具 | 说明 |
|---|
list_simulators | 列出具有过滤选项的可用iOS模拟器 |
boot_appstore_simulator | 创建并启动符合App Store大小要求的模拟器 |
shutdown_simulator | 关闭并可选择删除模拟器 |
get_booted_simulator | 获取当前启动的模拟器的信息 |
电脑屏幕截图工具
| 工具 | 说明 |
|---|
capture_screenshot | 使用状态栏和凹口选项将屏幕截图捕获到文件中 |
capture_screenshot_inline | 捕获并返回base64图像(用于AI视觉) |
capture_all_appstore | 捕获所有App Store大小的屏幕截图 |
set_status_bar | 配置状态栏(时间、电池、WiFi、蜂窝) |
clear_status_bar | 将状态栏重置为系统默认值 |
validate_screenshot | 验证屏幕截图是否符合App Store要求 |
应用管理
| 工具 | 说明 |
|---|
install_app | 在模拟器上安装.app捆绑包 |
launch_app | 按捆绑包ID启动应用程序 |
terminate_app | 停止正在运行的应用程序 |
uninstall_app | 从模拟器中删除应用程序 |
open_url | 打开URL或深度链接(用于导航) |
list_apps | 列出已安装的应用程序 |
get_app_container | 获取应用程序数据/容器路径 |
UI交互
| 工具 | 说明 |
|---|
ui_tap | 点击特定坐标(以点为单位) |
ui_swipe | 从一个点滑动到另一个点 |
ui_scroll | 向上/下/左/右方向滚动 |
ui_type | 在焦点输入框中键入文本 |
ui_press_button | 按下硬件按钮(主页、锁定、音量、摇动、切换外观) |
get_ui_tree | 获取可访问性树以查找元素坐标 |
视频录制
| 工具 | 说明 |
|---|
start_recording | 开始从模拟器录制视频 |
stop_recording | 停止录制并保存视频文件 |
get_recording_status | 检查是否正在录制 |
外观控制
| 工具 | 说明 |
|---|
set_appearance | 设置亮或暗模式 |
get_appearance | 获取当前外观模式 |
toggle_appearance | 在亮模式和暗模式之间切换 |
set_locale | 设置区域设置和语言(例如en_US、ja_JP) |
set_content_size | 设置动态类型文本大小 |
set_accessibility | 配置辅助功能选项(减少运动、粗体文本等) |
无障碍检查
| 工具 | 说明 |
|---|
describe_ui | 获取完整的UI可访问性层次结构 |
describe_point | 获取特定坐标处的元素信息 |
find_element | 按标签、标识符或类型搜索元素 |
get_screen_info | 获取屏幕尺寸和设备信息 |
应用商店屏幕截图尺寸(2026)
隐私权限
| 工具 | 说明 |
|---|
grant_permission | 授予许可(相机、照片、位置等) |
revoke_permission | 撤销先前授予的权限 |
reset_permission | 将权限重置为默认值(将再次提示) |
grant_all_permissions | 一次性授予所有通用权限 |
list_permissions | 列出所有可用的权限类型 |
推送通知
| 工具 | 说明 |
|---|
send_notification | 发送带有标题、正文、徽章的推送通知 |
send_raw_notification | 发送原始APNS JSON有效负载 |
send_silent_notification | 发送无声/背景通知 |
位置模拟
| 工具 | 说明 |
|---|
set_location | 设置GPS坐标(纬度、经度) |
set_preset_location | 设置为预设城市(东京、伦敦、纽约等) |
clear_location | 清除位置覆盖 |
simulate_route | 模拟沿GPX路线的移动 |
list_preset_locations | 列出可用的预设位置 |
系统警报
| 工具 | 说明 |
|---|
accept_alert | 在系统对话框中接受/点击允许 |
dismiss_alert | 在对话框中取消/点击“不允许” |
trigger_siri | 激活Siri |
send_memory_warning | 向应用程序发送内存警告 |
trigger_icloud_sync | 触发icloud同步 |
钥匙链和生物识别
| 工具 | 说明 |
|---|
reset_keychain | 清除所有存储的凭据 |
add_keychain_item | 向钥匙链添加凭证 |
trigger_biometric | 触发Face ID/Touch ID匹配或失败 |
enroll_biometric | 注册或取消注册生物识别技术 |
设备框架
| 工具 | 说明 |
|---|
add_frame | 在屏幕截图周围添加设备挡板 |
add_background | 添加带填充的纯色背景 |
list_device_frames | 列出可用的设备框架 |
应用商店屏幕截图尺寸(2024+)
苹果2026年的要求集中在两个主要的显示桶上,每个桶有多个可接受的像素大小:
| 平台 | 所需尺寸 | 可接受尺寸(纵向) | 推荐模拟器 |
|---|
| 苹果手机 | 6.9英寸(如果未提供6.9英寸,则为6.5英寸) | 1320x2868、1290x2796、1260x2736 | iPhone 17 Pro Max |
| iPad | 13英寸 | 2064x27522048x2732 | iPad Pro 13英寸(M5) |
服务器根据每个bucket的所有可接受大小进行验证,并报告屏幕截图是纵向匹配还是横向匹配。
示例工作流
基本屏幕截图
1. Boot iPhone simulator: boot_appstore_simulator(deviceClass: "iphone_6.9")
2. Install your app: install_app(appPath: "/path/to/MyApp.app")
3. Launch app: launch_app(bundleId: "com.example.myapp")
4. Navigate to screen (if needed): open_url(url: "myapp://feature")
5. Capture screenshot: capture_screenshot(outputPath: "./screenshots/home.png")
完整的App Store屏幕截图集
1. Boot both required simulators:
- boot_appstore_simulator(deviceClass: "iphone_6.9")
- boot_appstore_simulator(deviceClass: "ipad_13")
2. Install app on both (use UDIDs from step 1)
3. Navigate to desired screen
4. Capture all: capture_all_appstore(outputDir: "./screenshots")
仅限清洁状态栏
set_status_bar(
time: "9:41",
batteryLevel: 100,
batteryState: "charged",
wifiMode: "active",
wifiBars: 3
)
使用UI交互进行导航
1. Launch app: launch_app(bundleId: "com.example.myapp")
2. Tap settings button: ui_tap(x: 350, y: 50)
3. Scroll down: ui_scroll(direction: "down", distance: 400)
4. Type in search: ui_type(text: "profile")
5. Toggle dark mode: ui_press_button(button: "toggleAppearance")
6. Capture screenshot: capture_screenshot(outputPath: "./screenshots/settings-dark.png")
录制App Store预览视频
1. Boot simulator: boot_appstore_simulator(deviceClass: "iphone_6.9")
2. Launch app: launch_app(bundleId: "com.example.myapp")
3. Start recording: start_recording(outputPath: "./videos/preview.mp4")
4. Perform interactions: ui_tap, ui_scroll, etc.
5. Stop recording: stop_recording()
以多种语言捕获屏幕截图
1. Set locale: set_locale(locale: "ja_JP")
2. Terminate app: terminate_app(bundleId: "com.example.myapp")
3. Launch app: launch_app(bundleId: "com.example.myapp")
4. Capture: capture_screenshot(outputPath: "./screenshots/home_ja.png")
5. Repeat for other locales (fr_FR, de_DE, etc.)
亮暗模式截图
1. set_appearance(mode: "light")
2. capture_screenshot(outputPath: "./screenshots/home_light.png")
3. set_appearance(mode: "dark")
4. capture_screenshot(outputPath: "./screenshots/home_dark.png")
在截图之前授予权限
1. grant_all_permissions(bundleId: "com.example.myapp")
2. launch_app(bundleId: "com.example.myapp")
3. -- App won't show permission dialogs, clean screenshots!
4. capture_screenshot(outputPath: "./screenshots/camera_feature.png")
捕获通知UI
1. launch_app(bundleId: "com.example.myapp")
2. send_notification(bundleId: "com.example.myapp", title: "New Message", body: "You have a new message!")
3. -- Wait for notification banner
4. capture_screenshot(outputPath: "./screenshots/notification.png")
基于位置的屏幕截图
1. set_preset_location(preset: "tokyo")
2. launch_app(bundleId: "com.example.myapp")
3. capture_screenshot(outputPath: "./screenshots/map_tokyo.png")
4. set_preset_location(preset: "new_york")
5. capture_screenshot(outputPath: "./screenshots/map_nyc.png")
将设备框架添加到屏幕截图
1. capture_screenshot(outputPath: "./screenshots/home.png")
2. add_frame(inputPath: "./screenshots/home.png", shadow: true)
3. -- Creates home_framed.png with device bezel
资源
服务器为设备配置公开MCP资源:
appstore-screenshot-mcp://devices
这将返回支持的App Store设备预设及其标识符和分辨率。
发展
# Install dependencies
npm install
# Build
npm run build
# Run in development (with watch)
npm run dev
# Type check
npm run typecheck
运作原理
服务器包装 xcrun simctl 命令和AppleScript提供:
- 设备创建:用途
simctl create 具有App Store大小的精确设备类型标识符 - 状态栏覆盖:用途
simctl status_bar override 用于干净的屏幕截图 - 电脑屏幕截图工具:用途
simctl io screenshot 和 --mask=black 用于缺口处理 - 应用程序控制:用途
simctl install/launch/terminate 应用程序生命周期 - UI交互:使用AppleScript控制Simulator.app进行点击、滑动和键盘输入
- 视频录制:用途
simctl io recordVideo 使用H.264/HEVC编解码器 - 外观控制:用途
simctl ui appearance 和 simctl spawn defaults 对于设置 - 无障碍:用途
simctl ui describe 用于UI层次结构检查 - 隐私:用途
simctl privacy grant/revoke/reset 用于权限管理 - 通知:用途
simctl push 发送APNS有效载荷 - 位置:用途
simctl location set/clear 用于GPS模拟 - 生物识别:用途
notifyutil 触发Face ID/Touch ID事件 - 设备框架:使用ImageMagick(如果可用)或sips进行图像处理
所有命令都是通过具有适当错误处理的Node.js子进程执行的。
许可证
麻省理工学院