feat(browser_mcp): add browser_list/launch_profile/close lifecycle tools

Three MCP tools to manage the user's Chromium instances by profile, distinct
from browser_launch's isolated automation Chrome:

- browser_list: enumerate running Chromium master processes by scanning
  /proc/*/cmdline (has --user-data-dir, no --type=). Returns pid, profile,
  user_data_dir, cdp_port, has_cdp as a JSON array.
- browser_launch_profile: launch a concrete profile using the REAL binary
  /usr/lib/chromium/chromium (bypassing the /usr/bin/chromium wrapper). No CDP
  by default so Google keeps the session for human profiles; cdp=true adds
  --remote-debugging-port + --remote-allow-origins=*. Detects DISPLAY/XAUTHORITY
  from the XFCE session and launches decoupled via setsid.
- browser_close: locate a master by profile/cdp_port/pid, SIGTERM with a 10s
  wait, then SIGKILL as a last resort.

Per-profile instances are NOT registered in the connection pool: they are
user-facing and survive the MCP dying; cleanup is explicit via browser_close.

Unit tests for cmdline master detection, flag parsing, and close-target
matching. Bumps version 0.6.0 -> 0.7.0 (42 -> 45 tools).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-10 18:23:45 +02:00
parent 54fe1b7f17
commit 1fae6c1df9
5 changed files with 661 additions and 10 deletions
+5 -1
View File
@@ -5,9 +5,13 @@ MCP server (Go) that exposes the registry's CDP browser-control functions
Chrome DevTools Protocol: navigate, read the DOM, click, manage cookies, evaluate
JavaScript, operate iframes, and persist/restore session state.
36 tools total, grouped by domain. See `app.md` for the full per-tool reference and the
45 tools total, grouped by domain. See `app.md` for the full per-tool reference and the
"Omitido en v1" section.
Includes per-profile Chromium lifecycle tools (`browser_list`, `browser_launch_profile`,
`browser_close`) that manage the user's profiled Chromium windows (e.g. "Personal", "Work"),
separate from the MCP's own isolated automation Chrome on port 9333.
## Security: isolated Chrome by default (port 9333)
**By default the MCP operates on its OWN isolated Chrome, NOT the user's daily browser.**