macos-ui-mcp
macos-ui-mcp
一个 Playwright 风格的工具,让 Claude 在构建原生 macOS 应用时检查并驱动其 UI——无需屏幕录制权限。
该应用不是捕获屏幕,而是渲染自身。一个仅用于调试的微型 Swift 包(swift-harness/)通过 localhost HTTP 暴露应用的视图树和进程内 PNG 渲染器;一个 MCP 服务器(src/)将其转化为 Claude 可以调用的工具:list_windows、get_ui_tree、screenshot、click、type、wait_for、invoke_action。
有关设计原理、架构对比和项目目标,请参阅 IDEA.md。
Claude Code ──MCP(stdio)──> macos-ui-mcp server ──HTTP──> AppMCPHarness (in your app, DEBUG only)布局
路径 | 说明 |
| MCP 服务器(TypeScript) |
| harness 的 HTTP 线上格式(类型 + zod 模式) |
| vitest 测试套件 + 内存模拟 harness; |
| macOS 应用的即插即用参考 harness |
| 一个链接了 harness 的最小 AppKit 应用——用于 e2e 测试 |
Related MCP server: Desktop Pilot MCP
使用
1. 将 harness 添加到你的 macOS 应用(仅 DEBUG 构建)
参见 swift-harness/README.md。在你的 AppDelegate 中添加一行:
#if DEBUG
AppMCP.start() // opens http://127.0.0.1:8787
#endif2. 构建 MCP 服务器
npm install
npm run build3. 将其注册到 Claude Code
// .mcp.json
{
"mcpServers": {
"macos-ui-mcp": {
"command": "node",
"args": ["/absolute/path/to/macos-ui-mcp/dist/index.js"],
"env": { "MACOS_UI_MCP_HARNESS_URL": "http://127.0.0.1:8787" }
}
}
}现在,在调试构建中运行你的应用,让 Claude 调用 get_ui_tree 或 screenshot——不会出现屏幕录制提示。
开发
npm test # 38 unit tests, no real app needed (mock harness); e2e is skipped
npm run typecheck
npm run dev # run the server against a live harness
npm run test:e2e # builds showcase/, launches it, runs the real tools against the
# real Swift harness. Needs a logged-in macOS GUI session.npm run test:e2e 是目标的证明:它断言 get_ui_tree 能看到控件,screenshot 返回真实的进程内 PNG,并且 click / type 能改变实时 UI——无需屏幕录制权限。
选择器语法
由 click、type、screenshot、wait_for 使用:
形式 | 匹配 |
| id 为 |
| 角色为 |
| 任何标签为 |
| 任何角色为 |
click / type 会拒绝不明确的选择器(多于一个匹配),并报告候选 id。
状态
v0.1 — macOS / AppKit。已实现全部 7 个工具。38 个单元测试 + 一个 5 用例的端到端测试,通过真实的 Swift harness 驱动
showcase/应用。已验证:视图树、进程内 PNG 快照、点击、设置文本、操作钩子——屏幕录制已关闭。尚未实现——SwiftUI 原生视图树(目前仅支持 AppKit 内省)、Windows 适配器、通过辅助功能 API 检查第三方应用。
许可证
MIT © 2026 Thang Duong
macos-ui-mcp
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Claude to see and interact with any macOS application using natural language commands. Perfect for testing Mac applications, UI automation, and app development with AI assistance.32
- AlicenseNot gradedqualityDmaintenanceEnables high-speed native macOS automation for Claude by interacting directly with the Accessibility API, AppleScript, and UI trees instead of using screenshots. It allows users to read app states, click elements, and type text semantically across any macOS application.910MIT
- AlicenseNot gradedqualityAmaintenanceEnables Claude to capture and analyze screen content across Windows, macOS, and Linux with zero native runtime dependencies.325MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to control the local desktop via screenshot, mouse, keyboard, and clipboard operations.MIT
Related MCP Connectors
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
Live browser debugging for AI assistants — DOM, console, network via MCP.
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/thangduonghuu/macos-ui-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server