ultrastealth
Enables Claude to perform stealth browser automation with anti-detection, including navigation, clicking, typing, screenshots, and network monitoring via an MCP server.
README
Ultrastealth
Ultrastealth is a standalone Python package for maximum-stealth browser automation.
It utilizes rebrowser-playwright (with CDP leak fixes), headed Xvfb modes, and several advanced JS bypasses to avoid bot detection systems.
Prerequisites
- Python 3.12+
- Chromium or Google Chrome installed.
Installation
It is recommended to use a virtual environment.
# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies inside the virtual environment
pip install -r ultrastealth/requirements.txt
Basic Usage
You can use the UltrastealthFetcher in your own scripts:
import asyncio
from ultrastealth import UltrastealthFetcher
async def fetch_example():
# headless=False runs a headed browser (more stealthy, usually combined with Xvfb)
async with UltrastealthFetcher(headless=False) as us:
# fetch_and_evaluate avoids issues with default Playwright page.content() on SPAs
title = await us.fetch_and_evaluate(
url="https://bot.sannysoft.com/",
js_expression="() => document.title",
wait_secs=3.0
)
print("Page Title:", title)
if __name__ == "__main__":
asyncio.run(fetch_example())
Benchmark
bot_benchmark.py scores Ultrastealth against ~15 bot-detection / fingerprint sites
(sannysoft, rebrowser, creepjs, deviceandbrowserinfo, iphey, fingerprint-scan,
cloudflare, …). Run it under a virtual display:
# one-time: start Xvfb on :99 (or use your own display)
Xvfb :99 -screen 0 1920x1080x24 &
DISPLAY=:99 python3 bot_benchmark.py # all sites
DISPLAY=:99 python3 bot_benchmark.py --sites sannysoft rebrowser
python3 bot_benchmark.py --compare bot_benchmark_results.json # reprint table
Each site has its own extraction JS + scorer; results are written to JSON and printed
as a table. Notes: pixelscan/incolumitas only return a verdict from a residential
IP; cloudflare (nowsecure.nl) needs the bundled Turnstile solver. The default
fingerprint is intentionally the consistent real-Chrome one — set
ULTRASTEALTH_BYPASSES=on to additionally layer the (optional) JS spoofs.
MCP Server for Claude Code
The ultrastealth MCP server exposes the stealth browser as tools for Claude Code, giving it the ability to navigate, click, type, screenshot, and monitor network traffic — all with maximum anti-detection.
The server runs as an HTTP service (streamable-http transport) on port 8090 by default, managed by PM2.
Available Tools
Browser automation: browser_navigate, browser_click, browser_type, browser_get_state, browser_screenshot, browser_scroll, browser_go_back, browser_evaluate, browser_press_key, browser_get_html, browser_wait, browser_hover, browser_select_option, browser_close
Tab management: browser_new_tab, browser_list_tabs, browser_switch_tab, browser_close_tab
Network monitoring (Chrome DevTools-style): browser_network_enable, browser_network_disable, browser_network_log, browser_network_detail, browser_network_response_body, browser_network_clear, browser_network_summary
Resource management: browser_status, browser_cleanup, browser_restart
Running the Server
# Start with PM2 (recommended)
pm2 delete ultrastealth-mcp 2>/dev/null
pm2 start /usr/bin/python3 --name "ultrastealth-mcp" \
--cwd /path/to/your/project -- -m ultrastealth.mcp_server --port 8090
# Or run directly
python3 -m ultrastealth.mcp_server # HTTP on 0.0.0.0:8090
python3 -m ultrastealth.mcp_server --port 9000 # HTTP on custom port
python3 -m ultrastealth.mcp_server --transport stdio # stdio mode (legacy)
Connecting Claude Code
The MCP endpoint is http://localhost:8090/mcp (streamable-http).
Project-Level (recommended)
Add to .claude/settings.json in your project root:
{
"mcpServers": {
"ultrastealth": {
"type": "url",
"url": "http://localhost:8090/mcp"
}
}
}
User-Level (all projects)
Add to ~/.claude/settings.json:
{
"mcpServers": {
"ultrastealth": {
"type": "url",
"url": "http://localhost:8090/mcp"
}
}
}
Via CLI
claude mcp add --transport http ultrastealth http://localhost:8090/mcp
Verify
After restarting Claude Code, run /mcp to confirm the ultrastealth server appears and its tools are listed.
Example Workflow
> use ultrastealth to check bot.sannysoft.com
Claude calls: browser_navigate("https://bot.sannysoft.com")
Claude calls: browser_screenshot()
Claude calls: browser_get_html("table")
→ Returns all test results from the page
Network Monitoring Example
> enable network capture and navigate to example.com, then show me all API calls
Claude calls: browser_network_enable()
Claude calls: browser_navigate("https://example.com")
Claude calls: browser_network_log(filter_type="xhr")
→ Returns table of all XHR/fetch requests with status, timing, size
Claude calls: browser_network_detail(request_id=3)
→ Returns full headers and body for a specific request
Included Bypasses
The ultrastealth/bypasses folder includes injected scripts to spoof webgl, mock canvassing, normalize plugins, bypass Runtime.enable, and standard headless fingerprints. These are automatically loaded by the Fetcher.
Driver Fingerprint Patch (patch_rebrowser.py)
rebrowser-playwright's bundled Node driver leaks two identifiers that detectors
(e.g. bot-detector.rebrowser.net) probe for in the page context:
globalThis.__pwInitScripts— the init-script dedup map, created by the driver before any bypass runs (so a JS bypass can't reliably hide it).UtilityScript— the class wrapping everypage.evaluate; its name leaks intoError().stackcaptured by page JS.
patch_rebrowser.py renames both at the driver source (__pwInitScripts → __execGuards,
UtilityScript → ExecutionProxy), consistently so functionality is preserved. This
lifts the rebrowser bot-detector score from 6/10 → 8/10.
python -m ultrastealth.patch_rebrowser # apply
python -m ultrastealth.patch_rebrowser --check # report status
python -m ultrastealth.patch_rebrowser --revert # undo
The patch edits the installed pip package, so a pip install -U rebrowser-playwright
reverts it — re-run the patcher afterward. It is idempotent, revertible, and
upstream-safe: each edit anchors on the original token and warns + skips (never
corrupts) if upstream changed it. UltrastealthFetcher.start() logs a warning if the
patch isn't applied.
Maximum stealth: isolated evaluate (opt-in tradeoff)
The one remaining rebrowser detection — mainWorldExecution — is by design:
rebrowser's default addBinding mode runs page.evaluate in the main world
(detectable). Setting:
export REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated
runs evaluate in an isolated world → 0 positive detections on rebrowser.
Trade-off: isolated evaluate can read the shared DOM (querySelector,
outerHTML, embedded JSON like __NEXT_DATA__ via textContent) but not
main-world JS globals (window.someAppState). Left off by default to avoid
silently breaking scrapers/MCP calls that read main-world JS. Enable it when you
don't need main-world JS access and want the cleanest fingerprint.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。