Repository avatar
AI Tools
v0.3.2
active

pagefork

io.github.anh-chu/pagefork

Your AI agent edits any website live in Chrome. Saved, toggleable change sets. Local and free.

Documentation

Pagefork

Let your AI coding agent edit any website live in your own Chrome. Save the changes as sets you switch on and off, share them as files, and keep everything on your machine.

Get Pagefork on the Chrome Web Store (in review) · Download the extension zip to load unpacked · npx pagefork

Pagefork: your AI agent edits any website, live

  • Edit any page — HTML, CSS and JavaScript, from Claude Code, Cursor, Codex or any MCP client.
  • Changes stick — saved edits come back on every reload, even when your agent isn't running.
  • Change sets — group edits, switch each set on or off from the toolbar, several at once. Your agent writes an overview for each set.
  • Share — export a set as a file; teammates preview the pages it touches before importing.
  • Screenshots — your agent can look at the page to check its work.
  • Free and local — no cloud, no account, no analytics. Open source (MIT).

Quick start

  1. Install the Pagefork extension from the Chrome Web Store. Or load it unpacked: download the zip from the latest release, unzip it, open chrome://extensions, turn on Developer mode, click Load unpacked and pick the folder.

  2. Run npx pagefork. It creates your token and prints what to paste into the extension's Settings and how to add Pagefork to your agent:

    claude mcp add pagefork -- npx -y pagefork mcp
    

    Cursor (~/.cursor/mcp.json):

    { "mcpServers": { "pagefork": { "command": "npx", "args": ["-y", "pagefork", "mcp"] } } }
    

    Codex (~/.codex/config.toml):

    [mcp_servers.pagefork]
    command = "npx"
    args = ["-y", "pagefork", "mcp"]
    
  3. Click the Pagefork icon on a page and allow access (all sites, or just that one).

  4. Ask your agent: "Make this page dark, and add a button that copies the title."

The bridge starts by itself when your agent first uses Pagefork. Needs Node 22 or newer.

How it works

your agent ──stdio──> pagefork mcp ──HTTP 127.0.0.1:8788──> pagefork bridge <──ws://localhost:8787── Chrome extension
  • The bridge holds the extension's WebSocket (:8787/ext) and a loopback-only RPC port (127.0.0.1:8788). pagefork mcp starts it if it isn't running.
  • Page work goes through chrome.debugger, so edits work under strict CSP and Trusted Types. While your agent works on a tab, Chrome shows its "started debugging this browser" bar.
  • Saved edits live in the extension's storage and are reapplied on each page load, with or without the bridge.

Chrome on another computer. The bridge listens on localhost only. To accept Chrome from your local network, set PAGEFORK_HOST=0.0.0.0 (in your agent's MCP config, e.g. claude mcp add pagefork -e PAGEFORK_HOST=0.0.0.0 -- npx -y pagefork mcp) and use ws://<this-computer-ip>:8787/ext in the extension. The connection is plain ws://: use it on networks you trust, and don't forward the port on your router.

Privacy and permissions

Pagefork sends page content (HTML, screenshots, script results) only to the bridge you run, and stores your sets in your browser. It has no server and collects nothing. See store/privacy-policy.md.

PermissionWhy
debuggerApply HTML/JS edits and take screenshots in the tab your agent works on
scriptingInsert and remove saved CSS; tell the page which sets are on
storageKeep your sets and the bridge address on your device
tabs, webNavigationLet your agent pick a tab; reapply saved edits as pages load
alarmsKeep the connection to your bridge alive
Site access (optional)Asked for at first use, for all sites or one site at a time

For agents: change sets

Persisted edits belong to named sets (set, default default), each with a one-line note. describe_set writes the overview the popup shows. list_sets and use_set read and switch sets; several can be on at once.

Set awareness: the page always carries <html data-pagefork-sets="compact toolkit"> with the sets that are on (written by the extension, so it works without the bridge), and window gets a pagefork:sets event (event.detail.on) whenever sets switch without a reload. A set's CSS can key on html[data-pagefork-sets~="compact"]; its JS can read document.documentElement.dataset.pageforkSets or listen for the event.

Sharing: sets export to a JSON file (pagefork/sets, version 1) from the popup, the settings page or export_sets, and import from the settings page or import_sets. Import previews the pages affected and the number of JS edits, adds the sets switched on, renames a taken name, and never changes existing edits.

Tools

list_tabs, get_html, set_html, add_css, run_js, screenshot, reload_tab, list_edits, remove_edit, clear_edits, describe_set, list_sets, use_set, delete_set, export_sets, import_sets.

  • tab is a tabId, a URL substring, or a glob with *. Zero or several matches return an error listing candidates.
  • set_html, add_css and run_js take persist (default false), an optional pattern (URL glob; default: the tab's origin + path), set and note. Saved edits replay in creation order: CSS saved before any HTML/JS edit goes in at commit, the rest at DOMContentLoaded, and HTML edits again after load (for pages that hydrate).
  • A pattern without ? also matches URLs with a query string. The hash is ignored.

Settings

VariableDefaultMeaning
PAGEFORK_HOST127.0.0.1Bridge address for the extension; 0.0.0.0 accepts Chrome from your network
PAGEFORK_PORT8787Extension WebSocket port
PAGEFORK_RPC_PORT8788Loopback RPC port between pagefork mcp and the bridge
PAGEFORK_DIR~/.pageforkToken, bridge log, screenshots (shots/), exports (exports/)
PAGEFORK_TOKENfrom PAGEFORK_DIR/tokenOverride the token
PAGEFORK_TIMEOUT_MS15000Per-command timeout

The older LEB_* names still work.

Development

  • npm test: unit and integration tests (127.0.0.1 only, ephemeral ports, no browser).
  • npm run e2e: opt-in end-to-end run against a real Chrome with the extension. It refuses to start unless LEB_E2E_APPROVED=1 and LEB_E2E_CHROME=<path> are set; it needs a browser that can load extensions (Chrome for Testing with --headless=new; the headless shell cannot).
  • npx pagefork start runs the bridge in the foreground.
  • Store listing, images and launch plan: store/.

License

MIT

NPM
pagefork
Install Command
npm install pagefork