hepiao3/lookin-mcp-server
MCP server that bridges Claude Code with Lookin iOS UI debugger — inspect view hierarchy, read/modify attributes, capture screenshots, and invoke methods via AI.
Platform-specific configuration:
{
"mcpServers": {
"lookin-mcp-server": {
"command": "npx",
"args": [
"-y",
"lookin-mcp-server"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
Lookin 的 MCP Server,让 Claude Code 能够直接查看和修改 iOS App 的 UI 视图层级与属性。
---
---
Claude Code
↓ stdio (MCP 协议)
lookin-mcp-server (Node.js)
↓ HTTP localhost:47200
Lookin.app 内嵌 HTTP Server
↓ USB / Simulator
iOS App (LookinServer)Lookin.app 启动后会在本地监听 47200 端口。MCP Server 作为中间层,将 Claude Code 的工具调用转换为对该端口的 HTTP 请求。
---
Lookin.app 会在首次启动时自动完成以下配置:
~/.lookin/mcp-server/mcp-server.jsclaude mcp add --scope user lookin 自动注册到 Claude Code无需手动配置。打开 Lookin.app 并连接 iOS 设备/模拟器后,即可在 Claude Code 中使用以下工具。
---
lookin_get_hierarchy获取当前 iOS App 的 UI 视图层级树。
参数:
| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | includeSystemViews | boolean | 否 | 是否包含系统视图(UIKit 私有类)。默认 false | | maxDepth | number | 否 | 最大层级深度。不传则返回全部 |
返回示例:
{"appName":"Demo","totalViews":12,"hierarchy":[{"oid":4393842688,"title":"UIWindow","frame":[0,0,390,844],"children":[{"oid":4393842944,"title":"MyViewController","frame":[0,0,390,844],"children":[]}]}]}每个节点字段说明:
oid — 视图唯一标识符,传给其他工具使用title — 类名frame — 位置尺寸 [x, y, width, height]hidden — 仅在 true 时出现alpha — 仅在非 1.0 时出现---
lookin_get_attributes查询指定视图的所有 UI 属性。
参数:
| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | oid | number | 是 | 视图 ID(从 lookin_get_hierarchy 获取) |
返回: 属性按 group → section → attribute 分组,每个属性包含:
identifier — 属性标识符(修改时需传入)setterSelector — setter 方法名,如 setBackgroundColor:attrType — 值类型枚举value — 当前值attrType 枚举值:
| 值 | 类型 | |----|------| | 14 | BOOL | | 12 | float | | 13 | double | | 5 | NSInteger | | 20 | CGRect | | 17 | CGPoint | | 19 | CGSize | | 22 | UIEdgeInsets | | 27 | UIColor(RGBA 数组,0~1) | | 25 | 枚举 int | | 26 | 枚举 long | | 24 | NSString |
---
lookin_modify_attribute修改指定视图的 UI
Loading reviews...