Imported from zeshuochen/nekoro-browser (
AGENTS.md). Install upstream withnpx skills add zeshuochen/nekoro-browser. Copyright stays with the author.
nekoro-browser is a CLI that lets an agent drive the user's daily Chrome via a MV3
extension (chrome.debugger API) + a local daemon, keeping the real login state —
no --remote-debugging-port (Chrome 136+ blocks that on the default profile anyway).
Code priorities
- Clarity
- Precision
- Low verbosity
- Never fabricate success — helpers return
{"ok": false, "error": ...}on failure, not a silently-wrong{"ok": true}
Overview
Two halves, one wire (HTTP + WebSocket, same port):
extension/— MV3 extension.background.jsis the service worker: WS transport to the daemon,chrome.debuggerattach/CDP dispatch, dialog auto-handling, tab lifecycle.keepalive.jsis a content script that gives the service worker an independent wake vector (MV3 workers get evicted; a plain WS/alarm keep-alive alone isn't reliable).src/nekoro_browser/— the daemon + CLI.daemon.py— long-lived middleman process between the extension and the agent's-ccodebridge.py— the WS/HTTP transportlifecycle.py— pid file, process fingerprint, stale-daemon self-healhelpers.py— CDP wrapper functions auto-imported into-cscripts, each a thin (≤10 line) wrapper over one CDP capabilitycli.py— thenekoro-browsercommandmcp_server.py— thenekoro-browser-mcpcommand: stdio JSON-RPC MCP server for clients that don't read skill files (Claude Desktop, Cursor, opencode, Codex, VS Code/Copilot, …). Tools are reflected offhelpers.pyviainspect.signature, then forwarded to the same daemon/execendpoint the CLI uses — no second execution path to keep in sync.
SKILL.md tells agents how to use the CLI and lists every helper. README.md covers
install + quick start for humans.
An agent operating nekoro-browser edits two places:
src/nekoro_browser/agent_helpers.py— task-specific browser helpers the agent adds at runtime; hot-reloaded viareload_agent_helpers(), no daemon restart neededdomain-skills/— Markdown notes on specific sites, written and read by the agent. Empty by default and never imported; workflows go inagent_helpers.py.
Testing
tests/test_*.py are stdlib-style, not pytest: assert + a final print("ALL OK"), run via
uv run python tests/test_X.py. Extension JS has no unit-test surface — verify syntax
with node --check, behavior needs a live Chrome.
tests/browser_regression.py runs the packaged wheel and a PyPI-to-wheel upgrade in
real Chrome for Testing with isolated profiles. Its test-only CDP pipe bridge uses
Node's standard library. See README for invocation; CI gates publishing on this test.
Contributing
Consider what is really needed. Prefer the smallest diff that fixes the bug. Don't add speculative config/flags for scenarios that aren't happening yet.
