-
Notifications
You must be signed in to change notification settings - Fork 64
Feature/computer use integration #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tuannvm
wants to merge
6
commits into
main
Choose a base branch
from
feature/computer-use-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
239590d
feat(computer-use): add macOS computer control via Codex binary
tuannvm ba7d028
docs: add computer use documentation
tuannvm 7584735
docs(computer-use): update Codex.app binary setup docs
tuannvm 7255d86
feat(browser-use): replace macOS computer-use with Playwright browser…
tuannvm 0a30c40
feat(browser): consolidate to single MCP tool with type-safe handlers
tuannvm 3057cde
fix(browser-use): address CodeRabbit PR review comments
tuannvm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,4 @@ temp/ | |
|
|
||
| # Jest cache | ||
| .jest/ | ||
| .claude/harness/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| # Browser Use | ||
|
|
||
| Playwright-based browser automation. Launch a real Chromium browser, take screenshots, click, type, scroll, drag, and navigate — all via MCP tools. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| Claude Code | ||
| → codex-mcp-server | ||
| → BrowserUseBridge (singleton, lazy init) | ||
| → Playwright (peer dependency) | ||
| → Chromium instances | ||
| ``` | ||
|
|
||
| The bridge manages multiple concurrent browser sessions. Playwright is only imported on first use — no impact on codex/review startup when browser tools aren't used. | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| npm install playwright | ||
| npx playwright install chromium | ||
| ``` | ||
|
|
||
| Playwright is a **peer dependency** — install it separately. The server works fine without it; browser tools will return a helpful error if Playwright isn't available. | ||
|
|
||
| ## Tools | ||
|
|
||
| ### `browser_status` — Health Check | ||
|
|
||
| Works even without Playwright installed. Returns availability, active sessions, and any error. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session" } | ||
| ``` | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### `browser_launch` — Launch Browser | ||
|
|
||
| Creates a new browser session. Supports multiple concurrent sessions with unique IDs. | ||
|
|
||
| ```json | ||
| { | ||
| "sessionId": "my-session", | ||
| "url": "https://example.com", | ||
| "headless": true, | ||
| "viewportWidth": 1440, | ||
| "viewportHeight": 900 | ||
| } | ||
| ``` | ||
|
|
||
| ### `browser_screenshot` — Take Screenshot | ||
|
|
||
| Returns base64 PNG image data along with the current page URL and title. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session" } | ||
| ``` | ||
|
|
||
| ### `browser_click` — Click | ||
|
|
||
| Click at viewport-relative pixel coordinates. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "x": 100, "y": 200, "button": "left", "clickCount": 1 } | ||
| ``` | ||
|
|
||
| ### `browser_type` — Type Text | ||
|
|
||
| Type literal text into the currently focused element. Click on an input field first. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "text": "hello world" } | ||
| ``` | ||
|
|
||
| ### `browser_scroll` — Scroll | ||
|
|
||
| Scroll the page in a direction by a pixel amount. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "direction": "down", "amount": 300 } | ||
| ``` | ||
|
|
||
| ### `browser_drag` — Drag | ||
|
|
||
| Drag from one coordinate to another (viewport-relative). | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "fromX": 100, "fromY": 100, "toX": 300, "toY": 300 } | ||
| ``` | ||
|
|
||
| ### `browser_key` — Key Press | ||
|
|
||
| Press a key or key combination. Supports Playwright key names. Modifier keys are auto-normalized: `Cmd` → `Meta`, `Ctrl` → `Control`, `Opt` → `Alt`, etc. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "key": "Control+a" } | ||
| { "sessionId": "my-session", "key": "Cmd+s" } | ||
| ``` | ||
|
|
||
| ### `browser_navigate` — Navigate | ||
|
|
||
| Go to a URL in the current page. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session", "url": "https://example.com" } | ||
| ``` | ||
|
|
||
| ### `browser_close` — Close Session | ||
|
|
||
| Close a browser session and clean up resources. | ||
|
|
||
| ```json | ||
| { "sessionId": "my-session" } | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **"Playwright is not installed"** | ||
| Install it: `npm install playwright && npx playwright install chromium` | ||
|
|
||
| **"Session already exists"** | ||
| Use a different sessionId or close the existing session first with `browser_close`. | ||
|
|
||
| **"No active browser session"** | ||
| You must call `browser_launch` before using other browser tools. | ||
|
|
||
| **Screenshots not loading** | ||
| Check that the client supports `image` content type in MCP tool results. Claude Code supports this natively. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.