Repository navigation
Add Code Mode with Browser REPL and WebMCP cookbook - #644
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
There was a problem hiding this comment.
Risk: Very Low. Approving.
The diff is documentation for the Mintlify site only:
- New cookbook page
browsers/code-mode-browser-repl.mdx(fenced TypeScript and Python examples, including a sample system prompt). Those samples are rendered as docs; this repo does not load them as model instructions or run them. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand a single Common Patterns nav entry indocs.json. - A static card image,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file, and the main ruleset has require_code_owner_review off. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after ad78ac3 (Rebuild code mode cookbook on AI SDK ToolLoopAgent). Risk did not increase, so the existing approval stays. Not approving again.
The new commit only rewrites browsers/code-mode-browser-repl.mdx. Against main, the PR is still documentation and navigation:
- New cookbook page with a fenced TypeScript example (including a sample
INSTRUCTIONSstring). This Mintlify repo renders that page; it does not load the file as model instructions or execute the sample. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand one Common Patterns nav entry indocs.json. - A static PNG,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after e183c60 (Rename cookbook to Entering Code Mode with Browser REPL). Risk did not increase, so the existing approval stays. Not approving again.
That commit only renames the page title, the cookbook card title, and the cross-link text. Against main, the PR is still Mintlify documentation and navigation:
- New cookbook page
browsers/code-mode-browser-repl.mdx. TheINSTRUCTIONSstring is inside a fenced TypeScript sample on a docs page (frontmatter plus adocs.jsonnav entry). This repo does not load that file as model instructions or execute the sample. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand one Common Patterns nav entry indocs.json. - A static PNG,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file, and the main ruleset has require_code_owner_review off. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after 862cdc7 (Use Kernel MCP browser_repl in the code mode cookbook). Risk did not increase, so the existing approval stays. Not approving again.
That commit only rewrites browsers/code-mode-browser-repl.mdx. The sample now connects an AI SDK ToolLoopAgent to the Kernel MCP server and limits browser control to browser_repl. The agent instructions string is still inside a fenced TypeScript sample on a Mintlify docs page. This repo renders that page; it does not load the file as model instructions or execute the sample.
Against main, the PR is still documentation and navigation:
- New cookbook page
browsers/code-mode-browser-repl.mdx. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand one Common Patterns nav entry indocs.json. - A static PNG,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file, and the main ruleset has require_code_owner_review off. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Risk: Very Low. Re-checked after 149700f (Frame code mode cookbook around any agent harness). Risk did not increase, so the existing approval stays. Not approving again.
That commit only rewrites prose in browsers/code-mode-browser-repl.mdx and the card blurb in cookbooks.mdx. The page is now framed as applying to any tool-calling harness, with the same AI SDK sample. The fenced TypeScript example, including the agent instructions string, is unchanged. This repo renders the page as Mintlify docs; it does not load the file as model instructions or run the sample.
Against main, the PR is still documentation and navigation:
- New cookbook page
browsers/code-mode-browser-repl.mdx. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand one Common Patterns nav entry indocs.json. - A static PNG,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after 0b23cae (Add WebMCP-first step and disable reporting tools in code mode cookbook). Risk did not increase, so the existing approval stays. Not approving again.
That commit only edits browsers/code-mode-browser-repl.mdx. It adds WebMCP cookbook prose and updates the fenced TypeScript sample: DISABLED_TOOLS also drops get_more_tools and submit_feedback, and the sample instructions string now describes webmcp plus browser_repl. Those strings sit inside a code fence on a Mintlify page registered in docs.json. This repo renders the page; it does not load the file as model instructions or run the sample.
Against main, the PR is still documentation and navigation:
- New cookbook page
browsers/code-mode-browser-repl.mdx. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand one Common Patterns nav entry indocs.json. - A static PNG,
images/cookbooks/code-mode.png.
No application logic, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file, and the main ruleset has require_code_owner_review off. Blast radius is the published docs page and its nav entry.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b23cae. Configure here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after a1c1dd0 (Let the agent own the browser lifecycle through Kernel MCP). Risk did not increase, so the existing approval stays. Not approving again.
That commit only edits browsers/code-mode-browser-repl.mdx. The fenced TypeScript sample now has the agent create and delete its browser through Kernel MCP (manage_browsers, manage_replays), with a harness finally that deletes a leftover session by name. The agent instructions string inside that sample is documentation, not a prompt this repo loads.
Against main, the PR is still Mintlify documentation and navigation:
- New cookbook page
browsers/code-mode-browser-repl.mdx - One cross-link sentence in
browsers/repl.mdx - A cookbook card in
cookbooks.mdx - One Common Patterns nav entry in
docs.json - A cookbook card image
No application code, auth, infrastructure, or shared runtime paths changed. No CODEOWNERS file applies.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after 464e61b (Rename cookbook to Code Mode with WebMCP Structured Tools). Risk did not increase, so the existing approval stays. Not approving again.
That commit only renames documentation labels:
browsers/webmcp-code-mode-fallback.mdx— page title is now "Code Mode with WebMCP Structured Tools", andsidebarTitleis removed.cookbooks.mdx— matching card title.browsers/repl.mdx— the cross-link text uses the new title. The URL is unchanged.
The fenced TypeScript sample, including the agent INSTRUCTIONS string, is unchanged. Against main, the PR is still Mintlify documentation and navigation only: a new cookbook page, a cookbook card, one nav entry in docs.json, a one-sentence cross-link, a sidebar title on the Playwright cookbook, and a cookbook image. Those pages are rendered docs. This repo does not load them as model instructions or run the sample. No application logic, auth, infrastructure, or shared runtime code changed.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Risk: Very Low. Re-checked after ae3858b (Move cookbook to /browsers/code-mode-webmcp), following 63b90ce and 0931531. Risk did not increase, so the existing approval stays. Not approving again.
Those three commits only rename the cookbook and its URL:
browsers/webmcp-code-mode-fallback.mdxis renamed tobrowsers/code-mode-webmcp.mdx. The page title is now "Code Mode with Browser REPL and WebMCP", withsidebarTitle: "Code Mode with WebMCP". The fenced sample's example filename iscode-mode-webmcp.ts. The agentINSTRUCTIONSstring is unchanged.browsers/repl.mdx,cookbooks.mdx, anddocs.jsonupdate the title and path to match.
Against main, the diff is still Mintlify documentation and navigation:
- New cookbook page
browsers/code-mode-webmcp.mdx. TheINSTRUCTIONSstring sits inside a fenced TypeScript sample.docs.jsononly adds the page to the Common Patterns nav. This repo renders the page; it does not load the file as model instructions or run the sample. - One
sidebarTitleline inbrowsers/playwright-computer-use-fallback.mdx. - One cross-link sentence in
browsers/repl.mdx. - A cookbook card in
cookbooks.mdxand a static card image,images/cookbooks/code-mode.png.
No application code, auth, permissions, infrastructure, CI, or schema changes. No CODEOWNERS file. Blast radius is the published docs pages and their nav entries.
Sent by Cursor Automation: Assign PR reviewers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AnnaXWang
left a comment
There was a problem hiding this comment.
made some changes for clarity and getting into the code quicker!



