browser-mcp
by NjProVk
README.md
# browser-mcp
An MCP server that drives an installed Chrome, Chromium, or Edge over the DevTools protocol. It has 41 tools for pages, elements, forms, frames, screenshots, the network log, and downloads. Under it is easybrowser, the library in the `easybrowser` folder, with [its own documentation](easybrowser/README.md).
## Connect over stdio
You need Python 3.11 or later, `uv`, and an installed copy of Chrome, Chromium, or Edge. Install the dependencies from the repository folder.
```powershell
uv sync
```
For an MCP client that uses JSON configuration, add an entry to `mcpServers`. Replace `C:/tools/browser-mcp` with the folder that holds the repository.
```json
{
"mcpServers": {
"browser": {
"command": "C:/tools/browser-mcp/.venv/Scripts/python.exe",
"args": ["C:/tools/browser-mcp/server.py"]
}
}
}
```
To check the connection, call `browser_init(headless=true)`, then `browser_navigate(url="https://example.org")` and `browser_get_interactive_elements()`. You can pass selectors from the response directly to `browser_click` and `browser_type`. If you skip the explicit `browser_init` call, the first page tool opens a visible browser window.
## Connect over HTTP
Start the web server from the repository folder.
```powershell
uv run python web_server.py
```
In the client, choose **Streamable HTTP** and enter `http://127.0.0.1:8000/sse`. Set the port with `--port`. Each client gets its own browser session and temporary profile. Calling `browser_close` or disconnecting the MCP client normally shuts down the browser processes. If Chromium crashes, the next call opens a clean profile with the previous settings.
## Browser and files
- `browser_init` accepts a proxy, a timeout in seconds, comma-separated paths to unpacked extensions, `load_mode` (`normal`, `eager`, `none`), and URL blocking patterns in `load_filter`. Chromium supports HTTP(S) proxies with optional authentication and SOCKS5 proxies without authentication.
- The engine locates the browser automatically. To select a specific build, set `EASYBROWSER_EXECUTABLE` to the full path to its executable. Loading unpacked extensions was tested with an installed copy of Chrome 156.
- Pages open with easybrowser's fingerprint protection (`privacy=True`): one consistent profile (user agent, languages, time zone, CPU, memory, WebGL) for a page, its workers and its iframes. See [profiles and fingerprint protection](docs/PRIVACY.md) for what it does and does not do. `BROWSER_MCP_PRIVACY` changes it for the server: `standard` (the default), `extended` (Canvas, audio and WebGL readbacks too), or `off`.
- Enable network logging for the main document before navigation with `browser_navigate(use_network=true)`. To monitor subsequent actions, call `browser_network_list`. Use `id` with `browser_network_get` to retrieve request details and the response body.
- The tools accept CSS, XPath, and shorthand selectors such as `text=Sign in`, `tag:input@name=email`, and `@id=submit`. Use the `css:` or `xpath:` prefix to select a syntax explicitly.
- To work in an iframe, select a path from `browser_list_frames` using `browser_switch_frame`. An empty path returns to the main page. `get_page_screenshot(full_page=true)` captures the entire document at the top level and only the visible area when an iframe is selected.
- If a `alert`, `confirm`, or `prompt` opens and requires a manual response, the current call may return `status="dialog"`. Read the dialog text with `browser_dialog_status` and respond with `browser_handle_alert`. Set the automatic handling policy separately for each tab.
- The tools return absolute file paths. Screenshots go to `screenshots` and downloads go to the shared `downloads` directory in the repository folder. Use `BROWSER_MCP_DATA_DIR` to set a different base directory.
## Verification
```powershell
uv run pytest tests -q
uv run pytest tests_engine -q
```
`tests` starts the server and calls its tools through the MCP SDK against local pages in headless Chromium; `tests_engine` tests easybrowser itself. The two suites have files of the same name, so run them one at a time. They check changes to the DOM, the contents of downloaded files, network responses, HTTP session isolation, and browser process cleanup.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues