Skip to content

Add persistent Browser REPL MCP tool - #195

Merged
rgarcia merged 5 commits into
mainfrom
raf/browser-repl-tool
Sep 23, 2026
Merged

rgarcia merged 5 commits into
mainfrom
raf/browser-repl-tool

Conversation

@rgarcia

@rgarcia rgarcia commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • upgrade @onkernel/sdk from ^0.106.0 to ^0.107.0
  • add execute_browser_repl for persistent JavaScript execution inside an existing browser VM
  • preserve structured REPL status/text metadata and return emitted images as native MCP image content
  • register a standalone repl toolset and execute_browser_repl alias
  • document the new tool and steer WebMCP fallbacks toward it

Agent instructions

The tool description is derived from kernel-images/server/docs/repl.md and covers:

  • persistent bindings, JavaScript-only syntax, explicit output, reset, and destructive failure semantics
  • native browser helpers, accessibility/backend-node actions, semantic waits, exact-once page evaluation, raw CDP, and WebMCP safety
  • unrestricted VM-code-execution boundaries
  • a complete Patchright/Playwright example that persists playwright, pwBrowser, pwContext, and pwPage
  • a complete raw-CDP-only example using browser-level target creation, a flattened target session, exact navigation, load observation, and compact evaluation output

Contract

Inputs:

  • session_id: live browser ID or name
  • code: one JavaScript cell; may be empty only with reset=true
  • reset: replace the persistent REPL before evaluation
  • timeout_sec: 1-150 seconds, default 60
  • standard project selection

The MCP transport deadline outlasts the execution deadline by 30 seconds and automatic retries are disabled. JavaScript failures remain structured success=false results; transport/API failures use the shared error classifier.

Testing

  • bun test — 610 passed
  • bunx tsc --noEmit
  • targeted Prettier check
  • git diff --check
  • bun run build — production build passed with local environment configuration

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mcp Ready Ready Preview Sep 22, 2026 11:21pm UTC

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1fafd1e. Configure here.

Comment thread src/lib/mcp/tools/browser-repl.ts Outdated

@masnwilliams masnwilliams left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the latest commit. The REPL integration, response projection, tool registration, and tests look sound; no blocking issues found.

@rgarcia
rgarcia merged commit e2f0cba into main Sep 23, 2026
10 checks passed
@rgarcia
rgarcia deleted the raf/browser-repl-tool branch September 23, 2026 02:27

This branch was successfully deployed

1 active deployment
Preview 23647a29 Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants