iOS模拟器MCP服务器
MCP(模型上下文协议)服务器,为Claude Code提供对iOS模拟器的代理控制,用于UI/UX调试和开发。
特性
模拟器控制
列出、启动和关闭模拟器
截图
设置位置,状态栏覆盖
提醒推送
管理应用程序权限
应用管理
安装、启动和终止应用程序
列出已安装的应用程序
打开网址
访问应用程序容器
UI交互(需要IDB)
深度UI调试(需要ClaudeDebugKit)
完成视图层次结构检查
自动布局约束分析
触摸目标尺寸审核(最小44pt)
颜色对比度审计(WCAG AA/AAA)
可访问性审计
字体和颜色检查
视图突出显示
特性收集覆盖(暗模式、动态类型)
内存统计数据和性能指标
安装
先决条件
Xcode iOS模拟器
Node.js 18+
国际开发银行 (可选,用于UI交互):复制 brew install idb-companion
pip install fb-idb
安装MCP服务器
复制 cd ios-simulator-mcp-server
npm install
npm run build
配置Claude代码
添加到您的Claude Code MCP配置中(~/.config/claude-code/mcp.json):
复制 {
"mcpServers": {
"ios-simulator": {
"command": "node",
"args": ["/path/to/ios-simulator-mcp-server/dist/index.js"]
}
}
}
将ClaudeDebugKit添加到您的iOS应用程序
对于深度UI检查功能,请将Swift包添加到您的iOS项目中:
在Xcode中:文件→ 添加包依赖关系
输入: file:///path/to/ClaudeDebugKit
添加到您的应用程序(仅限调试版本):
复制 #if DEBUG
import ClaudeDebugKit
// In AppDelegate or SceneDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions...) {
ClaudeDebugServer.shared.start()
return true
}
#endif
使用示例
基本模拟器控制
复制 "List all available iOS simulators"
"Boot iPhone 15 Pro"
"Take a screenshot of the simulator"
"Set the location to San Francisco (37.7749, -122.4194)"
应用程序开发工作流
复制 "Install my app from ~/Build/MyApp.app and launch it"
"Get the view hierarchy of the current screen"
"Find all interactive elements"
"Audit touch targets for HIG compliance"
UI/UX调试
复制 "Check color contrast for WCAG AA compliance"
"Show me the constraints on the login button"
"Highlight the view with accessibility label 'Submit'"
"Run a full UI/UX audit"
测试不同的配置
复制 "Switch to dark mode"
"Override Dynamic Type to extra large"
"Simulate a memory warning"
"Get memory stats for the app"
可用工具
模拟器管理
工具
说明
ios_list_devices
列出所有模拟器
ios_boot_device
启动模拟器
ios_shutdown_device
关闭模拟器
ios_screenshot
截图
ios_set_location
设置GPS位置
ios_set_status_bar
覆盖状态栏
ios_push_notification
发送推送通知
ios_set_permission
授予/撤销权限
ios_get_logs
获取应用程序日志
应用管理
工具
说明
ios_install_app
安装.app捆绑包
ios_launch_app
启动应用程序
ios_terminate_app
终止应用程序
ios_list_apps
列出已安装的应用程序
ios_open_url
打开URL
ios_get_app_container
获取容器路径
UI交互(需要IDB)
工具
说明
ios_tap
点击坐标或标签
ios_swipe
滑动手势
ios_input_text
键入文本
ios_press_button
硬件按钮
ios_long_press
长按
查看调试(需要ClaudeDebugKit)
工具
说明
ios_get_view_hierarchy
全景树
ios_get_constraints
自动布局约束
ios_find_element
按标签/标识符查找
ios_get_view_colors
颜色信息
ios_get_font_info
字体详细信息
ios_highlight_view
视觉突出显示
ios_get_interactive_elements
所有可敲击元件
ios_get_responder_chain
应答器链
ios_get_traits
特征收集
ios_override_traits
覆盖外观
ios_get_memory_stats
内存使用情况
ios_export_view_image
将视图导出为PNG
审计(需要ClaudeDebugKit)
工具
说明
ios_audit_touch_targets
检查最小44pt
ios_audit_contrast
WCAG对比度检查
ios_audit_layout
自动布局问题
ios_audit_accessibility
无障碍问题
ios_audit_all
完整的UI/UX审核
建筑
复制 ┌─────────────────────────────────────────────────────────┐
│ Claude Code │
└─────────────────────┬───────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────────────────────┐
│ ios-simulator-mcp-server │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
│ │ simctl │ │ IDB │ │ Debug Client │ │
│ │ (built-in) │ │ (optional) │ │ (HTTP) │ │
│ └──────┬──────┘ └──────┬──────┘ └────────┬────────┘ │
└─────────┼────────────────┼──────────────────┼──────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────┐
│ iOS Simulator │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Your iOS App │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ ClaudeDebugKit │ │ │
│ │ │ (HTTP Server on :8765) │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
需求
macOS与Xcode 15+
Node.js 18+
ClaudeDebugKit的iOS 14+目标
许可证
麻省理工学院