blade-computer-use

blade-computer-use

Enables MCP clients to control macOS via accessibility and screen recording, providing tools to list apps, observe UI, click, type, press keys, and scroll.

Category
访问服务器

README

blade-computer-use

blade-computer-use is a small, agent-neutral macOS computer-use implementation over the Model Context Protocol (MCP). It gives Codex, Claude Code, Orca, and other MCP clients the same six tools:

  • list_apps
  • observe
  • click
  • type_text
  • press_key
  • scroll

It is an independent security research project, not an OpenAI product and not a reproduction of OpenAI's private Computer Use implementation.

How it works

Coding agent
    | stdio MCP: schemas, allowlist, one-shot revisions, PNG responses
    v
TypeScript server (bundled as one runtime file)
    | JSONL request/response protocol
    v
Persistent Swift helper
    | AXUIElement          | ScreenCaptureKit       | CGEvent
    v                      v                        v
Accessibility tree     window screenshot      mouse/keyboard input

observe returns a bounded AX tree, a window screenshot, and an opaque revision. That revision permits exactly one action. The next action consumes it, so an agent must observe again before doing anything else. element_index values are scoped to that observation and are never treated as stable cross-frame identities.

Requirements

  • macOS 14 or newer
  • Node.js 20 or newer
  • Swift 5.10 or newer and the Xcode Command Line Tools (xcode-select --install)
  • Accessibility and Screen Recording permission for BladeComputerUseHelper or the agent host macOS attributes it to

The first plugin launch compiles the native helper for the current Mac. The TypeScript MCP server is already committed as a standalone bundle, so runtime installation does not run npm install.

Codex

Install this repository as a Codex marketplace, then install the plugin:

codex plugin marketplace add echoVic/blade-computer-use
codex plugin add blade-computer-use@blade-computer-use

Restart the Codex app after installation. The packaged configuration allows only TextEdit by default.

For a custom allowlist, clone the repository, change CUA_ALLOWED_APPS in .mcp.json, build once, and add the local checkout as the marketplace source:

git clone https://github.com/echoVic/blade-computer-use.git
cd blade-computer-use
npm install
npm run build
codex plugin marketplace add "$PWD"
codex plugin add blade-computer-use@blade-computer-use

Use comma-separated bundle identifiers, for example:

"CUA_ALLOWED_APPS": "com.apple.TextEdit,com.apple.Notes"

CUA_ALLOW_ALL_APPS=1 is available for local research, but the lock screen and SecurityAgent remain hard-denied.

Claude Code

Clone the repository, then load it as a local Claude Code plugin:

git clone https://github.com/echoVic/blade-computer-use.git
claude --plugin-dir /absolute/path/to/blade-computer-use

Claude Code reads .claude-plugin/plugin.json and the shared root .mcp.json. ${CLAUDE_PLUGIN_ROOT} is resolved by the launcher, so the checkout can live anywhere.

Orca

Copy the Orca MCP example into Orca's configuration and replace the absolute command path. The example uses an underscore-safe server name, so Orca discovers the tools as mcp__blade_computer_use__<tool>.

Permissions

The first observe requests Accessibility and Screen Recording through the macOS system APIs. The user must approve both permissions; the plugin cannot toggle security settings on the user's behalf.

If macOS opens System Settings > Privacy & Security, grant:

  1. Accessibility to BladeComputerUseHelper, or to the terminal/Codex/Claude host shown by macOS.
  2. Screen Recording to the same executable shown by macOS.

Restart the plugin host after changing permissions, then retry observe. list_apps reports both accessibility_trusted and screen_recording_trusted; a denied request returns permission_denied with the missing permission names.

TextEdit smoke test

  1. Open TextEdit and create a new plain-text document.
  2. Ask the agent to call list_apps and find com.apple.TextEdit.
  3. Ask it to observe TextEdit.
  4. Ask it to click the editor, type a short line, and verify the result.

The expected loop is observe -> one action -> observe. A stale or already-consumed revision must not be retried.

With an empty TextEdit document focused and both permissions granted, run the live integration check:

npm run test:manual:textedit

This opt-in test verifies AX observation, two PNG responses, Unicode input, one-shot revision rejection, and the final AX text. It is not part of CI because it requires an interactive macOS session and user-granted permissions.

Security and privacy

  • Apps require an explicit bundle-id allowlist; TextEdit is the only packaged default.
  • com.apple.loginwindow, com.apple.SecurityAgent, and com.apple.SecurityAgentHelper are always denied.
  • Secure AX fields reject type_text.
  • Coordinate actions verify that the observed window has not moved or resized.
  • Screenshots are written to a mode-0700 temporary directory, read into the MCP image response, and deleted immediately afterward.
  • No telemetry is implemented. AX text and screenshots are returned to the connected agent, whose own model-request and retention behavior is outside this project.

See SECURITY.md for the trust boundary and reporting process.

Current limits

This is deliberately smaller than a production computer-use stack:

  • macOS-only; there is no Linux or Windows implementation.
  • No AX diff protocol or cross-observation element identity matching.
  • No lock-screen guardian, URL policy, or physical user-intervention detector.
  • No OCR, browser-specific DOM bridge, or action-specific confirmation UI.
  • No telemetry, account-policy integration, code signing, notarization, or prebuilt native binaries.
  • The AX tree is capped at 500 nodes, depth 12, and 160 characters per text field.

Development

npm install
npm test
npm run typecheck
npm run build
npm run validate:manifests
npm run smoke:mcp

The native checks use a framework-free self-test executable because a Command Line Tools-only Swift installation does not provide XCTest or the Swift Testing module:

npm run test:native

The self-test currently covers 22 protocol, AX serialization, input, coordinate, and permission-gate checks.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选