grok-browser-mcp
grok-browser-mcp
MCP server that attaches to your already-running Brave over Chrome DevTools Protocol (CDP). Grok CLI can then snapshot, click, type, and screenshot whatever tab you have open — same window, same logins.
It does not launch a fresh empty browser.
Requirements
Install
git clone https://github.com/v76ADrR/grok-browser-mcp.git
cd grok-browser-mcp
npm installEnable CDP on Brave (once)
The Arch/CachyOS Brave wrapper reads ~/.config/brave-flags.conf. Put:
--remote-debugging-port=9222
--remote-debugging-address=127.0.0.1
--remote-allow-origins=*Restart Brave. Tabs usually restore. Confirm:
curl -s http://127.0.0.1:9222/json/versionOr call the MCP tool browser_prepare (this restarts Brave).
CDP is localhost only. Any process on this machine can control the browser while those flags are set. Remove them and restart Brave when you are done.
Grok CLI config
~/.grok/config.toml:
[mcp_servers.browser]
command = "/usr/bin/node"
args = ["/ABS/PATH/TO/grok-browser-mcp/src/server.mjs"]
enabled = true
startup_timeout_sec = 20
tool_timeout_sec = 180Reload: /mcps then r, or a new Grok session.
Tools
Tool | Purpose |
| Brave PIDs + CDP health |
| Write flags; restart Brave if CDP is down |
| List / focus tabs |
| Clickable elements + refs |
| Filter snapshot by text |
| Click by ref / selector / text |
| Keyboard |
| JS in the page |
| JPEG of the current tab |
| Navigation |
Never call Playwright browser.close() on this connection — it would quit the user's Brave.
License
MIT