用途:讓 OpenCode 能控制瀏覽器與桌面應用,屬於加碼包而非研習主線。主要能力包含安裝 Playwright MCP(網頁控制)、安裝 open-computer-use(桌面自動化)、寫入 opencode.json 設定並驗證連線。先備條件為 Node.js 18+ 已安裝且電腦有網路。
使用方式:步驟一編輯 ~/.config/opencode/opencode.json,加入 playwright 的 MCP 設定,command 為 ["npx", "-y", "@playwright/mcp"],type 為 local、enabled 為 true。步驟二執行 npm install -g open-computer-use,並以 open-computer-use --version 確認指令可用。步驟三寫入 open-computer-use 的 MCP 設定,command 為 ["open-computer-use", "mcp"];官方提醒不要用 npx,因為其 MCP server 需以 open-computer-use mcp 子命令啟動,用 npx -y open-computer-use 不會正確暴露 MCP 工具。Windows 注意:npx open-computer-use install-opencode-mcp 會提示 requires a POSIX shell,請手動編輯設定檔。之後重新開啟 OpenCode,以「請開啟 https://example.com 並告訴我頁面標題是什麼」驗證 Playwright,以「請截圖我的桌面(或特定視窗)」驗證 open-computer-use。
輕量替代方案:若只需簡單網頁操作(導航、截圖、內容擷取),可用 CLI-Anything Browser CLI,安裝指令為 pip install cli-anything-hub 與 cli-hub install browser,使用範例包含 cli-anything-browser navigate https://example.com、cli-anything-browser screenshot --output page.png、cli-anything-browser extract --selector "main"。Playwright MCP 適合完整瀏覽器自動化與表單填寫,Browser CLI 適合快速輕量的網頁資料擷取,兩者可並存。
限制與常見問題:Playwright 首次執行下載瀏覽器較慢,只需等待一次;open-computer-use 找不到視窗時,確認目標應用正在執行;若 npx open-computer-use 工具不出現,改用 command: ["open-computer-use", "mcp"];Windows 上 install-opencode-mcp 報錯時,手動編輯 opencode.json,不執行自動安裝。其餘收費、平台與效果資訊暫未提供。