|
| 1 | +# Stealth Mode Features |
| 2 | + |
| 3 | +This fork of Chrome DevTools MCP adds **stealth mode** capabilities to bypass bot detection on websites. |
| 4 | + |
| 5 | +## New Features |
| 6 | + |
| 7 | +### 1. **Stealth Mode** (`--stealth`) |
| 8 | +Enables puppeteer-extra-plugin-stealth and adds anti-detection Chrome arguments to make browser automation undetectable. |
| 9 | + |
| 10 | +**What it does:** |
| 11 | +- Uses `puppeteer-extra` with `puppeteer-extra-plugin-stealth` plugin |
| 12 | +- Removes automation-related Chrome arguments |
| 13 | +- Adds anti-detection Chrome flags: |
| 14 | + - `--disable-blink-features=AutomationControlled` |
| 15 | + - `--disable-features=IsolateOrigins,site-per-process` |
| 16 | + - `--no-first-run` |
| 17 | + - `--no-service-autorun` |
| 18 | + - `--password-store=basic` |
| 19 | +- Removes `--enable-automation` flag |
| 20 | + |
| 21 | +### 2. **Custom Chrome Arguments** (`--chromeArgs`) |
| 22 | +Pass any additional Chrome command-line arguments (comma-separated). |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +### Basic Stealth Mode |
| 27 | +```bash |
| 28 | +npx chrome-devtools-mcp@latest --stealth |
| 29 | +``` |
| 30 | + |
| 31 | +### Stealth Mode with Custom Chrome Arguments |
| 32 | +```bash |
| 33 | +npx chrome-devtools-mcp@latest --stealth --chromeArgs="--window-size=1920,1080,--user-agent=CustomAgent" |
| 34 | +``` |
| 35 | + |
| 36 | +### Only Custom Arguments (without stealth plugin) |
| 37 | +```bash |
| 38 | +npx chrome-devtools-mcp@latest --chromeArgs="--disable-gpu,--no-sandbox" |
| 39 | +``` |
| 40 | + |
| 41 | +## MCP Configuration |
| 42 | + |
| 43 | +### Claude Code |
| 44 | +```bash |
| 45 | +claude mcp add chrome-stealth npx chrome-devtools-mcp@latest -- --stealth |
| 46 | +``` |
| 47 | + |
| 48 | +Or manually edit `.claude/config.json`: |
| 49 | +```json |
| 50 | +{ |
| 51 | + "mcpServers": { |
| 52 | + "chrome-stealth": { |
| 53 | + "command": "npx", |
| 54 | + "args": [ |
| 55 | + "chrome-devtools-mcp@latest", |
| 56 | + "--stealth" |
| 57 | + ] |
| 58 | + } |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +### With Custom Chrome Args |
| 64 | +```json |
| 65 | +{ |
| 66 | + "mcpServers": { |
| 67 | + "chrome-stealth": { |
| 68 | + "command": "npx", |
| 69 | + "args": [ |
| 70 | + "chrome-devtools-mcp@latest", |
| 71 | + "--stealth", |
| 72 | + "--chromeArgs=--window-size=1920,1080" |
| 73 | + ] |
| 74 | + } |
| 75 | + } |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +### With Chromium Path |
| 80 | +```json |
| 81 | +{ |
| 82 | + "mcpServers": { |
| 83 | + "chrome-stealth": { |
| 84 | + "command": "npx", |
| 85 | + "args": [ |
| 86 | + "chrome-devtools-mcp@latest", |
| 87 | + "--stealth", |
| 88 | + "--executablePath", |
| 89 | + "/usr/bin/chromium" |
| 90 | + ] |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +## Technical Details |
| 97 | + |
| 98 | +### Modified Files |
| 99 | +- `package.json` - Added `puppeteer-extra` and `puppeteer-extra-plugin-stealth` dependencies |
| 100 | +- `src/browser.ts` - Added stealth mode logic and custom Chrome args support |
| 101 | +- `src/cli.ts` - Added `--stealth` and `--chromeArgs` CLI options |
| 102 | +- `src/main.ts` - Pass stealth options to browser launcher |
| 103 | + |
| 104 | +### How Stealth Mode Works |
| 105 | +1. **Puppeteer-Extra Plugin**: Uses `puppeteer-extra-plugin-stealth` which applies dozens of evasion techniques: |
| 106 | + - Removes `navigator.webdriver` flag |
| 107 | + - Masks Chrome headless detection |
| 108 | + - Fixes `navigator.plugins` and `navigator.languages` |
| 109 | + - Spoofs WebGL vendor/renderer |
| 110 | + - And many more... |
| 111 | + |
| 112 | +2. **Chrome Flags**: Adds critical anti-detection flags: |
| 113 | + - `--disable-blink-features=AutomationControlled` - Removes automation indicators |
| 114 | + - `ignoreDefaultArgs: ['--enable-automation']` - Prevents automation flag |
| 115 | + |
| 116 | +3. **Conditional**: Only uses puppeteer-extra when stealth is enabled, otherwise uses standard puppeteer-core for better performance |
| 117 | + |
| 118 | +## Testing |
| 119 | + |
| 120 | +Test stealth mode on bot-protected sites: |
| 121 | +```bash |
| 122 | +# Navigate to bot-protected site |
| 123 | +npx chrome-devtools-mcp@latest --stealth |
| 124 | + |
| 125 | +# Then use the MCP tools to navigate to sites like: |
| 126 | +# - https://2nabiji.ge |
| 127 | +# - https://bot.sannysoft.com |
| 128 | +# - https://arh.antoinevastel.com/bots/areyouheadless |
| 129 | +``` |
| 130 | + |
| 131 | +## Comparison with Standard Chrome DevTools MCP |
| 132 | + |
| 133 | +| Feature | Standard | With Stealth | |
| 134 | +|---------|----------|--------------| |
| 135 | +| Bot Detection | ❌ Detected | ✅ Bypassed | |
| 136 | +| Performance | Fast | Slightly slower | |
| 137 | +| Dependencies | puppeteer-core | + puppeteer-extra | |
| 138 | +| Use Case | Development/Testing | Bot-protected sites | |
| 139 | + |
| 140 | +## Use Cases |
| 141 | + |
| 142 | +- **E-commerce scraping**: Access sites with Cloudflare or similar protection |
| 143 | +- **Price monitoring**: Automated price checking without detection |
| 144 | +- **Testing**: Test how your site appears to real users vs bots |
| 145 | +- **Research**: Access data from protected sources |
| 146 | + |
| 147 | +## Credits |
| 148 | + |
| 149 | +Stealth implementation based on: |
| 150 | +- [puppeteer-extra](https://github.com/berstend/puppeteer-extra) |
| 151 | +- [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) |
| 152 | + |
| 153 | +Original Chrome DevTools MCP by Google LLC / Chrome DevTools team. |
0 commit comments