---
title:

foxcode: claude code controls a real browser

date: 2026-04-05
draft: false
---

https://github.com/korchasa/foxcode

I constantly need to give agents access to a browser. For testing applications, debugging, and simply to look something up or help with something. After switching from playwright-mcp to playwright-cli, speed improved, but it was still too slow. On top of that, I needed a way to give claude code access to a real browser — with my sessions, specific to each project. Had to build my own solution. I also decided to test the idea from https://www.anthropic.com/engineering/code-execution-with-mcp with optimization through programmatic calls.

How it works

Architecture:

  • claude code communicates with the mcp server via stdio
  • the mcp server maintains a websocket connection to a firefox extension
  • the extension executes javascript in the context of the active tab

Authentication uses a random 32-hex token stored in ~/.foxcode/password (mode 0600). Passed via url hash — never sent to the server.

Tools and api

The main mcp tool is evalInBrowser(code, timeout?). Inside, an api object with methods similar to playwright is available. For example, you can log in and collect data in a single call:

await api.navigate("https://app.example.com/login");
await api.fill("#email", "user@test.com");
await api.fill("#password", "secret");
await api.click("button[type=submit]");
await api.waitFor(".dashboard", { timeout: 5000 });
return await api.snapshot(".stats-panel");

Advantages

  • multiple operations in a single call that can depend on each other, so there is no need for multiple calls for complex scenarios
  • the browser profile persists between sessions, so you can log in and keep cookies
  • to a website the browser is indistinguishable (except for behavioral heuristics) from a regular one
  • in project profile mode the browser starts quickly with a ready-made profile, and in user profile mode it uses the main profile that is already running

Disadvantages

  • connection is not instant — there is a handshake and authentication stage
  • for the user profile you still need to manually install the extension via the about:debugging page, so it is not quite plug-and-play
  • only firefox is supported for now

Installation

/plugin in claude code — this opens the interactive plugin manager. Add the korchasa/foxcode marketplace on the Marketplaces tab, then install foxcode on the Discover tab.

Launch

There are two launch modes:

  • /foxcode:foxcode-run-project-profile — isolated firefox with a clean profile. The profile is stored inside the current project.
  • /foxcode:foxcode-run-user-profile — your main firefox. Requires manual extension installation via about:debugging.

Plans for the next iteration:

  • try to publish the extension to the official store so manual installation is no longer needed
  • support for other browsers
  • self-learning to optimize frequently executed scenarios