zen
This MCP server lets Claude Code control Zen/Firefox as a browser automation tool.
List, create, and close tabs, and navigate URLs or browser history.
Take screenshots, click, drag, hover, scroll, type, and press keys with trusted input events.
Read the page structure, find elements by description, and extract readable page text.
Fill forms and set inputs, selects, checkboxes, radios, switches, and contenteditable editors.
Upload local files into file inputs.
Run JavaScript in the page with REPL-style evaluation and top-level await.
Read console messages, uncaught exceptions, and network requests.
Accept or dismiss alert, confirm, prompt, and beforeunload dialogs.
Resize the browser window for responsive testing.
Record and export animated GIFs of browser actions.
Run short batches of browser tool calls in sequence.
Provides browser automation for Firefox-based browsers such as Zen, enabling tab management, navigation, page reading, clicking, typing, form filling, JavaScript execution, console and network log reading, dialog handling, file uploads, and GIF recording via WebDriver BiDi.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@zen open my GitHub notifications in Zen and summarize what needs review"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
claude-for-zen
Let Claude Code drive Zen Browser the way Claude in Chrome drives Chrome.
claude-for-zen is an MCP server that gives Claude Code a full set of browser tools for Zen (or any Firefox-based browser): it opens tabs, reads pages, clicks, types, fills forms, runs JavaScript, reads console and network logs, handles dialogs, uploads files and records GIFs. Clicks and keystrokes are real, trusted input events, so sites behave as they do for a person.
Unofficial community project. Not affiliated with or endorsed by Anthropic or the Zen Browser team.
you ▸ open my GitHub notifications in Zen and summarise anything that needs my review
Claude ▸ tabs_create → navigate github.com/notifications → read_page → find "Review requested" → …How it works
Claude Code ──stdio (MCP)──▶ claude-for-zen ──WebDriver BiDi (ws://127.0.0.1:9333)──▶ ZenClaude in Chrome uses a Chrome extension and the Chrome DevTools Protocol. Firefox (and therefore Zen) does not expose an equivalent API to extensions, but it ships WebDriver BiDi, the W3C browser automation protocol, built in. claude-for-zen talks BiDi straight to Zen, so no extension is needed:
Capability | How |
Screenshots |
|
Clicks, typing, keys, scroll, drag |
|
Page structure, | A small runtime injected into an isolated sandbox (page scripts can't see or tamper with it), producing an accessibility-tree outline with stable |
JavaScript |
|
Console and network |
|
Dialogs |
|
Related MCP server: Kamurafox
Two ways to run it
Your everyday Zen ( | Claude's own profile (default) | |
Where Claude works | A Zen window of its own in your profile: your logins work, and Zen keeps it apart from your tabs. It comes to the front when Claude starts and closes when Claude closes its last tab ( | A separate Zen window with its own profile |
Your logins, extensions, bookmarks | Available | Sign in once inside Claude's profile ( |
Setup cost | With | None; Claude's Zen starts on first use |
Side effects on your browsing | With | None |
Pick the everyday mode if you want Claude to work in your normal browser with your accounts. Pick the dedicated mode if you want automation kept apart from your personal browsing.
Requirements
Zen Browser (or a recent Firefox; set
ZEN_BINARY)Node.js 20+
macOS, Linux and Windows are supported. Zen and your profile are auto-detected in their usual locations.
Install
git clone https://github.com/ilhamnadhif/claude-for-zen.git
cd claude-for-zen
npm install
# Either: Claude works in your everyday Zen profile (its own window, your logins),
# and Zen never needs a restart (installs the "Claude for Zen" helper add-on)
node bin/claude-for-zen.js install --no-restart
# Or: everyday profile without the add-on (Zen is restarted once when needed)
node bin/claude-for-zen.js install --existing-profile
# Or: Claude gets its own separate Zen profile
node bin/claude-for-zen.js install
node bin/claude-for-zen.js doctor # optional: checks everythingOr register it without cloning:
claude mcp add --scope user zen -e ZEN_PROFILE_MODE=existing -- npx -y github:ilhamnadhif/claude-for-zenStart a new Claude Code session and ask for something in Zen ("open example.com in Zen and take a screenshot"). The tools appear as mcp__zen__*.
--no-restart, first use: the next time Zen starts it shows that "Claude for Zen" was added; choose Enable. That's all: from then on Claude switches remote control on when it needs Zen and off when it is done, while Zen keeps running. (Until then Claude falls back to the restart below.)
Everyday mode without the add-on, first use: if Zen is open, Claude tells you it needs to restart Zen once and waits for your OK (on Linux and Windows it asks you to quit Zen, then opens it again itself). You can avoid that by quitting Zen and starting it with node bin/claude-for-zen.js launch (on macOS also launch --restart). Remote control then stays on until you quit Zen.
Dedicated mode: to sign in to sites for Claude, open its profile with node bin/claude-for-zen.js launch and log in as usual.
To remove it: node bin/claude-for-zen.js uninstall (or claude mcp remove --scope user zen).
Tools
Everything Claude in Chrome offers, plus dialog handling, file uploads and window resizing.
Tool | What it does | Claude in Chrome equivalent |
| List Claude's tabs ( |
|
| Open a new tab, optionally at a URL |
|
| Close a tab Claude opened ( |
|
| Go to a URL, or |
|
|
|
|
| Accessibility-tree outline with refs, including iframe contents; |
|
| Find elements by description ("search bar", "Sign in button") |
|
| Set inputs, textareas, selects, checkboxes, radios, contenteditable editors (React/Vue friendly) |
|
| Readable text of the page, article first |
|
| Run JavaScript in the page |
|
| Console logs and uncaught exceptions, with regex filter |
|
| HTTP requests with status/type/size; secrets in URLs redacted |
|
| Record actions to an animated GIF (clicks marked) |
|
| Run several tool calls in one go |
|
| Accept or dismiss | — |
| Put local files into an |
|
| Resize the window (responsive testing) |
|
Configuration
Set environment variables with claude-for-zen install -e KEY=VALUE or claude mcp add -e KEY=VALUE.
Variable | Default | Meaning |
|
|
|
|
| Everyday mode: use the "Claude for Zen" add-on so Zen never needs a restart ( |
|
| Let several Claude Code sessions use the same Zen at once through the local session broker. |
|
| Everyday mode: Claude opens its tabs in a window of its own (same profile). |
|
| Everyday mode on macOS, Zen open without remote control: |
| see meaning | Profile directory. Dedicated: |
| auto-detected | Path to the Zen (or Firefox) executable |
|
| Remote debugging port |
| — | Connect to this BiDi endpoint and never launch Zen |
|
| Never launch Zen; connect to |
|
| Launch Zen without a window |
|
| While Claude is connected, report |
|
| Dedicated mode: quit Claude's Zen when the server exits (by default it keeps running, like Chrome does). Your everyday Zen is never quit |
| OS temp dir | Where |
|
| Where GIF exports go |
|
| How long |
|
| Verbose logs on stderr |
The "Claude for Zen" add-on (--no-restart)
Firefox can switch its WebDriver BiDi remote agent on and off while it runs (RemoteAgent.startAtRuntime), but only privileged browser code may do that. The add-on in extension/ is that code: a WebExtension experiment of about 200 lines that
listens on a random
127.0.0.1port and writes it, with a random token, toclaude-for-zen.jsonin your profile (readable only by you);on
startfrom claude-for-zen switches remote control on (port 9222, the only port Firefox uses for this; the session shares your cookies like the command-line flag does), and switches it off again as soon as claude-for-zen disconnects;does nothing else: it exposes no API to web pages or other add-ons.
So remote control is on only while Claude is using Zen, and navigator.webdriver is never visible to sites. It shows up in about:addons as "Claude for Zen"; disable or remove it there.
Zen's defaults only run add-ons signed by Mozilla and without experiment APIs, and Mozilla doesn't sign experiments for third parties. --no-restart therefore also sets xpinstall.signatures.required = false and extensions.experiments.enabled = true in your profile (Zen is built so that these prefs apply; Firefox release builds ignore them, which is why this mode is Zen-only). The trade-off: Zen will then also accept other unsigned add-ons, so only install add-ons from sources you trust. Add-ons from addons.mozilla.org are unaffected.
What everyday mode changes in your profile
install --existing-profile (and every launch) writes a clearly marked block to your profile's user.js, leaving the rest of the file alone:
remote.prefs.recommended = false: Firefox would otherwise apply "automation defaults" whenever remote control is on, which disable Safe Browsing, the popup blocker and password saving. This keeps your browser behaving normally.dom.successive_dialog_time_limit = 0: repeatedalert/confirmdialogs stay plain, so Claude can handle them (you lose the "prevent this page from creating more dialogs" checkbox).dom.file.createInChild = true: needed forfile_upload.
Zen is started with -profile <your profile> --remote-debugging-port 9333; on macOS through Launch Services, as if you opened it from the Dock. Delete the block from user.js to undo the prefs.
Security and privacy
The remote debugging port listens on
127.0.0.1only. Web pages cannot connect to it (Firefox validates theHostandOriginheaders), but other programs running as your user can control that Zen while remote control is on, just as with Chrome's remote debugging. In everyday mode that is your real browser with your sessions; quit and reopen Zen normally to turn remote control off.In everyday mode console and network events are collected only for the tabs Claude works with, and Claude lists only its own tabs unless asked for all of them. Claude's window is an unsynced Zen window, so your tabs don't show up in it and its tabs don't show up in yours.
The page runtime runs in an isolated sandbox. Page scripts cannot read it or spoof its results.
Password fields are never echoed back (
value="••••••"), and tokens, keys, signatures and similar query parameters are shown asREDACTEDin network logs.Claude Code's own permission prompts apply to every tool call. The server's instructions tell Claude not to enter secrets or take irreversible actions without asking you, and to ask before restarting your browser.
Nothing is sent anywhere except between Claude Code and your local browser.
Several Claude Code sessions at once
Two projects can use the same Zen at the same time. Firefox allows only one WebDriver BiDi session per browser, so claude-for-zen starts a small session broker (claude-for-zen broker, a background process per browser) that owns that session and shares it:
every Claude Code session gets its own tabs (in everyday mode its own window) and only lists and closes its own tabs; input goes to each session's own tabs, so they don't get in each other's way;
the broker listens on a random
127.0.0.1port and only accepts clients that present a random token from a file only you can read (~/.claude-for-zen/run/);the browser session ends, and with the add-on remote control switches off, only when the last session has left; the broker then exits by itself.
Sessions share the profile, so they share cookies and logins: signing out of a site in one project signs the other out too.
Troubleshooting
Symptom | Fix |
Claude says Zen must be restarted (or quit) | Everyday mode, Zen was opened without remote control. Say yes (macOS), or quit Zen and let Claude reopen it / run |
"Zen did not quit within 20 seconds" | Zen is asking something (closing tabs, a download in progress). Answer it, then let Claude retry. |
"Another program is controlling this Zen instance" | Something other than claude-for-zen's broker (another automation tool, or an older claude-for-zen) holds Zen's only WebDriver BiDi session. Close it, or quit and reopen Zen. |
"The Claude Zen profile … is already open" | Dedicated mode: you opened Claude's profile without remote debugging. Close that window and retry, or use |
"Port 9333 is used by another program" | Set |
Zen or your profile not found | Set |
Anything else |
|
Limitations
Everyday mode: remote control can only be turned on when Zen starts, so after you quit and reopen Zen normally, Claude asks to restart it again the next time it needs it.
Browser UI outside the page (address bar, extension popups, permission prompts, native file pickers, the downloads panel) is not visible in screenshots and can't be clicked. The same is true for Claude in Chrome.
findmatches roles, labels, text and attributes heuristically. Claude in Chrome uses a model for this.The helper add-on needs Zen (or another Firefox build without enforced signing); with Firefox release, everyday mode falls back to restarting the browser once. While the add-on has remote control on, port 9222 must be free (Chrome's remote debugging often uses it).
Zen's remote agent can't open windows itself (it only does that for Firefox), so claude-for-zen opens Claude's window the way you would: it Shift+clicks a link in a short-lived background tab of yours, which you may see flash in the sidebar. Closing Claude's window together with its last tab uses Zen's AppleScript support and works on macOS; elsewhere the window stays open with Zen's empty tab.
The automatic restart is macOS-only, where the standard Quit event makes Zen save its session. On Linux, Firefox-based browsers exit on SIGTERM without saving it, and Windows has no clean per-process quit, so there Claude asks you to quit Zen and then opens it with your profile.
CAPTCHAs are not solved, by design.
Development
npm test # unit tests
npm run test:e2e # end-to-end: launches headless Zen with throwaway profiles
E2E_HEADED=1 npm run test:e2e # watch it work
E2E_PROFILE_MODE=existing npm run test:e2e # run the tool suite in everyday-profile mode
ZEN_BINARY=$(which firefox) npm run test:e2e # against FirefoxThe e2e suites drive the real MCP server over stdio, exactly as Claude Code does. tools.test.js exercises every tool against a fixture site: trusted clicks, modifier and multi-clicks, drag, unicode typing, React-style controlled inputs, cross-origin iframes, dialogs, popups, uploads, GIFs, stale refs and recovery after the browser is killed. existing.test.js plays the everyday-profile flow on a throwaway profile: a normally started browser, the permission prompt, the restart with session restore (macOS) or reopening after the user quits (Linux), Claude's tabs in a window of their own that Zen keeps unsynced from the user's, and the browser left running afterwards. addon.test.js (Zen only) starts Zen without the flag, checks that the add-on switches remote control on without a restart, off when Claude disconnects, that two sessions keep it on until the last one leaves, and that Zen is opened without the flag when it isn't running. shared.test.js runs two and then three Claude Code sessions against one browser at the same time. CI runs everything except the add-on test against headless Firefox on Linux.
Project layout:
bin/claude-for-zen.js CLI (serve, install, uninstall, launch, doctor)
src/server.js MCP tools
src/browser.js BiDi session, tabs, refs, input, screenshots, event buffers, profile modes
src/page/runtime.js sandboxed page runtime (accessibility tree, find, forms, text)
src/launcher.js Zen/profile discovery, prefs, launch, graceful restart
src/bidi.js WebDriver BiDi client
src/broker.js session broker shared by several Claude Code sessions
src/addon.js helper add-on packaging and control channel (extension/ is the add-on)Bahasa Indonesia (ringkas)
claude-for-zen membuat Claude Code bisa mengendalikan Zen Browser seperti Claude in Chrome mengendalikan Chrome: membuka tab, membaca halaman, klik, mengetik, mengisi form, menjalankan JavaScript, membaca console/network, menangani dialog, upload file, dan merekam GIF.
Pakai Zen harian Anda tanpa pernah restart (disarankan):
node bin/claude-for-zen.js install --no-restart. Ini memasang add-on kecil "Claude for Zen" yang menyalakan remote control hanya saat Claude bekerja, lalu mematikannya lagi. Zen tidak pernah di-restart. Saat Zen dibuka berikutnya, pilih Enable ketika muncul pemberitahuan add-on baru. Konsekuensinya: Zen jadi menerima add-on tanpa tanda tangan Mozilla, jadi pasang add-on lain hanya dari sumber tepercaya.Pakai Zen harian Anda tanpa add-on:
node bin/claude-for-zen.js install --existing-profile. Claude membuka jendela Zen sendiri dengan profil Anda, jadi login tetap ada, dan tab Anda tidak tercampur. Jendela itu muncul di depan dan tertutup otomatis saat Claude menutup tab terakhirnya (macOS). Kalau Zen sedang terbuka tanpa remote control, Claude akan minta izin dulu untuk me-restart Zen sekali; semua jendela dan tab kembali seperti biasa (macOS; di Linux/Windows Claude meminta Anda menutup Zen, lalu membukanya lagi). Bisa juga tutup Zen lalu buka dengannode bin/claude-for-zen.js launch.Beberapa project sekaligus: beberapa sesi Claude Code bisa memakai Zen yang sama dalam waktu bersamaan. Masing-masing punya tab atau jendela sendiri. Login ikut sama karena profilnya satu.
Profil terpisah untuk Claude:
node bin/claude-for-zen.js install. Claude memakai jendela Zen sendiri; login sekali lewatnode bin/claude-for-zen.js launch.
License
MIT
Available Tools
17 toolsbrowser_batchRun several browser actionsB
Run a short sequence of browser tool calls in order (e.g. click, type, key, screenshot) and return all their results. Stops at the first error. Every action needs an explicit tabId.
Inputs: actions (required).
computerMouse, keyboard and screenshotsA
Use a mouse and keyboard to interact with the page in a Zen tab, and take screenshots. If you don't have a valid tab ID, use tabs_context first.
Before clicking, consult a screenshot to find coordinates, or use a ref from read_page/find (preferred: refs are scrolled into view automatically and work inside iframes).
Click in the centre of elements, not on their edges.
Coordinates are in the pixel frame of the latest screenshot (its size is reported with every screenshot).
Inputs: tabId (required), action (required), ref, text, +11 more.
file_uploadUpload filesB
Set the files of an element (by ref) to local file paths, as if the user picked them. Use computer screenshot save_to_disk to upload a screenshot.
Inputs: ref (required), paths (required), tabId (required).
findFind elementsARead-only
Find elements by what they are or what they say (e.g. "search bar", "login button", "add to cart", "price"). Matches roles, labels, placeholders, text and attributes, including inside iframes. Returns up to 20 matches with refs usable by other tools.
Inputs: query (required), tabId (required).
form_inputSet a form valueA
Set the value of a form element by ref (from read_page/find): text inputs and textareas (string), selects (option value or visible text), checkboxes/radios/switches (boolean), contenteditable editors (string). Fires the input/change events frameworks like React and Vue listen to.
Inputs: ref (required), tabId (required), value (required), action_summary.
get_page_textGet page textBRead-only
Extract the readable text of the page (prioritising the main article content) as plain text. Ideal for reading articles and text-heavy pages.
Inputs: tabId (required), max_chars.
gif_creatorRecord a GIFA
Record browser actions in a tab as an animated GIF. start_recording captures a frame after every action (clicks are marked); stop_recording stops; export writes the GIF to disk and returns its path; clear discards the recording. Capture extra screenshots before and after important actions for smoother playback.
Inputs: tabId (required), action (required), filename.
handle_dialogHandle a JavaScript dialogA
Accept or dismiss an open alert/confirm/prompt/beforeunload dialog in a tab. For prompt dialogs, text is entered before accepting.
Inputs: tabId (required), action (required), text.
javascript_toolRun JavaScriptA
Execute JavaScript in the page's context (DOM, window, page variables). REPL semantics: top-level await works and the value of the last expression is returned — write the expression you want (e.g. document.title or await fetch(url).then(r => r.json())) rather than return ....
Inputs: text (required), tabId (required), action.
read_console_messagesRead console messagesARead-only
Read console messages (console.log/warn/error, uncaught exceptions) from a tab, captured while connected. Messages from a previous site are dropped when the tab navigates to another origin. Always provide a pattern to filter out noise.
Inputs: tabId (required), clear, limit, pattern, +1 more.
read_network_requestsRead network requestsARead-only
Read HTTP requests (documents, XHR/fetch, scripts, images, …) made by a tab, including cross-origin ones, captured while connected. Requests from a previous site are dropped when the tab navigates to another origin. Sensitive query values are shown as REDACTED.
Inputs: tabId (required), clear, limit, urlPattern.
read_pageRead page structureARead-only
Get an accessibility-tree style outline of the page with element refs (ref_N) usable by computer, form_input, scroll_to and file_upload. Includes the contents of iframes. By default returns all elements (non-visible ones are marked hidden); filter='interactive' returns only visible buttons/links/inputs. Output is limited to max_chars (default 50000).
Inputs: tabId (required), depth, filter, ref_id, +1 more.
resize_windowResize windowA
Resize the Zen window containing a tab (outer size in pixels), e.g. to test responsive layouts.
Inputs: tabId (required), width (required), height (required).
tabs_closeClose a Zen tabADestructive
Close a tab Claude opened. Use it to clean up tabs you are done with. Closing a tab Claude did not open requires force=true and should only be done when the user asks.
Inputs: tabId (required), force.
tabs_contextList Zen tabsA
Get the tabs Claude is working with in Zen. Returns tab IDs, titles and URLs. CRITICAL: call this at least once before other browser tools so you know which tabs exist. Each new conversation should create its own tab (tabs_create) rather than reuse tabs, unless the user explicitly asks to use an existing tab. Pass all=true to list every open tab in the browser.
Inputs: all, createIfEmpty, restartBrowser.
tabs_createOpen a new Zen tabA
Open a new tab for this conversation and return its tab ID. Tabs you create are yours to clean up: close each one with tabs_close when you no longer need it, unless the user wants it kept open.
Inputs: url.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools have clear, distinct purposes: interaction (computer, form_input, file_upload), reading (read_page, find, get_page_text), diagnostics (read_console_messages, read_network_requests), and tab lifecycle (tabs_context/create/close). The main overlap is between computer and browser_batch (both click/type/screenshot) and among the three page-reading tools, though descriptions explain the intended split. A missing scroll_to tool that read_page references adds a little confusion about where scrolling lives.
Conventions are mixed: verb_noun (read_page, get_page_text, resize_window, handle_dialog), noun_verb (form_input, file_upload), bare nouns/verbs (computer, find, navigate, gif_creator, browser_batch), and namespace prefixes (tabs_*). The tabs_ and read_ groupings are predictable, and names remain readable, but there is no single pattern across the set.
Seventeen tools is on the upper side but each maps to a real browser-automation need: tabs, navigation, reading, input, JS, console/network inspection, dialogs, GIF capture, and batching. Nothing looks redundant enough to cut, though a couple of tools (browser_batch, gif_creator) are conveniences rather than core capabilities.
Coverage of the browser-automation domain is strong: navigation, page inspection, element location, form/file input, raw JS, console and network capture, dialogs, resize, tab lifecycle, and recording. Notable gaps are an explicit wait-for-condition/scroll tool (read_page mentions scroll_to, which is absent) and no first-class storage/cookie inspection, though javascript_tool can work around both.
Maintenance
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
A real browser for your agent: screenshots, page checks, Markdown and PDFs.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Related MCP Servers
- AlicenseBqualityCmaintenanceLets Claude Code attach to a running, signed-in Firefox over WebDriver BiDi to control tabs, navigate, screenshot, read pages, click, type, fill forms, evaluate JavaScript, and inspect console/network activity.22MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to drive a local Firefox browser: opening and managing tabs, navigating, reading page structure and text, clicking, typing, filling forms, running JavaScript, taking screenshots, and inspecting console messages and network requests. Everything runs over a local Unix socket with no network traffic, and actions are restricted to tabs explicitly placed under Claude's control.GPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to control Firefox through tools for tabs, navigation, clicks, typing, scrolling, screenshots, page reading, forms, JavaScript, and console/network logs.MIT
- AlicenseNot gradedqualityAmaintenanceEnables Claude Code to drive a real Firefox browser through a local MCP server using synthetic DOM events for clicks and typing. Supports tab management, navigation, page reading, form interaction, screenshots, and per-site consent with no network port opened.4 npm1MIT