Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

release: bump open-computer-use to 0.1.7

ifurystf66df83ed29f
diff --git a/README.md b/README.md
index 63e4b42..09a3cd3 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,12 @@ open-computer-use --version
open-computer-use --help
open-computer-use help snapshot
+# 直接写入 Codex 的 MCP 配置;重复执行会自动幂等跳过
+open-computer-use install-codex-mcp
+
+# 直接写入 Claude Code 当前项目的 MCP 配置;重复执行会自动幂等跳过
+open-computer-use install-claude-mcp
+
# 检查当前权限状态;如果有缺失会直接拉起权限 onboarding 窗口
open-computer-use doctor
@@ -109,6 +115,8 @@ npm install -g open-computer-use
- npm 包内已经携带预编译的 `Open Computer Use.app`,当前面向 macOS 14+。
- 包内 `.app` 是 universal binary,同时支持 Apple Silicon 与 Intel Mac。
- 真正执行前,宿主终端或 app 仍然需要被授予 `Accessibility` 与 `Screen Recording` 权限。
+- `open-computer-use install-claude-mcp` 会按 Claude 官方 MCP 文档的 local scope 结构,把当前仓库写到 `~/.claude.json` 的 `projects."<repo-path>".mcpServers` 下;写入前会先校验现有 JSON,重复执行会 no-op。
+- `open-computer-use install-codex-mcp` 会把 `[mcp_servers."open-computer-use"]` 幂等写入 `~/.codex/config.toml`;写入前会先用 TOML 解析校验现有配置,避免重复追加同一项。
- `open-computer-use install-codex-plugin` 会把 npm 包自身注册到本机 Codex 插件系统,不需要源码仓库路径。
## 从源码运行
@@ -130,6 +138,22 @@ swift build
.build/debug/OpenComputerUse list-apps
```
+如果你只是想把它作为 Codex 的普通 stdio MCP server 写进本机配置,不走 plugin marketplace,可以直接执行:
+
+```bash
+./scripts/install-codex-mcp.sh
+```
+
+这个脚本只会更新 `~/.codex/config.toml` 里的 `[mcp_servers."open-computer-use"]`,并在写入前先验证现有文件仍是合法 TOML;如果同一条配置已经存在,会直接 no-op,不会重复写入。
+
+如果你想把它安装到 Claude Code 当前项目的 `~/.claude.json`,可以直接执行:
+
+```bash
+./scripts/install-claude-mcp.sh
+```
+
+它会按 Claude 官方 MCP 文档里的 local scope 结构,把当前仓库路径写到 `projects."<repo-path>".mcpServers."open-computer-use"`;如果同一条配置已经存在,也会直接 no-op。
+
打包 app 并打开权限引导窗口:
```bash
@@ -268,6 +292,10 @@ https://chatgpt.com/backend-api/codex/responses
一个独立 Go 模块,用来探测官方 bundled `computer-use` 和普通 stdio MCP server;默认会对官方 Sky client 走 `codex app-server` 代理,避免 caller signing / launch constraint 问题。
- `plugins/open-computer-use`
repo-local Codex plugin 包装层,包含 plugin manifest、MCP 启动脚本和展示资源。
+- `scripts/install-codex-mcp.sh`
+ 把 `open-computer-use mcp` 作为普通 stdio MCP server 幂等写入 `~/.codex/config.toml`。
+- `scripts/install-claude-mcp.sh`
+ 把 `open-computer-use mcp` 作为 Claude Code 当前项目的 local-scope MCP server 幂等写入 `~/.claude.json`。
- `scripts/install-codex-plugin.sh`
把当前仓库注册到本机 Codex 的本地 marketplace,安装插件缓存包,并启用 `open-computer-use` 插件。
@@ -292,7 +320,7 @@ node ./scripts/npm/publish-packages.mjs
- `build-packages.mjs` 会构建 universal app 并 stage 三个 npm 包目录到 `dist/npm/`。
- `release-package.sh` 会额外把它们打成 `dist/release/npm/*.tgz`,并生成 `dist/release/release-manifest.json`。
-- `.github/workflows/release.yml` 支持通过 push `0.1.6` / `v0.1.6` 这类 git tag 自动发布,也保留手动触发作为兜底;默认兼容 npm Trusted Publishing,同时也支持通过仓库 `NPM_TOKEN` secret 兜底发布。
+- `.github/workflows/release.yml` 支持通过 push `0.1.7` / `v0.1.7` 这类 git tag 自动发布,也保留手动触发作为兜底;默认兼容 npm Trusted Publishing,同时也支持通过仓库 `NPM_TOKEN` secret 兜底发布。
## 许可证
diff --git a/apps/OpenComputerUse/Sources/OpenComputerUse/PermissionOnboardingApp.swift b/apps/OpenComputerUse/Sources/OpenComputerUse/PermissionOnboardingApp.swift
index 20607da..2e5c84e 100644
--- a/apps/OpenComputerUse/Sources/OpenComputerUse/PermissionOnboardingApp.swift
+++ b/apps/OpenComputerUse/Sources/OpenComputerUse/PermissionOnboardingApp.swift
@@ -1,4 +1,5 @@
import AppKit
+import ApplicationServices
import OpenComputerUseKit
@MainActor
@@ -418,6 +419,7 @@ final class PermissionAccessoryPanelController {
static let screenHorizontalInset: CGFloat = 16
static let screenBottomInset: CGFloat = 12
static let windowBottomOverlap: CGFloat = 6
+ static let controlsBottomGap: CGFloat = 12
static let contentLeadingInset: CGFloat = 26
static let contentTrailingInset: CGFloat = 28
static let sidebarWidthRatio: CGFloat = 0.29
@@ -425,6 +427,12 @@ final class PermissionAccessoryPanelController {
static let sidebarWidthMax: CGFloat = 272
}
+ private struct PanelAnchor {
+ let windowBounds: CGRect
+ let contentTrackRect: CGRect
+ let accessoryAnchorRect: CGRect?
+ }
+
func show(for permission: SystemPermissionKind) {
currentPermission = permission
@@ -559,27 +567,47 @@ final class PermissionAccessoryPanelController {
}
private func preferredPanelOrigin(for panelSize: CGSize) -> CGPoint? {
- guard let referenceRect = systemSettingsWindowBounds() ?? NSScreen.main?.visibleFrame else {
+ guard let anchor = preferredPanelAnchor() else {
return nil
}
+ let referenceRect = anchor.windowBounds
let visibleFrame = targetVisibleScreenFrame(for: referenceRect) ?? referenceRect
- let trackRect = systemSettingsContentTrackRect(in: referenceRect)
+ let trackRect = anchor.contentTrackRect
let x = clamp(
trackRect.midX - (panelSize.width / 2),
lower: visibleFrame.minX + Layout.screenHorizontalInset,
upper: visibleFrame.maxX - panelSize.width - Layout.screenHorizontalInset
)
+ let anchorMinY = anchor.accessoryAnchorRect?.minY ?? referenceRect.minY
+ let desiredY = if anchor.accessoryAnchorRect != nil {
+ anchorMinY - panelSize.height - Layout.controlsBottomGap
+ } else {
+ anchorMinY - panelSize.height + Layout.windowBottomOverlap
+ }
let y = max(
visibleFrame.minY + Layout.screenBottomInset,
- referenceRect.minY - panelSize.height + Layout.windowBottomOverlap
+ desiredY
)
return CGPoint(x: x, y: y)
}
+ private func preferredPanelAnchor() -> PanelAnchor? {
+ let referenceRect = systemSettingsWindowBounds() ?? NSScreen.main?.visibleFrame
+ guard let referenceRect else {
+ return nil
+ }
+
+ return PanelAnchor(
+ windowBounds: referenceRect,
+ contentTrackRect: systemSettingsContentTrackRect(in: referenceRect),
+ accessoryAnchorRect: systemSettingsControlsRowRect(in: referenceRect)
+ )
+ }
+
private func systemSettingsContentTrackRect(in windowBounds: CGRect) -> CGRect {
- // Track the System Settings window itself instead of the +/- controls so
- // the accessory panel stays stable while the page contents relayout.
+ // Keep the panel centered under the content area even when the
+ // vertical anchor comes from a specific controls row.
let sidebarWidth = clamp(
windowBounds.width * Layout.sidebarWidthRatio,
lower: Layout.sidebarWidthMin,
@@ -640,6 +668,169 @@ final class PermissionAccessoryPanelController {
return windows.sorted(by: { $0.1 > $1.1 }).first?.0
}
+
+ private func systemSettingsControlsRowRect(in windowBounds: CGRect) -> CGRect? {
+ guard let runningApp = NSWorkspace.shared.runningApplications.first(where: { $0.bundleIdentifier == "com.apple.systempreferences" }) else {
+ return nil
+ }
+
+ let appElement = AXUIElementCreateApplication(runningApp.processIdentifier)
+ guard let windowElement = preferredAXWindow(for: appElement) else {
+ return nil
+ }
+
+ let candidates = collectControlsRowCandidates(in: windowElement, windowBounds: windowBounds)
+ guard !candidates.isEmpty else {
+ return nil
+ }
+
+ switch currentPermission {
+ case .screenRecording:
+ return candidates.max(by: { $0.midY < $1.midY })
+ default:
+ return candidates.min(by: { $0.minY < $1.minY })
+ }
+ }
+
+ private func preferredAXWindow(for appElement: AXUIElement) -> AXUIElement? {
+ copyAXElement(appElement, attribute: kAXFocusedWindowAttribute)
+ ?? copyAXElement(appElement, attribute: kAXMainWindowAttribute)
+ ?? copyAXArray(appElement, attribute: kAXWindowsAttribute)?.first
+ }
+
+ private func collectControlsRowCandidates(in root: AXUIElement, windowBounds: CGRect) -> [CGRect] {
+ let elements = flattenedAXDescendants(of: root, maxDepth: 8, maxNodes: 400)
+ let symbolButtons = elements.compactMap { symbolButtonDescriptor(for: $0) }
+ guard !symbolButtons.isEmpty else {
+ return []
+ }
+
+ let contentTrackRect = systemSettingsContentTrackRect(in: windowBounds)
+ let controlButtons = symbolButtons.filter { descriptor in
+ let frame = descriptor.frame
+ return frame.intersects(windowBounds) &&
+ frame.midX >= contentTrackRect.minX - 24 &&
+ frame.midX <= contentTrackRect.maxX &&
+ frame.width <= 40 &&
+ frame.height <= 40
+ }
+
+ let plusButtons = controlButtons.filter { $0.symbol == "+" }
+ let minusButtons = controlButtons.filter { $0.symbol == "-" }
+
+ return plusButtons.compactMap { plusButton in
+ let matchingMinusButtons = minusButtons.filter { minusButton in
+ abs(minusButton.frame.midY - plusButton.frame.midY) <= 10 &&
+ minusButton.frame.minX >= plusButton.frame.maxX - 4 &&
+ minusButton.frame.minX - plusButton.frame.maxX <= 28
+ }
+
+ guard let minusButton = matchingMinusButtons.min(by: {
+ abs($0.frame.midY - plusButton.frame.midY) < abs($1.frame.midY - plusButton.frame.midY)
+ }) else {
+ return nil
+ }
+
+ return plusButton.frame.union(minusButton.frame)
+ }
+ }
+
+ private func flattenedAXDescendants(of root: AXUIElement, maxDepth: Int, maxNodes: Int) -> [AXUIElement] {
+ var results: [AXUIElement] = []
+ var queue: [(AXUIElement, Int)] = [(root, 0)]
+
+ while !queue.isEmpty, results.count < maxNodes {
+ let (element, depth) = queue.removeFirst()
+ results.append(element)
+
+ guard depth < maxDepth else {
+ continue
+ }
+
+ for child in copyAXArray(element, attribute: kAXChildrenAttribute) ?? [] {
+ queue.append((child, depth + 1))
+ }
+ }
+
+ return results
+ }
+
+ private func symbolButtonDescriptor(for element: AXUIElement) -> (symbol: String, frame: CGRect)? {
+ guard stringAXAttribute(element, attribute: kAXRoleAttribute) == kAXButtonRole as String else {
+ return nil
+ }
+
+ guard let frame = frame(of: element) else {
+ return nil
+ }
+
+ let rawLabels = [
+ stringAXAttribute(element, attribute: kAXTitleAttribute),
+ stringAXAttribute(element, attribute: kAXDescriptionAttribute),
+ stringAXAttribute(element, attribute: kAXValueAttribute)
+ ]
+ .compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
+ .filter { !$0.isEmpty }
+
+ guard let symbol = rawLabels.first(where: { $0 == "+" || $0 == "-" }) else {
+ return nil
+ }
+
+ return (symbol, frame)
+ }
+
+ private func frame(of element: AXUIElement) -> CGRect? {
+ var positionValue: CFTypeRef?
+ var sizeValue: CFTypeRef?
+ guard
+ AXUIElementCopyAttributeValue(element, kAXPositionAttribute as CFString, &positionValue) == .success,
+ AXUIElementCopyAttributeValue(element, kAXSizeAttribute as CFString, &sizeValue) == .success,
+ let positionValue,
+ let sizeValue
+ else {
+ return nil
+ }
+
+ let positionAXValue = positionValue as! AXValue
+ let sizeAXValue = sizeValue as! AXValue
+ var position = CGPoint.zero
+ var size = CGSize.zero
+ guard
+ AXValueGetValue(positionAXValue, .cgPoint, &position),
+ AXValueGetValue(sizeAXValue, .cgSize, &size)
+ else {
+ return nil
+ }
+
+ return CGRect(origin: position, size: size)
+ }
+
+ private func copyAXElement(_ element: AXUIElement, attribute: String) -> AXUIElement? {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(element, attribute as CFString, &value) == .success else {
+ return nil
+ }
+
+ return value as? AXUIElement
+ }
+
+ private func copyAXArray(_ element: AXUIElement, attribute: String) -> [AXUIElement]? {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(element, attribute as CFString, &value) == .success else {
+ return nil
+ }
+
+ return value as? [AXUIElement]
+ }
+
+ private func stringAXAttribute(_ element: AXUIElement, attribute: String) -> String? {
+ var value: CFTypeRef?
+ guard AXUIElementCopyAttributeValue(element, attribute as CFString, &value) == .success else {
+ return nil
+ }
+
+ return value as? String
+ }
}
@MainActor
diff --git a/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift b/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift
index b91dc2c..d6985f2 100644
--- a/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift
+++ b/apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift
@@ -34,7 +34,7 @@ final class MCPClient {
_ = try request(method: "initialize", params: [
"clientInfo": [
"name": "OpenComputerUseSmokeSuite",
- "version": "0.1.6",
+ "version": "0.1.7",
],
"capabilities": [:],
"protocolVersion": "2025-03-26",
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 074d5de..a9a9f1a 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -30,7 +30,7 @@
- `OpenComputerUse` 默认 app 模式会拉起 `PermissionOnboardingApp`。
- app bundle 以 `LSUIElement` agent-style 形态运行,默认不在 Dock 暴露常驻图标,但仍可按需显示权限窗口。
- 主窗口负责渲染 `Accessibility` / `Screen & System Audio Recording` 两类权限卡片、`Allow` / `Done` 状态和 relaunch 后的状态收敛。
-- 辅助 drag panel 会跳转到对应的 `System Settings` 页面,并把 app bundle 拖拽 tile 锚到该窗口右侧内容区的底边;它不再跟随 `Accessibility` 列表里的 `Add` / `Remove` 控件,避免页面局部布局变化导致 panel 漂移。
+- 辅助 drag panel 会跳转到对应的 `System Settings` 页面;默认保持在窗口右侧内容区下方居中,并优先跟随当前权限页 `+ / -` 控制行的垂直位置,只有拿不到控件几何时才回退到窗口底边,避免在不同权限页里掉到屏幕最下方。
- 权限状态优先基于 TCC 持久授权记录判断,避免 CLI 子进程与 GUI app 对授权状态看到不一致的结果。
### 2. MCP 层
diff --git a/docs/exec-plans/active/20260417-permission-onboarding-app.md b/docs/exec-plans/active/20260417-permission-onboarding-app.md
index b2fd311..7033eaa 100644
--- a/docs/exec-plans/active/20260417-permission-onboarding-app.md
+++ b/docs/exec-plans/active/20260417-permission-onboarding-app.md
@@ -73,7 +73,7 @@
- 2026-04-17:权限 onboarding 直接做进 `OpenComputerUse` 主 target,而不是另起一个完全独立的 helper app。这样 `mcp` CLI 和 app bundle 可复用同一个可执行文件与 bundle 身份。
- 2026-04-17:权限状态判定加入对 TCC 持久授权记录的读取,避免 dev 环境里 CLI 子进程与 GUI app 对同一 bundle 权限状态看到不一致的结果。
-- 2026-04-17:drag panel 仍然只在 `System Settings` 前台时显示,但定位策略已从 `Add` / `Remove` 控制区改成跟随主窗口右侧内容区的底边,避免 panel 被列表局部控件牵着跑。
+- 2026-04-17:drag panel 仍然只在 `System Settings` 前台时显示;水平位置维持窗口右侧内容区居中,垂直位置优先跟随当前权限页的 `+ / -` 控制行,只有拿不到控件几何时才回退到窗口底边,避免在 `Screen & System Audio Recording` 这类长页面里被吸到屏幕最下方。
- 2026-04-17:app 模式改成 `LSUIElement` + `.accessory` agent-style 运行,保证权限窗口可见,但执行过程中不再额外在 Dock 暴露前台 app 图标。
## 当前结论
diff --git a/docs/histories/2026-04/20260417-2122-fix-permission-panel-tracking.md b/docs/histories/2026-04/20260417-2122-fix-permission-panel-tracking.md
index c9898cf..e9a7a29 100644
--- a/docs/histories/2026-04/20260417-2122-fix-permission-panel-tracking.md
+++ b/docs/histories/2026-04/20260417-2122-fix-permission-panel-tracking.md
@@ -12,13 +12,14 @@
**Scope:** `apps/OpenComputerUse`, `docs/`
**Key Actions:**
-- **[改掉控件级锚点]**: 删除基于 `Accessibility` 页 `Add` / `Remove` 按钮区域的定位逻辑,不再用局部控件驱动辅助 panel 的位置。
-- **[改成窗口级跟随]**: 辅助 panel 现在改为跟随 `System Settings` 主窗口右侧内容区的底边,并继续按可见屏幕范围做 clamp。
-- **[同步文档]**: 更新架构说明和权限 onboarding execution plan,移除“锚到 `Add` / `Remove`”的过时描述。
+- **[补回控件级垂直锚点]**: 通过 `System Settings` 的 Accessibility 树扫描 `+ / -` 按钮行,优先用该控制行作为 panel 的垂直跟随目标。
+- **[保留内容区水平对齐]**: panel 仍然按 `System Settings` 右侧内容区居中,只有在拿不到 `+ / -` 控件几何时才回退到窗口底边。
+- **[同步文档]**: 更新架构说明和权限 onboarding execution plan,反映“优先跟随 `+ / -` 行、失败再回退”的最新行为。
### 🧠 Design Intent (Why)
-这次修复的重点不是简单把 panel 换个坐标,而是把定位源从“页面里最脆弱的局部控件”切回“稳定的窗口级几何信息”。这样即使 `Accessibility` 页列表滚动、布局细节变化,拖拽辅助 panel 也会继续贴着 `System Settings` 主窗口走,而不是显得像被 `+ / -` 区域绑住。
+这次修复的重点不是单纯继续拉大窗口级容错,而是把水平和垂直锚点拆开处理。panel 继续维持内容区居中,避免随着局部布局左右漂移;但垂直位置重新跟随 `+ / -` 控制行,这样在 `Screen & System Audio Recording` 这类长页面里也不会被错误钳到底部。
### 📁 Files Modified
- `apps/OpenComputerUse/Sources/OpenComputerUse/PermissionOnboardingApp.swift`
+- `docs/ARCHITECTURE.md`
- `docs/exec-plans/active/20260417-permission-onboarding-app.md`
diff --git a/docs/histories/2026-04/20260417-2255-add-codex-mcp-installer.md b/docs/histories/2026-04/20260417-2255-add-codex-mcp-installer.md
new file mode 100644
index 0000000..5c2fa6a
--- /dev/null
+++ b/docs/histories/2026-04/20260417-2255-add-codex-mcp-installer.md
@@ -0,0 +1,25 @@
+## [2026-04-17 22:55] | Task: 增加 Codex MCP 安装命令
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `GPT-5`
+* **Runtime**: `Codex CLI`
+
+### 📥 User Query
+> 再增加一个 `open-computer-use install-codex-mcp`,可以安装到 Codex 的 `~/.codex/config.toml`;安装前要通过 TOML 检测原配置里是否已经装过,避免重复执行。
+
+### 🛠 Changes Overview
+**Scope:** `scripts/`, `scripts/npm/build-packages.mjs`, `README.md`
+
+**Key Actions:**
+- **新增 MCP 安装脚本**:增加 `scripts/install-codex-mcp.sh`,专门把 `open-computer-use mcp` 写入 Codex 的 `mcp_servers` 配置。
+- **加入 TOML 幂等检测**:写入前先用 `tomllib` 解析现有 `~/.codex/config.toml`,如果同一条 MCP 配置已存在则直接 no-op。
+- **接入 npm CLI 入口**:让全局安装后的 `open-computer-use install-codex-mcp` 直接代理到这个脚本,并同步帮助文本与 README。
+
+### 🧠 Design Intent (Why)
+这个需求本质上是“把 npm CLI 本身作为一个可自安装的 Codex MCP server”。它和 plugin marketplace 安装是两条不同路径,最重要的是不要粗暴地往 `config.toml` 末尾不断追加重复段落。先做一次真正的 TOML 解析,再按目标 section 幂等 upsert,能在保留现有文件格式的同时,避免多次执行把配置堆乱。
+
+### 📁 Files Modified
+- `scripts/install-codex-mcp.sh`
+- `scripts/npm/build-packages.mjs`
+- `README.md`
diff --git a/docs/histories/2026-04/20260417-2310-add-claude-mcp-installer.md b/docs/histories/2026-04/20260417-2310-add-claude-mcp-installer.md
new file mode 100644
index 0000000..48e5100
--- /dev/null
+++ b/docs/histories/2026-04/20260417-2310-add-claude-mcp-installer.md
@@ -0,0 +1,25 @@
+## [2026-04-17 23:10] | Task: 增加 Claude MCP 安装命令
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `GPT-5`
+* **Runtime**: `Codex CLI`
+
+### 📥 User Query
+> 再增加一个 `open-computer-use install-clauce-mcp`,安装到 `~/.claude.json`,参考 Claude 官方 MCP 文档,也要幂等。
+
+### 🛠 Changes Overview
+**Scope:** `scripts/`, `scripts/npm/build-packages.mjs`, `README.md`
+
+**Key Actions:**
+- **新增 Claude 安装脚本**:增加 `scripts/install-claude-mcp.sh`,按 Claude 官方 MCP 文档的 local scope 结构写入当前项目的 `~/.claude.json`。
+- **加入 JSON 幂等检测**:写入前先解析现有 `~/.claude.json`,若当前项目下的同名 MCP 配置已存在且内容一致,则直接 no-op。
+- **接入双命令别名**:npm CLI 同时支持 `install-claude-mcp` 和用户请求里的 `install-clauce-mcp`,都指向同一实现。
+
+### 🧠 Design Intent (Why)
+Claude Code 的 `~/.claude.json` 不是一个只放 MCP 的单用途文件,而是用户状态与项目配置的混合 JSON。这里如果像 TOML 那样用简单字符串拼接很容易破坏现有内容,所以更稳妥的方式是按官方文档先做 JSON 解析,再只更新当前项目路径下的 `mcpServers`。这样既能保证幂等,也能避免把 server 错误装成跨所有项目生效的 user-scope 配置。
+
+### 📁 Files Modified
+- `scripts/install-claude-mcp.sh`
+- `scripts/npm/build-packages.mjs`
+- `README.md`
diff --git a/docs/histories/2026-04/20260417-2340-bump-open-computer-use-to-0.1.7.md b/docs/histories/2026-04/20260417-2340-bump-open-computer-use-to-0.1.7.md
new file mode 100644
index 0000000..a88a160
--- /dev/null
+++ b/docs/histories/2026-04/20260417-2340-bump-open-computer-use-to-0.1.7.md
@@ -0,0 +1,39 @@
+## [2026-04-17 23:40] | Task: 发布 0.1.7
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `GPT-5`
+* **Runtime**: `Codex CLI`
+
+### 📥 User Query
+> 增加个小版本,提交相关改动,git tag 后推送。
+
+### 🛠 Changes Overview
+**Scope:** `apps/OpenComputerUse`, `packages/OpenComputerUseKit`, `plugins/open-computer-use`, `scripts/`, `README.md`, `docs/`
+
+**Key Actions:**
+- **统一版本号**:将插件 manifest、CLI 版本常量、MCP server version、smoke/test 示例和文档中的缓存路径统一 bump 到 `0.1.7`。
+- **收口本轮功能**:将 Codex/Claude MCP 一键安装脚本、npm launcher 帮助更新,以及权限 onboarding panel 定位修复一并纳入本次 patch release。
+- **同步仓库文档**:更新 README、架构文档、active exec plan 与 histories,保证发版后的使用路径和行为描述一致。
+
+### 🧠 Design Intent (Why)
+这次 patch release 的重点是把两类真实用户可见改动正式收口发布:一类是安装路径,新增了面向 Codex 和 Claude Code 的幂等 MCP 安装命令;另一类是权限 onboarding 体验,辅助 panel 重新跟随 `System Settings` 的 `+ / -` 控制行,避免在长页面里掉到屏幕最下方。版本号和文档一起提升到 `0.1.7`,可以避免 npm 包、插件缓存、CLI 自报版本和 README 示例继续错位。
+
+### 📁 Files Modified
+- `plugins/open-computer-use/.codex-plugin/plugin.json`
+- `packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift`
+- `apps/OpenComputerUseSmokeSuite/Sources/OpenComputerUseSmokeSuite/main.swift`
+- `packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift`
+- `scripts/computer-use-cli/main.go`
+- `scripts/computer-use-cli/README.md`
+- `docs/references/codex-computer-use-cli.md`
+- `scripts/install-codex-mcp.sh`
+- `scripts/install-claude-mcp.sh`
+- `scripts/npm/build-packages.mjs`
+- `README.md`
+- `docs/ARCHITECTURE.md`
+- `docs/exec-plans/active/20260417-permission-onboarding-app.md`
+- `docs/histories/2026-04/20260417-2122-fix-permission-panel-tracking.md`
+- `docs/histories/2026-04/20260417-2255-add-codex-mcp-installer.md`
+- `docs/histories/2026-04/20260417-2310-add-claude-mcp-installer.md`
+- `docs/histories/2026-04/20260417-2340-bump-open-computer-use-to-0.1.7.md`
diff --git a/docs/references/codex-computer-use-cli.md b/docs/references/codex-computer-use-cli.md
index f389823..ec964bb 100644
--- a/docs/references/codex-computer-use-cli.md
+++ b/docs/references/codex-computer-use-cli.md
@@ -76,7 +76,7 @@ go run . call list_apps --transport app-server
cd scripts/computer-use-cli
go run . call list_apps \
--transport direct \
- --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.6/scripts/launch-open-computer-use.sh
+ --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.7/scripts/launch-open-computer-use.sh
```
## 什么时候不要再重试 direct
diff --git a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift
index e53df6a..54f37d9 100644
--- a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift
+++ b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/OpenComputerUseVersion.swift
@@ -1,6 +1,6 @@
import Foundation
-public let openComputerUseVersion = "0.1.6"
+public let openComputerUseVersion = "0.1.7"
public func resolvedOpenComputerUseVersion(bundle: Bundle = .main) -> String {
if let version = bundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String,
diff --git a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift
index bac7a6d..187ac5d 100644
--- a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift
+++ b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift
@@ -83,7 +83,7 @@ final class OpenComputerUseKitTests: XCTestCase {
func testInitializeResponseContainsToolsCapability() throws {
let server = StdioMCPServer(service: ComputerUseService())
- let response = server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.6"},"capabilities":{}}}"#)
+ let response = server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.7"},"capabilities":{}}}"#)
XCTAssertNotNil(response)
XCTAssertTrue(response!.contains(#""name":"open-computer-use""#))
XCTAssertTrue(response!.contains(#""tools":{"listChanged":false}"#))
@@ -92,7 +92,7 @@ final class OpenComputerUseKitTests: XCTestCase {
func testInitializeResponseContainsComputerUseInstructions() throws {
let server = StdioMCPServer(service: ComputerUseService())
let response = try XCTUnwrap(
- server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.6"},"capabilities":{}}}"#)
+ server.handle(line: #"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test","version":"0.1.7"},"capabilities":{}}}"#)
)
let data = try XCTUnwrap(response.data(using: .utf8))
let json = try XCTUnwrap(JSONSerialization.jsonObject(with: data) as? [String: Any])
diff --git a/plugins/open-computer-use/.codex-plugin/plugin.json b/plugins/open-computer-use/.codex-plugin/plugin.json
index 22ea4b2..8274c3d 100644
--- a/plugins/open-computer-use/.codex-plugin/plugin.json
+++ b/plugins/open-computer-use/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "open-computer-use",
- "version": "0.1.6",
+ "version": "0.1.7",
"description": "Open-source macOS Computer Use MCP server packaged as a Codex plugin.",
"author": {
"name": "Leo",
diff --git a/scripts/computer-use-cli/README.md b/scripts/computer-use-cli/README.md
index c8ca3ea..81333c2 100644
--- a/scripts/computer-use-cli/README.md
+++ b/scripts/computer-use-cli/README.md
@@ -85,7 +85,7 @@ Example working invocation against `open-computer-use`:
```bash
go run . list-tools \
--transport direct \
- --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.6/scripts/launch-open-computer-use.sh
+ --server-bin ~/.codex/plugins/cache/open-computer-use-local/open-computer-use/0.1.7/scripts/launch-open-computer-use.sh
```
Example working invocation against the official bundled `computer-use`:
diff --git a/scripts/computer-use-cli/main.go b/scripts/computer-use-cli/main.go
index 9164ec4..fbe03f7 100644
--- a/scripts/computer-use-cli/main.go
+++ b/scripts/computer-use-cli/main.go
@@ -21,7 +21,7 @@ import (
const (
cliName = "computer-use-cli"
- cliVersion = "0.1.6"
+ cliVersion = "0.1.7"
defaultTimeout = 60 * time.Second
pluginRootEnvVar = "COMPUTER_USE_PLUGIN_ROOT"
serverBinEnvVar = "COMPUTER_USE_SERVER_BIN"
diff --git a/scripts/install-claude-mcp.sh b/scripts/install-claude-mcp.sh
new file mode 100755
index 0000000..b9403b5
--- /dev/null
+++ b/scripts/install-claude-mcp.sh
@@ -0,0 +1,100 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+claude_config_path="${CLAUDE_CONFIG_PATH:-${HOME}/.claude.json}"
+project_root="$(pwd -P)"
+server_name="open-computer-use"
+command_name="open-computer-use"
+
+usage() {
+ cat <<'EOF'
+Usage: ./scripts/install-claude-mcp.sh
+
+Install the open-computer-use stdio MCP entry into ~/.claude.json for the current project.
+The script is idempotent: if the same MCP server entry already exists, it leaves the file unchanged.
+EOF
+}
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "Unknown argument: $1" >&2
+ usage >&2
+ exit 1
+ ;;
+ esac
+done
+
+python3 - "${claude_config_path}" "${project_root}" "${server_name}" "${command_name}" <<'PY'
+import json
+import sys
+from pathlib import Path
+
+config_path = Path(sys.argv[1])
+project_root = sys.argv[2]
+server_name = sys.argv[3]
+command_name = sys.argv[4]
+desired_entry = {
+ "type": "stdio",
+ "command": command_name,
+ "args": ["mcp"],
+}
+legacy_server_name = "open-codex-computer-use"
+
+if config_path.exists():
+ try:
+ raw = config_path.read_text()
+ data = json.loads(raw) if raw.strip() else {}
+ except json.JSONDecodeError as exc:
+ print(f"Existing Claude config is not valid JSON: {exc}", file=sys.stderr)
+ sys.exit(1)
+else:
+ data = {}
+
+if not isinstance(data, dict):
+ print("Existing Claude config root is not a JSON object; refusing to modify it.", file=sys.stderr)
+ sys.exit(1)
+
+projects = data.setdefault("projects", {})
+if not isinstance(projects, dict):
+ print('Existing Claude config has non-object "projects"; refusing to modify it.', file=sys.stderr)
+ sys.exit(1)
+
+project_entry = projects.setdefault(project_root, {})
+if not isinstance(project_entry, dict):
+ print(f'Existing Claude project entry for {project_root} is not an object; refusing to modify it.', file=sys.stderr)
+ sys.exit(1)
+
+mcp_servers = project_entry.setdefault("mcpServers", {})
+if not isinstance(mcp_servers, dict):
+ print(f'Existing Claude project MCP config for {project_root} is not an object; refusing to modify it.', file=sys.stderr)
+ sys.exit(1)
+
+target = mcp_servers.get(server_name)
+legacy = mcp_servers.get(legacy_server_name)
+
+target_matches = target == desired_entry
+legacy_matches = legacy == desired_entry
+
+if target_matches and not legacy_matches:
+ print(f'Claude MCP server "{server_name}" is already installed for {project_root} in {config_path}.')
+ sys.exit(0)
+
+mcp_servers[server_name] = desired_entry
+
+if legacy_matches:
+ del mcp_servers[legacy_server_name]
+
+config_path.parent.mkdir(parents=True, exist_ok=True)
+config_path.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n")
+
+if target_matches and legacy_matches:
+ print(f'Claude MCP server "{server_name}" was already installed for {project_root}; removed legacy alias "{legacy_server_name}" from {config_path}.')
+else:
+ print(f'Installed Claude MCP server "{server_name}" for {project_root} into {config_path}.')
+PY
diff --git a/scripts/install-codex-mcp.sh b/scripts/install-codex-mcp.sh
new file mode 100755
index 0000000..1ca8bcf
--- /dev/null
+++ b/scripts/install-codex-mcp.sh
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+codex_home="${CODEX_HOME:-${HOME}/.codex}"
+config_path="${codex_home}/config.toml"
+server_name="open-computer-use"
+command_name="open-computer-use"
+
+usage() {
+ cat <<'EOF'
+Usage: ./scripts/install-codex-mcp.sh
+
+Install the open-computer-use stdio MCP entry into ~/.codex/config.toml.
+The script is idempotent: if the same MCP server entry already exists, it leaves the file unchanged.
+EOF
+}
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "Unknown argument: $1" >&2
+ usage >&2
+ exit 1
+ ;;
+ esac
+done
+
+mkdir -p "${codex_home}"
+
+python3 - "${config_path}" "${server_name}" "${command_name}" <<'PY'
+import json
+import re
+import sys
+from pathlib import Path
+
+try:
+ import tomllib
+except ModuleNotFoundError as exc:
+ print(f"python3 with tomllib is required: {exc}", file=sys.stderr)
+ sys.exit(1)
+
+
+def section_pattern(header: str) -> re.Pattern[str]:
+ return re.compile(rf'(?ms)^\[{re.escape(header)}\]\n.*?(?=^\[|\Z)')
+
+
+def remove_section(text: str, header: str) -> str:
+ return section_pattern(header).sub("", text)
+
+
+def upsert_section(text: str, header: str, body: str) -> str:
+ section = f'[{header}]\n{body.rstrip()}\n'
+ pattern = section_pattern(header)
+ if pattern.search(text):
+ return pattern.sub(section, text, count=1)
+
+ if text and not text.endswith("\n"):
+ text += "\n"
+ if text and not text.endswith("\n\n"):
+ text += "\n"
+ return text + section
+
+
+config_path = Path(sys.argv[1])
+server_name = sys.argv[2]
+command_name = sys.argv[3]
+desired_args = ["mcp"]
+legacy_server_name = "open-codex-computer-use"
+
+text = config_path.read_text() if config_path.exists() else ""
+
+try:
+ parsed = tomllib.loads(text) if text.strip() else {}
+except tomllib.TOMLDecodeError as exc:
+ print(f"Existing Codex config is not valid TOML: {exc}", file=sys.stderr)
+ sys.exit(1)
+
+mcp_servers = parsed.get("mcp_servers")
+if mcp_servers is not None and not isinstance(mcp_servers, dict):
+ print('Existing Codex config has non-table "mcp_servers"; refusing to modify it.', file=sys.stderr)
+ sys.exit(1)
+
+target = (mcp_servers or {}).get(server_name)
+legacy = (mcp_servers or {}).get(legacy_server_name)
+
+target_matches = (
+ isinstance(target, dict)
+ and target.get("command") == command_name
+ and target.get("args") == desired_args
+)
+legacy_matches = (
+ isinstance(legacy, dict)
+ and legacy.get("command") == command_name
+ and legacy.get("args") == desired_args
+)
+
+if target_matches and not legacy_matches:
+ print(f'Codex MCP server "{server_name}" is already installed in {config_path}.')
+ sys.exit(0)
+
+body = f'command = {json.dumps(command_name)}\nargs = {json.dumps(desired_args)}'
+text = upsert_section(text, f'mcp_servers."{server_name}"', body)
+
+if legacy_matches:
+ text = remove_section(text, f'mcp_servers."{legacy_server_name}"')
+
+text = re.sub(r"\n{3,}", "\n\n", text).rstrip() + "\n"
+config_path.write_text(text)
+
+if target_matches and legacy_matches:
+ print(f'Codex MCP server "{server_name}" was already installed; removed legacy alias "{legacy_server_name}" from {config_path}.')
+else:
+ print(f'Installed Codex MCP server "{server_name}" into {config_path}.')
+PY
diff --git a/scripts/npm/build-packages.mjs b/scripts/npm/build-packages.mjs
index c5b47b1..f807265 100644
--- a/scripts/npm/build-packages.mjs
+++ b/scripts/npm/build-packages.mjs
@@ -155,6 +155,8 @@ Commands:
list-apps Print running or recently used apps.
snapshot <app> Print the current accessibility snapshot for an app.
turn-ended Acknowledge the host turn boundary.
+ install-claude-mcp Install the MCP server into ~/.claude.json for this project.
+ install-codex-mcp Install the MCP server into ~/.codex/config.toml.
install-codex-plugin Install this npm package into the local Codex plugin cache.
help [command] Show general or command-specific help.
version Print the CLI version.
@@ -179,8 +181,20 @@ while [[ -L "\${script_path}" ]]; do
done
package_root="$(cd "$(dirname "\${script_path}")/.." && pwd)"
app_binary="\${package_root}/dist/${appBundleName}/Contents/MacOS/${appExecutableName}"
+install_claude_mcp_script="\${package_root}/scripts/install-claude-mcp.sh"
+install_mcp_script="\${package_root}/scripts/install-codex-mcp.sh"
install_script="\${package_root}/scripts/install-codex-plugin.sh"
+if [[ "\${1:-}" == "install-claude-mcp" || "\${1:-}" == "install-clauce-mcp" ]]; then
+ shift
+ exec "\${install_claude_mcp_script}" "$@"
+fi
+
+if [[ "\${1:-}" == "install-codex-mcp" ]]; then
+ shift
+ exec "\${install_mcp_script}" "$@"
+fi
+
if [[ "\${1:-}" == "install-codex-plugin" ]]; then
shift
exec "\${install_script}" "$@"
@@ -206,6 +220,27 @@ EOF
exit 0
fi
+if [[ "\${1:-}" == "help" && "\${2:-}" == "install-codex-mcp" ]]; then
+ cat <<'EOF'
+Usage:
+ open-computer-use install-codex-mcp
+
+Install the open-computer-use MCP server into ~/.codex/config.toml.
+EOF
+ exit 0
+fi
+
+if [[ "\${1:-}" == "help" && ( "\${2:-}" == "install-claude-mcp" || "\${2:-}" == "install-clauce-mcp" ) ]]; then
+ cat <<'EOF'
+Usage:
+ open-computer-use install-claude-mcp
+ open-computer-use install-clauce-mcp
+
+Install the open-computer-use MCP server into ~/.claude.json for the current project.
+EOF
+ exit 0
+fi
+
if [[ ! -x "\${app_binary}" ]]; then
echo "open-computer-use could not find a runnable app bundle at \${app_binary}." >&2
exit 1
@@ -234,7 +269,7 @@ const lines = [
"Next:",
"1. Run open-computer-use doctor",
"2. In macOS System Settings, grant Accessibility and Screen Recording to your host terminal or MCP client",
- "3. Start the MCP server with open-computer-use mcp, or install into Codex with open-computer-use install-codex-plugin",
+ "3. Run open-computer-use install-claude-mcp for Claude Code, open-computer-use install-codex-mcp for Codex, or open-computer-use install-codex-plugin for the local plugin cache",
"",
"You can add this to any MCP-capable client:",
JSON.stringify(mcpConfig, null, 2),
@@ -292,6 +327,12 @@ open-computer-use --help
open-computer-use help snapshot
open-computer-use --version
+# Install into Claude Code for the current project
+open-computer-use install-claude-mcp
+
+# Install into Codex as a plain MCP entry in ~/.codex/config.toml
+open-computer-use install-codex-mcp
+
# Check permissions first; if Accessibility / Screen Recording is missing, open the permission onboarding window
open-computer-use doctor
@@ -356,6 +397,8 @@ function renderPackageJson(packageName, version) {
"plugins/open-computer-use/.mcp.json",
"plugins/open-computer-use/assets/",
"plugins/open-computer-use/scripts/",
+ "scripts/install-claude-mcp.sh",
+ "scripts/install-codex-mcp.sh",
"scripts/install-codex-plugin.sh",
"scripts/postinstall.mjs",
"README.md",
@@ -381,6 +424,8 @@ function stagePackage(packageName, version, outDir) {
cpSync(path.join(repoRoot, "plugins", "open-computer-use"), path.join(packageRoot, "plugins", "open-computer-use"), {
recursive: true,
});
+ cpSync(path.join(repoRoot, "scripts", "install-claude-mcp.sh"), path.join(packageRoot, "scripts", "install-claude-mcp.sh"));
+ cpSync(path.join(repoRoot, "scripts", "install-codex-mcp.sh"), path.join(packageRoot, "scripts", "install-codex-mcp.sh"));
cpSync(path.join(repoRoot, "scripts", "install-codex-plugin.sh"), path.join(packageRoot, "scripts", "install-codex-plugin.sh"));
cpSync(path.join(repoRoot, "LICENSE"), path.join(packageRoot, "LICENSE"));
@@ -391,6 +436,8 @@ function stagePackage(packageName, version, outDir) {
writeFileSync(path.join(packageRoot, "README.md"), renderReadme(packageName, version), "utf-8");
writeFileSync(path.join(packageRoot, "package.json"), `${JSON.stringify(renderPackageJson(packageName, version), null, 2)}\n`, "utf-8");
+ chmodSync(path.join(packageRoot, "scripts", "install-claude-mcp.sh"), 0o755);
+ chmodSync(path.join(packageRoot, "scripts", "install-codex-mcp.sh"), 0o755);
chmodSync(path.join(packageRoot, "scripts", "install-codex-plugin.sh"), 0o755);
removeJunkFiles(packageRoot);
}