Summary
Adds a Common Patterns cookbook, Code Mode with Browser REPL and WebMCP, at
/browsers/code-mode-webmcp. It shows how any agent harness can run fully in code mode. The model's only browser-control tool is the Browser REPL. From code, it calls the page's WebMCP tools (webmcp.listTools()/webmcp.invokeTool()) when one fits, and uses the REPL's browser helpers for everything else.The page has two parts:
browser_repltool, or your own wrapper aroundkernel.browsers.repl()ToolLoopAgentrunninggpt-6-lunaat medium reasoning.mcp.onkernel.comthrough@ai-sdk/mcp.activeToolsallows exactly two tools:manage_browsersfor the agent's own session, andbrowser_replfor everything else.Other changes:
code-mode.pngimage, which passescookbook_card.py check.The example is TypeScript-only because AI SDK is TypeScript-only.
Testing
Ran the example end to end against production across a number of runs, including once from a fresh install following the page's Setup steps. It completed the task every time.
🤖 Generated with Claude Code
Note
Low Risk
Documentation and navigation only; no product code or runtime behavior changes.
Overview
Adds a Common Patterns cookbook at
/browsers/code-mode-webmcpthat documents code mode for browser agents: onebrowser_repltool, WebMCP viawebmcp.listTools()/webmcp.invokeTool()inside REPL cells, and REPL helpers for everything else.The page includes a runnable AI SDK
ToolLoopAgentexample (Kernel MCP,activeToolslimited tomanage_browsers+browser_repl, 150s REPL timeout, session cleanup) and framework-agnostic guidance on lifecycle, timeouts, no retries, and “write programs not single actions.”Docs wiring: new entry in
docs.jsonCommon Patterns, cookbook card oncookbooks.mdx, cross-link from Browser REPL multi-step use case, and a shortersidebarTitleon the Playwright computer-use fallback page.Reviewed by Cursor Bugbot for commit 51a3e31. Bugbot is set up for automated code reviews on this repo. Configure here.