ferrum-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.env.example +90 -0
- data/CHANGELOG.md +229 -0
- data/CONTRIBUTING.md +469 -0
- data/LICENSE +21 -0
- data/README.md +334 -0
- data/SECURITY.md +286 -0
- data/bin/ferrum-mcp +66 -0
- data/bin/lint +10 -0
- data/bin/serve +3 -0
- data/bin/test +4 -0
- data/docs/API_REFERENCE.md +1410 -0
- data/docs/CONFIGURATION.md +254 -0
- data/docs/DEPLOYMENT.md +846 -0
- data/docs/DOCKER.md +836 -0
- data/docs/DOCKER_BOTBROWSER.md +455 -0
- data/docs/GETTING_STARTED.md +249 -0
- data/docs/TROUBLESHOOTING.md +677 -0
- data/lib/ferrum_mcp/browser_manager.rb +101 -0
- data/lib/ferrum_mcp/cli/command_handler.rb +99 -0
- data/lib/ferrum_mcp/cli/server_runner.rb +166 -0
- data/lib/ferrum_mcp/configuration.rb +229 -0
- data/lib/ferrum_mcp/resource_manager.rb +223 -0
- data/lib/ferrum_mcp/server.rb +254 -0
- data/lib/ferrum_mcp/session.rb +227 -0
- data/lib/ferrum_mcp/session_manager.rb +183 -0
- data/lib/ferrum_mcp/tools/accept_cookies_tool.rb +458 -0
- data/lib/ferrum_mcp/tools/base_tool.rb +114 -0
- data/lib/ferrum_mcp/tools/clear_cookies_tool.rb +66 -0
- data/lib/ferrum_mcp/tools/click_tool.rb +218 -0
- data/lib/ferrum_mcp/tools/close_session_tool.rb +49 -0
- data/lib/ferrum_mcp/tools/create_session_tool.rb +146 -0
- data/lib/ferrum_mcp/tools/drag_and_drop_tool.rb +171 -0
- data/lib/ferrum_mcp/tools/evaluate_js_tool.rb +46 -0
- data/lib/ferrum_mcp/tools/execute_script_tool.rb +48 -0
- data/lib/ferrum_mcp/tools/fill_form_tool.rb +78 -0
- data/lib/ferrum_mcp/tools/find_by_text_tool.rb +153 -0
- data/lib/ferrum_mcp/tools/get_attribute_tool.rb +56 -0
- data/lib/ferrum_mcp/tools/get_cookies_tool.rb +70 -0
- data/lib/ferrum_mcp/tools/get_html_tool.rb +52 -0
- data/lib/ferrum_mcp/tools/get_session_info_tool.rb +40 -0
- data/lib/ferrum_mcp/tools/get_text_tool.rb +67 -0
- data/lib/ferrum_mcp/tools/get_title_tool.rb +42 -0
- data/lib/ferrum_mcp/tools/get_url_tool.rb +39 -0
- data/lib/ferrum_mcp/tools/go_back_tool.rb +49 -0
- data/lib/ferrum_mcp/tools/go_forward_tool.rb +49 -0
- data/lib/ferrum_mcp/tools/hover_tool.rb +76 -0
- data/lib/ferrum_mcp/tools/list_sessions_tool.rb +33 -0
- data/lib/ferrum_mcp/tools/navigate_tool.rb +59 -0
- data/lib/ferrum_mcp/tools/press_key_tool.rb +91 -0
- data/lib/ferrum_mcp/tools/query_shadow_dom_tool.rb +225 -0
- data/lib/ferrum_mcp/tools/refresh_tool.rb +49 -0
- data/lib/ferrum_mcp/tools/screenshot_tool.rb +121 -0
- data/lib/ferrum_mcp/tools/session_tool.rb +37 -0
- data/lib/ferrum_mcp/tools/set_cookie_tool.rb +77 -0
- data/lib/ferrum_mcp/tools/solve_captcha_tool.rb +528 -0
- data/lib/ferrum_mcp/transport/http_server.rb +93 -0
- data/lib/ferrum_mcp/transport/rate_limiter.rb +79 -0
- data/lib/ferrum_mcp/transport/stdio_server.rb +63 -0
- data/lib/ferrum_mcp/version.rb +5 -0
- data/lib/ferrum_mcp/whisper_service.rb +222 -0
- data/lib/ferrum_mcp.rb +35 -0
- metadata +248 -0
data/docs/DOCKER.md
ADDED
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
# Docker Deployment Guide
|
|
2
|
+
|
|
3
|
+
This guide covers deploying FerrumMCP using Docker, including integration with Claude Desktop and Claude Code.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Docker Images](#docker-images)
|
|
9
|
+
- [Running the Container](#running-the-container)
|
|
10
|
+
- [BotBrowser Integration](#botbrowser-integration)
|
|
11
|
+
- [Claude Desktop Integration](#claude-desktop-integration)
|
|
12
|
+
- [Claude Code Integration](#claude-code-integration)
|
|
13
|
+
- [Environment Variables](#environment-variables)
|
|
14
|
+
- [Security](#security)
|
|
15
|
+
- [Troubleshooting](#troubleshooting)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Standard Image (Chromium Only)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
docker pull eth3rnit3/ferrum-mcp:latest
|
|
25
|
+
docker run -d -p 3000:3000 --security-opt seccomp=unconfined eth3rnit3/ferrum-mcp:latest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### BotBrowser Image (Anti-Detection)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
docker pull eth3rnit3/ferrum-mcp:botbrowser
|
|
32
|
+
docker run -d -p 3000:3000 --security-opt seccomp=unconfined \
|
|
33
|
+
-v ./profiles:/app/profiles:ro \
|
|
34
|
+
eth3rnit3/ferrum-mcp:botbrowser
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Build Locally
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/Eth3rnit3/FerrumMCP.git
|
|
41
|
+
cd FerrumMCP
|
|
42
|
+
|
|
43
|
+
# Standard image
|
|
44
|
+
docker build -t ferrum-mcp:latest .
|
|
45
|
+
|
|
46
|
+
# BotBrowser image
|
|
47
|
+
docker build -f Dockerfile.with-botbrowser --build-arg INCLUDE_BOTBROWSER=true \
|
|
48
|
+
-t ferrum-mcp:botbrowser .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The server will be available at `http://localhost:3000`.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Docker Images
|
|
56
|
+
|
|
57
|
+
We provide **two Docker images** on Docker Hub:
|
|
58
|
+
|
|
59
|
+
### 1. Standard Image (`latest`)
|
|
60
|
+
|
|
61
|
+
- **Tag**: `eth3rnit3/ferrum-mcp:latest`
|
|
62
|
+
- **Base**: `ruby:3.2-alpine`
|
|
63
|
+
- **Size**: ~1.84GB
|
|
64
|
+
- **Browser**: Chromium (headless only)
|
|
65
|
+
- **Use case**: General browser automation
|
|
66
|
+
|
|
67
|
+
**Image details:**
|
|
68
|
+
- User: `ferrum` (non-root, UID 1000)
|
|
69
|
+
- Platforms: `linux/amd64`, `linux/arm64`
|
|
70
|
+
- Health check included
|
|
71
|
+
- Automatic cleanup of build dependencies
|
|
72
|
+
|
|
73
|
+
### 2. BotBrowser Image (`botbrowser`)
|
|
74
|
+
|
|
75
|
+
- **Tag**: `eth3rnit3/ferrum-mcp:botbrowser`
|
|
76
|
+
- **Base**: `ruby:3.2-alpine`
|
|
77
|
+
- **Size**: ~4.14GB
|
|
78
|
+
- **Browsers**: Chromium + BotBrowser (257.8MB)
|
|
79
|
+
- **Use case**: Anti-detection automation, fingerprint management
|
|
80
|
+
|
|
81
|
+
**Features:**
|
|
82
|
+
- Automatic BotBrowser download from GitHub releases
|
|
83
|
+
- Multi-architecture support (amd64/arm64)
|
|
84
|
+
- Profile encryption support
|
|
85
|
+
- Advanced anti-detection capabilities
|
|
86
|
+
|
|
87
|
+
### What's Included
|
|
88
|
+
|
|
89
|
+
✅ **Runtime Dependencies**
|
|
90
|
+
- Chromium browser
|
|
91
|
+
- ChromeDriver
|
|
92
|
+
- libvips (for image processing)
|
|
93
|
+
- Required fonts and libraries
|
|
94
|
+
|
|
95
|
+
✅ **Security Features**
|
|
96
|
+
- Non-root user execution
|
|
97
|
+
- Minimal attack surface
|
|
98
|
+
- Build dependencies removed after installation
|
|
99
|
+
|
|
100
|
+
✅ **Optimizations**
|
|
101
|
+
- Multi-stage build process
|
|
102
|
+
- Bundle cache cleaned (~30MB saved)
|
|
103
|
+
- Only essential files copied
|
|
104
|
+
|
|
105
|
+
### Image Layers
|
|
106
|
+
|
|
107
|
+
```dockerfile
|
|
108
|
+
FROM ruby:3.2-alpine
|
|
109
|
+
├── Install runtime dependencies (chromium, vips)
|
|
110
|
+
├── Install build dependencies (removed after)
|
|
111
|
+
├── Create non-root user (ferrum)
|
|
112
|
+
├── Bundle install & cleanup
|
|
113
|
+
├── Copy application code
|
|
114
|
+
└── Switch to non-root user
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Running the Container
|
|
120
|
+
|
|
121
|
+
### HTTP Transport (Default)
|
|
122
|
+
|
|
123
|
+
For HTTP-based MCP clients:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
docker run -d \
|
|
127
|
+
--name ferrum-mcp \
|
|
128
|
+
--security-opt seccomp=unconfined \
|
|
129
|
+
-p 3000:3000 \
|
|
130
|
+
ferrum-mcp:latest
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Endpoints:**
|
|
134
|
+
- MCP: `http://localhost:3000/mcp`
|
|
135
|
+
- Health: `http://localhost:3000/health`
|
|
136
|
+
|
|
137
|
+
### STDIO Transport
|
|
138
|
+
|
|
139
|
+
For Claude Desktop or other STDIO-based clients:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
docker run --rm -i \
|
|
143
|
+
--security-opt seccomp=unconfined \
|
|
144
|
+
ferrum-mcp:latest \
|
|
145
|
+
ruby bin/ferrum-mcp --transport stdio
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### With Environment Variables
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
docker run -d \
|
|
152
|
+
--name ferrum-mcp \
|
|
153
|
+
--security-opt seccomp=unconfined \
|
|
154
|
+
-p 3000:3000 \
|
|
155
|
+
-e LOG_LEVEL=debug \
|
|
156
|
+
-e BROWSER_TIMEOUT=90 \
|
|
157
|
+
ferrum-mcp:latest
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Docker Compose
|
|
161
|
+
|
|
162
|
+
Create `docker-compose.yml`:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
version: '3.8'
|
|
166
|
+
|
|
167
|
+
services:
|
|
168
|
+
ferrum-mcp:
|
|
169
|
+
image: ferrum-mcp:latest
|
|
170
|
+
container_name: ferrum-mcp
|
|
171
|
+
security_opt:
|
|
172
|
+
- seccomp:unconfined
|
|
173
|
+
ports:
|
|
174
|
+
- "3000:3000"
|
|
175
|
+
environment:
|
|
176
|
+
- LOG_LEVEL=info
|
|
177
|
+
- BROWSER_TIMEOUT=120
|
|
178
|
+
restart: unless-stopped
|
|
179
|
+
healthcheck:
|
|
180
|
+
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
|
|
181
|
+
interval: 30s
|
|
182
|
+
timeout: 3s
|
|
183
|
+
retries: 3
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Run with:
|
|
187
|
+
```bash
|
|
188
|
+
docker-compose up -d
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## BotBrowser Integration
|
|
194
|
+
|
|
195
|
+
The BotBrowser image (`eth3rnit3/ferrum-mcp:botbrowser`) includes anti-detection capabilities for bypassing bot detection systems.
|
|
196
|
+
|
|
197
|
+
### Downloading BotBrowser Profiles
|
|
198
|
+
|
|
199
|
+
BotBrowser profiles must be obtained separately (licensed). Download from [BotBrowser](https://botbrowser.com).
|
|
200
|
+
|
|
201
|
+
**Profile types:**
|
|
202
|
+
- **Operating Systems**: macOS, Windows, Linux, Android
|
|
203
|
+
- **Browsers**: Chrome, Firefox, Edge, Safari
|
|
204
|
+
- **Formats**: `.enc` (encrypted) or unencrypted
|
|
205
|
+
|
|
206
|
+
### Running with Bot Profiles
|
|
207
|
+
|
|
208
|
+
**1. Create profiles directory:**
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
mkdir -p ./profiles
|
|
212
|
+
# Copy your .enc profile files to ./profiles/
|
|
213
|
+
cp ~/Downloads/*.enc ./profiles/
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**2. Run container with profiles mounted:**
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
docker run -d \
|
|
220
|
+
--name ferrum-mcp-bot \
|
|
221
|
+
--security-opt seccomp=unconfined \
|
|
222
|
+
-p 3000:3000 \
|
|
223
|
+
-v "$(pwd)/profiles:/app/profiles:ro" \
|
|
224
|
+
-e "BOT_PROFILE_US=/app/profiles/us_chrome.enc:US Chrome:Chrome US fingerprint" \
|
|
225
|
+
-e "BOT_PROFILE_EU=/app/profiles/eu_firefox.enc:EU Firefox:Firefox EU fingerprint" \
|
|
226
|
+
eth3rnit3/ferrum-mcp:botbrowser
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Profile environment variable format:**
|
|
230
|
+
```
|
|
231
|
+
BOT_PROFILE_<ID>=path:name:description
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**3. Discover available profiles:**
|
|
235
|
+
|
|
236
|
+
Once the container is running, you can query available profiles via the MCP resource endpoint:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
curl -X POST http://localhost:3000/mcp/v1 \
|
|
240
|
+
-H "Content-Type: application/json" \
|
|
241
|
+
-d '{
|
|
242
|
+
"jsonrpc": "2.0",
|
|
243
|
+
"id": 1,
|
|
244
|
+
"method": "resources/read",
|
|
245
|
+
"params": {
|
|
246
|
+
"uri": "ferrum://bot-profiles"
|
|
247
|
+
}
|
|
248
|
+
}'
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**4. Create session with BotBrowser profile:**
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
curl -X POST http://localhost:3000/mcp/v1 \
|
|
255
|
+
-H "Content-Type: application/json" \
|
|
256
|
+
-d '{
|
|
257
|
+
"jsonrpc": "2.0",
|
|
258
|
+
"id": 2,
|
|
259
|
+
"method": "tools/call",
|
|
260
|
+
"params": {
|
|
261
|
+
"name": "create_session",
|
|
262
|
+
"arguments": {
|
|
263
|
+
"bot_profile_id": "us",
|
|
264
|
+
"headless": true
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}'
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Docker Compose with BotBrowser
|
|
271
|
+
|
|
272
|
+
Create `docker-compose.yml`:
|
|
273
|
+
|
|
274
|
+
```yaml
|
|
275
|
+
version: '3.8'
|
|
276
|
+
|
|
277
|
+
services:
|
|
278
|
+
ferrum-mcp-botbrowser:
|
|
279
|
+
image: eth3rnit3/ferrum-mcp:botbrowser
|
|
280
|
+
container_name: ferrum-mcp-bot
|
|
281
|
+
security_opt:
|
|
282
|
+
- seccomp:unconfined
|
|
283
|
+
ports:
|
|
284
|
+
- "3000:3000"
|
|
285
|
+
volumes:
|
|
286
|
+
- ./profiles:/app/profiles:ro
|
|
287
|
+
environment:
|
|
288
|
+
- LOG_LEVEL=info
|
|
289
|
+
- BROWSER_TIMEOUT=120
|
|
290
|
+
# BotBrowser profiles
|
|
291
|
+
- BOT_PROFILE_US=/app/profiles/us_chrome.enc:US Chrome:Chrome US fingerprint
|
|
292
|
+
- BOT_PROFILE_EU=/app/profiles/eu_firefox.enc:EU Firefox:Firefox EU fingerprint
|
|
293
|
+
- BOT_PROFILE_ANDROID=/app/profiles/android.enc:Android:Mobile fingerprint
|
|
294
|
+
restart: unless-stopped
|
|
295
|
+
healthcheck:
|
|
296
|
+
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
|
|
297
|
+
interval: 30s
|
|
298
|
+
timeout: 3s
|
|
299
|
+
retries: 3
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Claude Desktop Integration
|
|
305
|
+
|
|
306
|
+
### Prerequisites
|
|
307
|
+
|
|
308
|
+
- Docker installed and running
|
|
309
|
+
- Claude Desktop installed
|
|
310
|
+
- FerrumMCP Docker image available
|
|
311
|
+
|
|
312
|
+
### Configuration
|
|
313
|
+
|
|
314
|
+
**Config file location:**
|
|
315
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
316
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
317
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
318
|
+
|
|
319
|
+
**Configuration:**
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"mcpServers": {
|
|
324
|
+
"ferrum-mcp": {
|
|
325
|
+
"command": "docker",
|
|
326
|
+
"args": [
|
|
327
|
+
"run",
|
|
328
|
+
"--rm",
|
|
329
|
+
"-i",
|
|
330
|
+
"--security-opt",
|
|
331
|
+
"seccomp=unconfined",
|
|
332
|
+
"ferrum-mcp:latest",
|
|
333
|
+
"ruby",
|
|
334
|
+
"bin/ferrum-mcp",
|
|
335
|
+
"--transport",
|
|
336
|
+
"stdio"
|
|
337
|
+
],
|
|
338
|
+
"env": {}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### How It Works
|
|
345
|
+
|
|
346
|
+
1. **Claude Desktop** starts the Docker container when needed
|
|
347
|
+
2. Container runs in **interactive mode** (`-i`)
|
|
348
|
+
3. Communication via **STDIO** (stdin/stdout)
|
|
349
|
+
4. Container is **automatically removed** (`--rm`) when Claude Desktop stops
|
|
350
|
+
5. **Headless mode enforced** (see security section below)
|
|
351
|
+
|
|
352
|
+
### After Configuration
|
|
353
|
+
|
|
354
|
+
1. **Save** the configuration file
|
|
355
|
+
2. **Restart** Claude Desktop
|
|
356
|
+
3. **Test** by asking Claude to navigate to a website
|
|
357
|
+
|
|
358
|
+
### Rebuilding After Code Changes
|
|
359
|
+
|
|
360
|
+
If you modify the FerrumMCP code:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# Rebuild the image
|
|
364
|
+
cd /path/to/ferrum-mcp
|
|
365
|
+
docker build -t ferrum-mcp:latest .
|
|
366
|
+
|
|
367
|
+
# Restart Claude Desktop
|
|
368
|
+
# The new image will be used on next launch
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Claude Code Integration
|
|
374
|
+
|
|
375
|
+
[Claude Code](https://claude.com/code) supports MCP servers via HTTP transport, making it perfect for Docker deployments.
|
|
376
|
+
|
|
377
|
+
### Standard Image Setup
|
|
378
|
+
|
|
379
|
+
**1. Start the container:**
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
docker run -d \
|
|
383
|
+
--name ferrum-mcp \
|
|
384
|
+
--security-opt seccomp=unconfined \
|
|
385
|
+
-p 3000:3000 \
|
|
386
|
+
eth3rnit3/ferrum-mcp:latest
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**2. Configure Claude Code:**
|
|
390
|
+
|
|
391
|
+
Add to your Claude Code MCP settings (`~/.config/claude-code/mcp-servers.json` or via settings UI):
|
|
392
|
+
|
|
393
|
+
```json
|
|
394
|
+
{
|
|
395
|
+
"ferrum-mcp": {
|
|
396
|
+
"url": "http://localhost:3000/mcp/v1",
|
|
397
|
+
"transport": "http"
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**3. Verify connection:**
|
|
403
|
+
|
|
404
|
+
Ask Claude Code to test the connection:
|
|
405
|
+
```
|
|
406
|
+
Can you navigate to https://example.com and get the page title?
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### BotBrowser Image Setup
|
|
410
|
+
|
|
411
|
+
For anti-detection automation with Claude Code:
|
|
412
|
+
|
|
413
|
+
**1. Prepare profiles directory:**
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
mkdir -p ~/ferrum-profiles
|
|
417
|
+
# Copy your BotBrowser .enc profiles
|
|
418
|
+
cp ~/Downloads/*.enc ~/ferrum-profiles/
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**2. Start BotBrowser container:**
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
docker run -d \
|
|
425
|
+
--name ferrum-mcp-bot \
|
|
426
|
+
--security-opt seccomp=unconfined \
|
|
427
|
+
-p 3000:3000 \
|
|
428
|
+
-v ~/ferrum-profiles:/app/profiles:ro \
|
|
429
|
+
-e "BOT_PROFILE_US=/app/profiles/us_chrome.enc:US Chrome:US fingerprint" \
|
|
430
|
+
-e "BOT_PROFILE_EU=/app/profiles/eu_firefox.enc:EU Firefox:EU fingerprint" \
|
|
431
|
+
-e "BOT_PROFILE_MOBILE=/app/profiles/android.enc:Mobile:Android fingerprint" \
|
|
432
|
+
eth3rnit3/ferrum-mcp:botbrowser
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**3. Configure Claude Code** (same as standard setup):
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"ferrum-mcp": {
|
|
440
|
+
"url": "http://localhost:3000/mcp/v1",
|
|
441
|
+
"transport": "http"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**4. Use BotBrowser profiles with Claude Code:**
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
First, discover available BotBrowser profiles by reading the ferrum://bot-profiles resource.
|
|
450
|
+
Then create a session with bot_profile_id "us" and navigate to a protected website.
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Claude Code will:
|
|
454
|
+
1. Query the `ferrum://bot-profiles` resource to see available profiles
|
|
455
|
+
2. Create a session with the specified profile
|
|
456
|
+
3. Perform browser automation with anti-detection enabled
|
|
457
|
+
|
|
458
|
+
### Docker Compose for Claude Code
|
|
459
|
+
|
|
460
|
+
Create `docker-compose.yml` for persistent setup:
|
|
461
|
+
|
|
462
|
+
```yaml
|
|
463
|
+
version: '3.8'
|
|
464
|
+
|
|
465
|
+
services:
|
|
466
|
+
# Standard browser automation
|
|
467
|
+
ferrum-mcp:
|
|
468
|
+
image: eth3rnit3/ferrum-mcp:latest
|
|
469
|
+
container_name: ferrum-mcp
|
|
470
|
+
security_opt:
|
|
471
|
+
- seccomp:unconfined
|
|
472
|
+
ports:
|
|
473
|
+
- "3000:3000"
|
|
474
|
+
environment:
|
|
475
|
+
- LOG_LEVEL=info
|
|
476
|
+
- BROWSER_TIMEOUT=120
|
|
477
|
+
restart: unless-stopped
|
|
478
|
+
healthcheck:
|
|
479
|
+
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
|
|
480
|
+
interval: 30s
|
|
481
|
+
timeout: 3s
|
|
482
|
+
retries: 3
|
|
483
|
+
|
|
484
|
+
# BotBrowser (anti-detection)
|
|
485
|
+
ferrum-mcp-bot:
|
|
486
|
+
image: eth3rnit3/ferrum-mcp:botbrowser
|
|
487
|
+
container_name: ferrum-mcp-bot
|
|
488
|
+
security_opt:
|
|
489
|
+
- seccomp:unconfined
|
|
490
|
+
ports:
|
|
491
|
+
- "3001:3000" # Different port to run alongside standard
|
|
492
|
+
volumes:
|
|
493
|
+
- ~/ferrum-profiles:/app/profiles:ro
|
|
494
|
+
environment:
|
|
495
|
+
- LOG_LEVEL=info
|
|
496
|
+
- BROWSER_TIMEOUT=120
|
|
497
|
+
- BOT_PROFILE_US=/app/profiles/us_chrome.enc:US:Chrome US
|
|
498
|
+
- BOT_PROFILE_EU=/app/profiles/eu_chrome.enc:EU:Chrome EU
|
|
499
|
+
- BOT_PROFILE_MOBILE=/app/profiles/android.enc:Mobile:Android
|
|
500
|
+
restart: unless-stopped
|
|
501
|
+
healthcheck:
|
|
502
|
+
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
|
|
503
|
+
interval: 30s
|
|
504
|
+
timeout: 3s
|
|
505
|
+
retries: 3
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
**Start both:**
|
|
509
|
+
```bash
|
|
510
|
+
docker-compose up -d
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**Configure both in Claude Code:**
|
|
514
|
+
```json
|
|
515
|
+
{
|
|
516
|
+
"ferrum-mcp-standard": {
|
|
517
|
+
"url": "http://localhost:3000/mcp/v1",
|
|
518
|
+
"transport": "http"
|
|
519
|
+
},
|
|
520
|
+
"ferrum-mcp-botbrowser": {
|
|
521
|
+
"url": "http://localhost:3001/mcp/v1",
|
|
522
|
+
"transport": "http"
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Example Usage with Claude Code
|
|
528
|
+
|
|
529
|
+
**Discover resources:**
|
|
530
|
+
```
|
|
531
|
+
Read the ferrum://browsers resource to see what browsers are available.
|
|
532
|
+
Then read ferrum://bot-profiles to see BotBrowser profiles.
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**Create session with BotBrowser:**
|
|
536
|
+
```
|
|
537
|
+
Create a browser session using the "us" BotBrowser profile with headless mode enabled.
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
**Automated workflow:**
|
|
541
|
+
```
|
|
542
|
+
Using the BotBrowser session:
|
|
543
|
+
1. Navigate to https://protected-site.com
|
|
544
|
+
2. Accept cookies if a banner appears
|
|
545
|
+
3. Fill the login form with username "test" and password "test123"
|
|
546
|
+
4. Click the login button
|
|
547
|
+
5. Take a screenshot of the result
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Claude Code will automatically:
|
|
551
|
+
- Use the BotBrowser anti-detection profile
|
|
552
|
+
- Handle cookie banners intelligently
|
|
553
|
+
- Execute the workflow with proper fingerprint masking
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## Environment Variables
|
|
558
|
+
|
|
559
|
+
When running in Docker, these environment variables are pre-configured:
|
|
560
|
+
|
|
561
|
+
| Variable | Default | Description |
|
|
562
|
+
|----------|---------|-------------|
|
|
563
|
+
| `DOCKER` | `true` | Indicates Docker environment (auto-set) |
|
|
564
|
+
| `BROWSER_PATH` | `/usr/bin/chromium-browser` | Chromium binary path |
|
|
565
|
+
| `BROWSER_HEADLESS` | `true` | Forced to true in Docker |
|
|
566
|
+
| `BROWSER_TIMEOUT` | `120` | Browser operation timeout (seconds) |
|
|
567
|
+
| `LOG_LEVEL` | `info` | Logging verbosity |
|
|
568
|
+
| `PORT` | `3000` | HTTP server port |
|
|
569
|
+
| `HOST` | `0.0.0.0` | HTTP server bind address |
|
|
570
|
+
|
|
571
|
+
### Override Variables
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
docker run -d \
|
|
575
|
+
--name ferrum-mcp \
|
|
576
|
+
--security-opt seccomp=unconfined \
|
|
577
|
+
-p 3000:3000 \
|
|
578
|
+
-e LOG_LEVEL=debug \
|
|
579
|
+
-e BROWSER_TIMEOUT=180 \
|
|
580
|
+
ferrum-mcp:latest
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Security
|
|
586
|
+
|
|
587
|
+
### Headless Mode Enforcement
|
|
588
|
+
|
|
589
|
+
**Important**: In Docker, **headless mode is mandatory and automatically enforced**.
|
|
590
|
+
|
|
591
|
+
When creating a session:
|
|
592
|
+
- ✅ `headless: true` or omitted → Session created
|
|
593
|
+
- ❌ `headless: false` → **Error: "Headless mode is required when running in Docker"**
|
|
594
|
+
|
|
595
|
+
This is a security measure because:
|
|
596
|
+
- GUI applications don't work properly in containers
|
|
597
|
+
- X11 forwarding creates security risks
|
|
598
|
+
- Headless mode is more stable and performant
|
|
599
|
+
|
|
600
|
+
### Non-Root User
|
|
601
|
+
|
|
602
|
+
The container runs as user `ferrum` (UID 1000):
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
# Verify user
|
|
606
|
+
docker exec <container_id> whoami
|
|
607
|
+
# Output: ferrum
|
|
608
|
+
|
|
609
|
+
docker exec <container_id> id
|
|
610
|
+
# Output: uid=1000(ferrum) gid=1000(ferrum)
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Required Security Options
|
|
614
|
+
|
|
615
|
+
**`--security-opt seccomp=unconfined`** is required for Chromium to function.
|
|
616
|
+
|
|
617
|
+
Alternative (more restrictive but complex):
|
|
618
|
+
```bash
|
|
619
|
+
docker run -d \
|
|
620
|
+
--name ferrum-mcp \
|
|
621
|
+
--cap-add=SYS_ADMIN \
|
|
622
|
+
-p 3000:3000 \
|
|
623
|
+
ferrum-mcp:latest
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### File Permissions
|
|
627
|
+
|
|
628
|
+
All files in `/app` are owned by `ferrum:ferrum`:
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
docker exec <container_id> ls -la /app
|
|
632
|
+
# drwxr-xr-x ferrum ferrum ...
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
## Troubleshooting
|
|
638
|
+
|
|
639
|
+
### Container Won't Start
|
|
640
|
+
|
|
641
|
+
**Check Docker logs:**
|
|
642
|
+
```bash
|
|
643
|
+
docker logs <container_id>
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Common issues:**
|
|
647
|
+
- Missing `--security-opt seccomp=unconfined`
|
|
648
|
+
- Port 3000 already in use
|
|
649
|
+
- Insufficient memory
|
|
650
|
+
|
|
651
|
+
### Health Check Fails
|
|
652
|
+
|
|
653
|
+
**Test manually:**
|
|
654
|
+
```bash
|
|
655
|
+
curl http://localhost:3000/health
|
|
656
|
+
# Expected: {"status":"ok"}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
**Check container health:**
|
|
660
|
+
```bash
|
|
661
|
+
docker ps
|
|
662
|
+
# Look for (healthy) or (unhealthy)
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### Session Creation Fails
|
|
666
|
+
|
|
667
|
+
**Error: "Headless mode is required"**
|
|
668
|
+
- You tried to create a session with `headless: false`
|
|
669
|
+
- Solution: Remove the `headless` parameter or set it to `true`
|
|
670
|
+
|
|
671
|
+
**Error: "Browser timeout"**
|
|
672
|
+
- Increase `BROWSER_TIMEOUT` environment variable
|
|
673
|
+
- Check available memory
|
|
674
|
+
|
|
675
|
+
### Claude Desktop Can't Connect
|
|
676
|
+
|
|
677
|
+
**Verify image exists:**
|
|
678
|
+
```bash
|
|
679
|
+
docker images ferrum-mcp:latest
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
**Check configuration:**
|
|
683
|
+
- Verify JSON syntax in `claude_desktop_config.json`
|
|
684
|
+
- Ensure `ferrum-mcp:latest` is the correct image tag
|
|
685
|
+
|
|
686
|
+
**Rebuild image:**
|
|
687
|
+
```bash
|
|
688
|
+
docker build -t ferrum-mcp:latest .
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
**Restart Claude Desktop:**
|
|
692
|
+
- Completely quit Claude Desktop
|
|
693
|
+
- Start it again
|
|
694
|
+
|
|
695
|
+
### Performance Issues
|
|
696
|
+
|
|
697
|
+
**Increase memory allocation:**
|
|
698
|
+
|
|
699
|
+
Docker Desktop → Settings → Resources → Memory (recommended: 4GB+)
|
|
700
|
+
|
|
701
|
+
**Monitor container resources:**
|
|
702
|
+
```bash
|
|
703
|
+
docker stats <container_id>
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
### Logs Location
|
|
707
|
+
|
|
708
|
+
**Container logs:**
|
|
709
|
+
```bash
|
|
710
|
+
docker logs <container_id>
|
|
711
|
+
|
|
712
|
+
# Follow logs in real-time
|
|
713
|
+
docker logs -f <container_id>
|
|
714
|
+
|
|
715
|
+
# Last 100 lines
|
|
716
|
+
docker logs --tail 100 <container_id>
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
**Application logs (inside container):**
|
|
720
|
+
```bash
|
|
721
|
+
docker exec <container_id> cat logs/ferrum_mcp.log
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## Advanced Usage
|
|
727
|
+
|
|
728
|
+
### Custom Dockerfile
|
|
729
|
+
|
|
730
|
+
If you need to customize the image:
|
|
731
|
+
|
|
732
|
+
```dockerfile
|
|
733
|
+
FROM ferrum-mcp:latest
|
|
734
|
+
|
|
735
|
+
# Add custom fonts
|
|
736
|
+
RUN apk add --no-cache font-custom
|
|
737
|
+
|
|
738
|
+
# Add custom scripts
|
|
739
|
+
COPY scripts/ /app/scripts/
|
|
740
|
+
|
|
741
|
+
# Environment variables
|
|
742
|
+
ENV CUSTOM_VAR=value
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
Build:
|
|
746
|
+
```bash
|
|
747
|
+
docker build -t ferrum-mcp:custom .
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### Volume Mounts
|
|
751
|
+
|
|
752
|
+
**Mount logs directory:**
|
|
753
|
+
```bash
|
|
754
|
+
docker run -d \
|
|
755
|
+
--name ferrum-mcp \
|
|
756
|
+
--security-opt seccomp=unconfined \
|
|
757
|
+
-p 3000:3000 \
|
|
758
|
+
-v $(pwd)/logs:/app/logs \
|
|
759
|
+
ferrum-mcp:latest
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
**Note**: Files will be owned by UID 1000 (ferrum user)
|
|
763
|
+
|
|
764
|
+
### Multi-Container Setup
|
|
765
|
+
|
|
766
|
+
For load balancing or testing:
|
|
767
|
+
|
|
768
|
+
```yaml
|
|
769
|
+
version: '3.8'
|
|
770
|
+
|
|
771
|
+
services:
|
|
772
|
+
ferrum-mcp-1:
|
|
773
|
+
image: ferrum-mcp:latest
|
|
774
|
+
security_opt:
|
|
775
|
+
- seccomp:unconfined
|
|
776
|
+
ports:
|
|
777
|
+
- "3001:3000"
|
|
778
|
+
|
|
779
|
+
ferrum-mcp-2:
|
|
780
|
+
image: ferrum-mcp:latest
|
|
781
|
+
security_opt:
|
|
782
|
+
- seccomp:unconfined
|
|
783
|
+
ports:
|
|
784
|
+
- "3002:3000"
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
### Inspect Container
|
|
788
|
+
|
|
789
|
+
```bash
|
|
790
|
+
# Enter container shell
|
|
791
|
+
docker exec -it <container_id> sh
|
|
792
|
+
|
|
793
|
+
# Check processes
|
|
794
|
+
docker top <container_id>
|
|
795
|
+
|
|
796
|
+
# Inspect configuration
|
|
797
|
+
docker inspect <container_id>
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
---
|
|
801
|
+
|
|
802
|
+
## Migration from Local to Docker
|
|
803
|
+
|
|
804
|
+
### 1. Test Locally First
|
|
805
|
+
|
|
806
|
+
```bash
|
|
807
|
+
# Start container
|
|
808
|
+
docker run -d -p 3000:3000 --security-opt seccomp=unconfined ferrum-mcp:latest
|
|
809
|
+
|
|
810
|
+
# Test health check
|
|
811
|
+
curl http://localhost:3000/health
|
|
812
|
+
|
|
813
|
+
# Create a test session
|
|
814
|
+
curl -X POST http://localhost:3000/mcp/v1 \
|
|
815
|
+
-H "Content-Type: application/json" \
|
|
816
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_session","arguments":{"headless":true}}}'
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
### 2. Update Claude Desktop Config
|
|
820
|
+
|
|
821
|
+
Replace local Ruby configuration with Docker configuration (see [Claude Desktop Integration](#claude-desktop-integration))
|
|
822
|
+
|
|
823
|
+
### 3. Restart Claude Desktop
|
|
824
|
+
|
|
825
|
+
### 4. Verify
|
|
826
|
+
|
|
827
|
+
Ask Claude to perform a simple navigation task.
|
|
828
|
+
|
|
829
|
+
---
|
|
830
|
+
|
|
831
|
+
## Next Steps
|
|
832
|
+
|
|
833
|
+
- [API Reference](API_REFERENCE.md) - Learn about available tools
|
|
834
|
+
- [Configuration](CONFIGURATION.md) - Advanced configuration options
|
|
835
|
+
- [Deployment](DEPLOYMENT.md) - Production deployment strategies
|
|
836
|
+
- [Troubleshooting](TROUBLESHOOTING.md) - Detailed troubleshooting guide
|