CloakBrowser MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CloakBrowser MCP navigate to example.com and take a screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CloakBrowser MCP
CloakBrowser MCP is a Python MCP server that lets agents control a CloakBrowser-backed browser from Linux servers, CI jobs, and other environments where a normal desktop browser is not available.
It is designed for three runtime modes:
headless Linux browsing with no
$DISPLAYvirtual-display browsing through Xvfb when headed browser behavior is needed
CDP connection to an existing CloakBrowser or Chromium-compatible endpoint
The server exposes browser automation tools over MCP stdio, so clients such as Claude Code can start a session, navigate, inspect pages, interact with forms, manage cookies/storage, and work with multiple tabs.
Upstream
This project is an MCP wrapper and agent-facing extension built on top of CloakHQ/CloakBrowser. CloakBrowser provides the underlying browser launch and anti-detection automation layer; this repository adds the MCP server, tool schema, session lifecycle, Linux headless/virtual-display deployment flow, tests, and agent-oriented documentation around it.
Related MCP server: scout-mcp-server
Features
28 MCP tools for browser sessions, page interaction, cookies, storage state, and multi-page workflows.
Works in headless Linux environments by default.
Optional Xvfb support for virtual display sessions.
Optional CDP backend for connecting to an existing browser service.
CloakBrowser launch options for user agent, viewport, proxy, locale, timezone, geolocation, humanization, extensions, headers, permissions, and persistent profile/state.
iframe-aware select support through
browser_select_option(..., frame_selector="iframe#...").uv-managed local development and deployment.
Requirements
Python 3.11 or newer
uvLinux, macOS, or another platform supported by the Python dependencies
For virtual display mode on Linux:
Xvfb
Install uv if needed:
curl -LsSf https://astral.sh/uv/install.sh | shFor virtual display mode on Debian/Ubuntu:
sudo apt-get update
sudo apt-get install -y xvfbIf the runtime does not already have browser binaries available, install the Playwright Chromium browser used by the underlying stack:
uv run python -m playwright install chromiumInstallation
Clone the repository and create an isolated uv environment:
git clone https://github.com/SJF-ECNU/CloakBrowserMCP.git
cd CloakBrowserMCP
uv sync --extra dev --no-editableThe project depends on:
mcp[cli]>=1.28,<2pyvirtualdisplay>=3,<4
After changing source code, rebuild the installed package used by MCP clients:
uv sync --extra dev --no-editable --reinstall-package cloakbrowser-mcpRun the MCP Server
Start the stdio MCP server:
uv run --no-editable cloakbrowser-mcpThe process communicates over stdio. It is normally launched by an MCP client rather than run manually in a terminal.
Claude Code Setup
From the repository root, register the server:
claude mcp add --scope user cloakbrowser -- \
uv --project "$PWD" run --no-editable cloakbrowser-mcpThen restart Claude Code or reconnect MCP servers. Run /mcp in Claude Code and
confirm that cloakbrowser is connected.
If you edit the server code, reinstall the package and reconnect Claude Code:
uv sync --extra dev --no-editable --reinstall-package cloakbrowser-mcpClaude Code may cache MCP tool schemas for the lifetime of a connection, so a restart/reconnect is recommended after tool signature changes.
Generic MCP Client Config
For clients that read JSON MCP configuration, use an entry like this:
{
"mcpServers": {
"cloakbrowser": {
"command": "uv",
"args": [
"--project",
"/absolute/path/to/CloakBrowserMCP",
"run",
"--no-editable",
"cloakbrowser-mcp"
]
}
}
}Replace /absolute/path/to/CloakBrowserMCP with the local checkout path.
Browser Modes
Headless Mode
This is the default and is the best choice for Linux servers without a display:
{
"display_mode": "headless"
}Virtual Display Mode
Use this when a target site requires headed browser behavior. If $DISPLAY is
already set, the server uses it. Otherwise it starts Xvfb.
{
"display_mode": "virtual"
}CDP Mode
Use CDP mode to connect to an existing browser or CloakBrowser service:
{
"backend": "cdp",
"cdp_url": "http://127.0.0.1:9222",
"fingerprint": "agent-session-1"
}You can also set a default CDP URL:
export CLOAK_MCP_DEFAULT_CDP_URL=http://127.0.0.1:9222Tool Overview
Session tools:
browser_startbrowser_close
Page basics:
browser_navigatebrowser_clickbrowser_typebrowser_evaluatebrowser_snapshotbrowser_screenshot
Page operations:
browser_wait_for_selectorbrowser_pressbrowser_hoverbrowser_select_optionbrowser_get_textbrowser_get_attributebrowser_get_linksbrowser_scrollbrowser_reloadbrowser_go_backbrowser_go_forward
Context and page management:
browser_get_cookiesbrowser_set_cookiesbrowser_clear_cookiesbrowser_get_storage_statebrowser_save_storage_statebrowser_new_pagebrowser_list_pagesbrowser_switch_pagebrowser_close_page
Common Workflows
Start and Navigate
{
"tool": "browser_start",
"arguments": {
"display_mode": "headless",
"viewport": {"width": 1440, "height": 900},
"locale": "en-US",
"timezone": "UTC"
}
}Then navigate:
{
"tool": "browser_navigate",
"arguments": {
"session_id": "<session_id>",
"url": "https://example.com",
"wait_until": "domcontentloaded"
}
}Inspect a Page
Use browser_snapshot for URL, title, and visible text. Use browser_get_text
for all visible text or a selector-specific text extraction:
{
"tool": "browser_get_text",
"arguments": {
"session_id": "<session_id>",
"selector": "main"
}
}Search or Fill a Form
{
"tool": "browser_type",
"arguments": {
"session_id": "<session_id>",
"selector": "input[name=q]",
"text": "CloakBrowser MCP"
}
}{
"tool": "browser_press",
"arguments": {
"session_id": "<session_id>",
"selector": "input[name=q]",
"key": "Enter"
}
}Select an Option inside an iframe
For a normal page-level <select>, omit frame_selector. For a select inside
an iframe, pass the iframe selector separately:
{
"tool": "browser_select_option",
"arguments": {
"session_id": "<session_id>",
"selector": "#size",
"value": "medium",
"frame_selector": "iframe#preview"
}
}Reuse Login State
Save storage state:
{
"tool": "browser_save_storage_state",
"arguments": {
"session_id": "<session_id>",
"path": "/tmp/cloak-state.json"
}
}Start a new session with that state:
{
"tool": "browser_start",
"arguments": {
"storage_state": "/tmp/cloak-state.json"
}
}For durable browser profiles, use profile_dir instead. profile_dir and
storage_state are mutually exclusive.
browser_start Options
Option | Type | Notes |
| string |
|
| string |
|
| bool/null | Overrides headless behavior for direct mode. |
| string/null | Proxy URL forwarded to CloakBrowser. |
| string/null | Browser locale, for example |
| string/null | Browser timezone, for example |
| bool | Enables CloakBrowser humanized behavior. |
| string/null | Persistent profile directory. |
| string/null | Required for CDP mode unless env var is set. |
| string/null | Added to the CDP URL as a |
| string/null | Custom user agent. |
| object/null | Example: |
| bool | Sets Playwright viewport to |
| string/null |
|
| bool | Forwards CloakBrowser geoip option. |
| bool | Defaults to |
| array/null | Extra browser launch args. |
| array/null | Browser extension paths. |
| string | CloakBrowser humanization preset. |
| object/null | CloakBrowser humanization config. |
| string/object/null | Storage state path or object. |
| object/null | Extra HTTP headers. |
| array/null | Browser context permissions. |
Environment variables:
CLOAK_MCP_DEFAULT_DISPLAY_MODE: default display mode when not providedCLOAK_MCP_DEFAULT_CDP_URL: default CDP endpointCLOAK_MCP_SCREENSHOT_DIR: screenshot output directory
Development
Install development dependencies:
uv sync --extra devRun tests against the source tree:
PYTHONPATH=src uv run pytest -qRun tests against the installed package:
uv sync --extra dev --no-editable --reinstall-package cloakbrowser-mcp
uv run --no-editable pytest -qReal browser smoke tests are opt-in:
CLOAK_MCP_RUN_SMOKE=1 uv run --no-editable pytest tests/test_smoke.py -qVirtual display smoke:
CLOAK_MCP_RUN_VIRTUAL_SMOKE=1 uv run --no-editable pytest tests/test_smoke.py -qCDP smoke:
CLOAK_MCP_SMOKE_CDP_URL=http://127.0.0.1:9222 \
uv run --no-editable pytest tests/test_smoke.py -qSecurity Notes
Browser automation can access web pages, cookies, local files referenced by the browser profile, and authenticated sessions. Run the MCP server in an environment appropriate for the trust level of the agent and target websites.
Avoid sharing persistent profile_dir or storage_state files with untrusted
agents.
License
MIT. See LICENSE.
Available Tools
28 toolsbrowser_clear_cookiesC
Clear browser cookies.
Inputs: session_id (required). Returns: object
browser_clickC
Click an element by CSS selector.
Inputs: session_id (required), selector (required). Returns: object
browser_closeB
Close a browser session and release resources.
Inputs: session_id (required). Returns: object
browser_close_pageB
Close a page in the session.
Inputs: session_id (required), page_id. Returns: object
browser_evaluateC
Evaluate JavaScript in the current page.
Inputs: session_id (required), script (required).
browser_get_attributeCRead-only
Return an element attribute value.
Inputs: session_id (required), selector (required), name (required). Returns: object
browser_get_cookiesCRead-only
Return browser cookies.
Inputs: session_id (required), urls. Returns: object
browser_get_linksBRead-only
Return links from the page or a selector.
Inputs: session_id (required), selector, limit. Returns: object
browser_get_storage_stateCRead-only
Return browser storage state.
Inputs: session_id (required). Returns: object
browser_get_textBRead-only
Return visible text from the page or a selector.
Inputs: session_id (required), selector. Returns: object
browser_go_backC
Navigate the active page back in history.
Inputs: session_id (required), wait_until. Returns: object
browser_go_forwardC
Navigate the active page forward in history.
Inputs: session_id (required), wait_until. Returns: object
browser_hoverC
Hover over an element by CSS selector.
Inputs: session_id (required), selector (required). Returns: object
browser_list_pagesCRead-only
List pages in the session.
Inputs: session_id (required). Returns: object
browser_new_pageC
Open a new page in the session.
Inputs: session_id (required), url, switch. Returns: object
browser_pressC
Press a keyboard key while targeting an element.
Inputs: session_id (required), selector (required), key (required). Returns: object
browser_reloadC
Reload the active page.
Inputs: session_id (required), wait_until. Returns: object
browser_save_storage_stateC
Save browser storage state to a file.
Inputs: session_id (required), path (required). Returns: object
browser_screenshotC
Capture a PNG screenshot and return its filesystem path.
Inputs: session_id (required), full_page. Returns: object
browser_scrollC
Scroll the active page by pixel deltas.
Inputs: session_id (required), delta_x, delta_y. Returns: object
browser_select_optionC
Select an option value in a select element.
Inputs: session_id (required), selector (required), value (required), frame_selector. Returns: object
browser_set_cookiesD
Set browser cookies.
Inputs: session_id (required), cookies (required). Returns: object
browser_snapshotCRead-only
Return page URL, title, and visible text.
Inputs: session_id (required). Returns: object
browser_startC
Start a CloakBrowser session. Default mode is direct headless Linux browsing.
Inputs: backend, display_mode, headless, proxy, +19 more. Returns: object
browser_switch_pageC
Switch the active page by page ID.
Inputs: session_id (required), page_id (required). Returns: object
browser_typeB
Type text into an element by CSS selector.
Inputs: session_id (required), selector (required), text (required). Returns: object
browser_wait_for_selectorC
Wait for an element selector to reach a page state.
Inputs: session_id (required), selector (required), state, timeout_ms. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 28 tools
Each tool has a clearly distinct purpose, targeting specific browser actions like navigation, clicking, typing, or cookie management. Potential overlaps like browser_get_text and browser_snapshot are differentiated by scope (snapshot includes URL and title). No two tools are ambiguous.
All tools share the 'browser_' prefix, but the verb style varies: some are simple verbs (browser_click, browser_close) while others follow verb_noun (browser_clear_cookies). Minor inconsistency but still predictable and readable.
28 tools is on the higher side but appropriate for a comprehensive browser automation server covering navigation, interaction, extraction, state management, and cookies. No tools seem redundant or out of scope.
The tool set covers a wide range of browser automation needs: navigation, clicking, typing, text extraction, screenshots, JavaScript evaluation, cookies, storage, page management, and waiting. Missing advanced features like file upload or network interception, but core workflows are well covered.
Maintenance
Related MCP Connectors
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
MCP server to assist with JxBrowser development.
Unofficial Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
Related MCP Servers
- AlicenseBqualityAmaintenanceCloakBrowser MCP server for AI agents: Playwright-powered browsing, clean tool forwarding, Docker support, and multi-session HTTP transport.25297 npm181MIT
- AlicenseAqualityBmaintenanceMCP server for browser automation with anti-detection. Scout pages, find elements, interact with websites, and monitor network traffic from any AI client that supports the Model Context Protocol.211MIT
- AlicenseAqualityDmaintenanceWraps CloakBrowser, a stealth Chromium, as an MCP server for web retrieval with anti-detection features. Enables getting text, HTML, screenshots, and interactive actions via natural language.4MIT
- AlicenseAqualityDmaintenanceA stealth browser automation MCP server that wraps CloakBrowser's patched Chromium to bypass bot detection, providing 22 tools for web navigation, interaction, and session management.2427 PyPI2MIT