ferrum-mcp 1.0.0 → 1.1.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 +4 -4
- data/.env.example +37 -0
- data/CHANGELOG.md +72 -1
- data/README.md +30 -9
- data/docs/API_REFERENCE.md +300 -21
- data/docs/CONFIGURATION.md +34 -1
- data/docs/DEPLOYMENT.md +1 -0
- data/docs/DOCKER_BOTBROWSER.md +4 -0
- data/lib/ferrum_mcp/browser_manager.rb +56 -32
- data/lib/ferrum_mcp/cli/command_handler.rb +4 -3
- data/lib/ferrum_mcp/cli/server_runner.rb +19 -6
- data/lib/ferrum_mcp/configuration.rb +77 -18
- data/lib/ferrum_mcp/image_resizer.rb +43 -0
- data/lib/ferrum_mcp/server.rb +58 -91
- data/lib/ferrum_mcp/session.rb +67 -9
- data/lib/ferrum_mcp/session_manager.rb +15 -15
- data/lib/ferrum_mcp/tools/accept_cookies_tool.rb +11 -31
- data/lib/ferrum_mcp/tools/base_tool.rb +79 -38
- data/lib/ferrum_mcp/tools/clear_cookies_tool.rb +14 -43
- data/lib/ferrum_mcp/tools/click_tool.rb +58 -181
- data/lib/ferrum_mcp/tools/close_session_tool.rb +8 -30
- data/lib/ferrum_mcp/tools/close_tab_tool.rb +44 -0
- data/lib/ferrum_mcp/tools/create_session_tool.rb +38 -110
- data/lib/ferrum_mcp/tools/definition.rb +106 -0
- data/lib/ferrum_mcp/tools/drag_and_drop_tool.rb +43 -145
- data/lib/ferrum_mcp/tools/evaluate_js_tool.rb +6 -28
- data/lib/ferrum_mcp/tools/execute_script_tool.rb +6 -30
- data/lib/ferrum_mcp/tools/fill_form_tool.rb +37 -52
- data/lib/ferrum_mcp/tools/find_by_text_tool.rb +39 -114
- data/lib/ferrum_mcp/tools/get_attribute_tool.rb +10 -39
- data/lib/ferrum_mcp/tools/get_cookies_tool.rb +23 -52
- data/lib/ferrum_mcp/tools/get_html_tool.rb +22 -35
- data/lib/ferrum_mcp/tools/get_session_info_tool.rb +5 -21
- data/lib/ferrum_mcp/tools/get_text_tool.rb +22 -46
- data/lib/ferrum_mcp/tools/get_title_tool.rb +5 -28
- data/lib/ferrum_mcp/tools/get_url_tool.rb +5 -25
- data/lib/ferrum_mcp/tools/go_back_tool.rb +7 -30
- data/lib/ferrum_mcp/tools/go_forward_tool.rb +7 -30
- data/lib/ferrum_mcp/tools/hover_tool.rb +10 -51
- data/lib/ferrum_mcp/tools/list_sessions_tool.rb +5 -19
- data/lib/ferrum_mcp/tools/list_tabs_tool.rb +20 -0
- data/lib/ferrum_mcp/tools/navigate_tool.rb +17 -37
- data/lib/ferrum_mcp/tools/new_tab_tool.rb +36 -0
- data/lib/ferrum_mcp/tools/press_key_tool.rb +18 -63
- data/lib/ferrum_mcp/tools/query_shadow_dom_tool.rb +50 -205
- data/lib/ferrum_mcp/tools/refresh_tool.rb +7 -30
- data/lib/ferrum_mcp/tools/screenshot_tool.rb +29 -86
- data/lib/ferrum_mcp/tools/scroll_tool.rb +64 -0
- data/lib/ferrum_mcp/tools/select_option_tool.rb +56 -0
- data/lib/ferrum_mcp/tools/session_tool.rb +10 -9
- data/lib/ferrum_mcp/tools/set_cookie_tool.rb +15 -56
- data/lib/ferrum_mcp/tools/set_viewport_tool.rb +32 -0
- data/lib/ferrum_mcp/tools/snapshot_tool.rb +175 -0
- data/lib/ferrum_mcp/tools/solve_captcha_tool.rb +17 -35
- data/lib/ferrum_mcp/tools/switch_tab_tool.rb +29 -0
- data/lib/ferrum_mcp/tools/tab_tool.rb +40 -0
- data/lib/ferrum_mcp/tools/upload_file_tool.rb +50 -0
- data/lib/ferrum_mcp/tools/wait_for_network_idle_tool.rb +32 -0
- data/lib/ferrum_mcp/tools/wait_for_selector_tool.rb +59 -0
- data/lib/ferrum_mcp/tools/wait_for_text_tool.rb +53 -0
- data/lib/ferrum_mcp/transport/api_key_authenticator.rb +112 -0
- data/lib/ferrum_mcp/transport/client_address.rb +23 -0
- data/lib/ferrum_mcp/transport/http_server.rb +11 -1
- data/lib/ferrum_mcp/transport/rate_limiter.rb +2 -6
- data/lib/ferrum_mcp/transport/stdio_server.rb +8 -30
- data/lib/ferrum_mcp/url_policy.rb +88 -0
- data/lib/ferrum_mcp/version.rb +1 -1
- metadata +21 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2eb5504afb33d3f509798c6a98d9103c8da74c995e971a684503a5f5ca711228
|
|
4
|
+
data.tar.gz: 71e4317848e0ee839ae286d0b41d738572bd168a9a0e120ec6a139e98ab3124c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ed7eb1616f05fd46e21c4f451834b28753b1f76c2858b54080e61c64e3c539580ba93092bfd281e7bfb0864a3a78a6f357d854bd52d7bd96b26a89e28a22cf1
|
|
7
|
+
data.tar.gz: c4595fc9ac25047a3c2c38a2d6bd9402fb7f375bca44253c025894aacfc16d39153b0b4d42af8697080faac4c496888674a1a1fd5e707f031dd82fbde58caf14
|
data/.env.example
CHANGED
|
@@ -18,8 +18,45 @@ RATE_LIMIT_ENABLED=true
|
|
|
18
18
|
RATE_LIMIT_MAX_REQUESTS=100
|
|
19
19
|
RATE_LIMIT_WINDOW=60
|
|
20
20
|
|
|
21
|
+
# =============================================================================
|
|
22
|
+
# API KEY AUTHENTICATION (HTTP Transport only)
|
|
23
|
+
# Protects /mcp endpoint with Bearer token authentication
|
|
24
|
+
# Generate a key with: rake generate_api_key
|
|
25
|
+
# =============================================================================
|
|
26
|
+
|
|
27
|
+
# Enable/disable API key authentication (default: false)
|
|
28
|
+
API_KEY_ENABLED=false
|
|
29
|
+
|
|
30
|
+
# Single API key
|
|
31
|
+
# API_KEY=your_secret_api_key_here
|
|
32
|
+
|
|
33
|
+
# Multiple API keys (comma-separated) - useful for key rotation or multiple clients
|
|
34
|
+
# API_KEYS=key1,key2,key3
|
|
35
|
+
|
|
36
|
+
# Note: /health and / endpoints remain accessible without authentication
|
|
37
|
+
# Clients must include header: Authorization: Bearer <api_key>
|
|
38
|
+
|
|
21
39
|
# Logging
|
|
40
|
+
# Levels: debug, info, warn, error (default: info)
|
|
22
41
|
LOG_LEVEL=info
|
|
42
|
+
# Destination: a file path, or "stderr". Never STDOUT (used by the stdio transport).
|
|
43
|
+
# Default: ./logs/ferrum_mcp.log under the current working directory.
|
|
44
|
+
# LOG_FILE=/var/log/ferrum-mcp/ferrum_mcp.log
|
|
45
|
+
|
|
46
|
+
# Reverse proxy (HTTP Transport only)
|
|
47
|
+
# Set to true ONLY when the server sits behind a trusted proxy (nginx, Traefik, ...),
|
|
48
|
+
# so X-Forwarded-For is used for rate limiting and audit logs.
|
|
49
|
+
TRUST_PROXY=false
|
|
50
|
+
|
|
51
|
+
# Navigation policy (optional, comma-separated). Entries: exact host, *.suffix, or CIDR.
|
|
52
|
+
# When ALLOWED_HOSTS is set only those hosts can be visited; BLOCKED_HOSTS always wins.
|
|
53
|
+
# Recommended for exposed HTTP deployments:
|
|
54
|
+
# BLOCKED_HOSTS=localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16,*.internal
|
|
55
|
+
# ALLOWED_HOSTS=*.example.com
|
|
56
|
+
|
|
57
|
+
# Directories the upload_file tool may read from (comma-separated).
|
|
58
|
+
# Default: current working directory and the system temp dir.
|
|
59
|
+
# UPLOAD_ALLOWED_DIRS=/data/uploads
|
|
23
60
|
|
|
24
61
|
# =============================================================================
|
|
25
62
|
# MULTI-BROWSER CONFIGURATION
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.0] - 2026-09-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Snapshot tool** (`snapshot`): compact, LLM-friendly list of interactive elements and headings with stable
|
|
14
|
+
refs (`e12`). Every element-based tool accepts `ref:e12` as a selector.
|
|
15
|
+
- **Waiting tools**: `wait_for_selector` (visible/hidden/attached/detached), `wait_for_text`,
|
|
16
|
+
`wait_for_network_idle`.
|
|
17
|
+
- **Page tools**: `scroll`, `select_option`, `upload_file`, `set_viewport`.
|
|
18
|
+
- **Tab tools**: `list_tabs`, `new_tab`, `switch_tab`, `close_tab`. Tools act on the session's current tab.
|
|
19
|
+
- XPath (`xpath:` prefix or `//`) accepted by every element-based tool, not only `click`/`get_text`.
|
|
20
|
+
- `LOG_FILE` (path or `stderr`) to choose the log destination.
|
|
21
|
+
- `TRUST_PROXY` to opt in to `X-Forwarded-For` for rate limiting and audit logs.
|
|
22
|
+
- `ALLOWED_HOSTS` / `BLOCKED_HOSTS` navigation policy (exact hosts, `*.suffix`, CIDR).
|
|
23
|
+
- `UPLOAD_ALLOWED_DIRS` restricting where `upload_file` may read from.
|
|
24
|
+
- `fill_form` field option `clear`, `get_html` option `max_length`, `get_text` option `wait`,
|
|
25
|
+
`navigate` options `wait_for_idle` / `timeout`, `set_cookie` option `expires`.
|
|
26
|
+
- `rake test:unit` (no Chrome) and `rake test:integration`.
|
|
27
|
+
- Unit specs for `BrowserManager`, `SessionManager` concurrency, the CLI runner, logging and the rate limiter.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- **Tool DSL**: tools declare `tool_name`, `description` and `param`s; the JSON schema is generated,
|
|
31
|
+
`session_id` is injected automatically and params reach `#perform` with symbol keys and defaults applied.
|
|
32
|
+
- `BrowserManager` detects a dead Chrome process and the session restarts it on the next call.
|
|
33
|
+
- Cookies are read through Ferrum's cookie accessors (structured `domain`, `path`, `expires`, flags).
|
|
34
|
+
- Screenshot resizing is optional: without libvips the image is returned untouched.
|
|
35
|
+
- `LOG_LEVEL` defaults to `info` everywhere (Configuration used to default to `debug`).
|
|
36
|
+
- Ruby: Gemfile requires `>= 3.2`, Docker images build on Ruby 3.3.
|
|
37
|
+
- `test/` debug scripts removed, `scripts/` moved to `examples/`.
|
|
38
|
+
- RuboCop metric exclusions narrowed to the two heuristic tools (`accept_cookies`, `solve_captcha`).
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Session `browser_options` never reached Ferrum (private method behind a `respond_to?` check) and keys
|
|
42
|
+
written with a leading `--` produced `----flag`. Keys are now normalized.
|
|
43
|
+
- `user_profile_id` was resolved but never mapped to `user-data-dir`.
|
|
44
|
+
- `StdioServer` duplicated the MCP transport read loop.
|
|
45
|
+
- Shutdown called the deprecated `stop_browser`, never stopped the cleanup thread and exited from
|
|
46
|
+
inside a signal trap. Signals now interrupt the main loop, which runs the shutdown sequence.
|
|
47
|
+
- Logs were written inside the installed gem directory.
|
|
48
|
+
- The CLI required `bundler/setup`, breaking `gem install ferrum-mcp && ferrum-mcp start`.
|
|
49
|
+
- `close_session` stopped Chrome while holding the global lock, blocking every other session; a closed
|
|
50
|
+
session could be resurrected by a concurrent call.
|
|
51
|
+
- Rate limiter trusted `X-Forwarded-For` unconditionally (trivially bypassable).
|
|
52
|
+
- `drag_and_drop` reported wrong coordinates for elements found through XPath.
|
|
53
|
+
- `get_text` returned text with surrounding newlines and indentation (now collapsed, `raw: true` to opt out).
|
|
54
|
+
- BotBrowser Docker image failed to build: the pinned upstream package had been removed (404). The latest
|
|
55
|
+
release is now resolved at build time (`BOTBROWSER_VERSION` build arg to pin one).
|
|
56
|
+
- `snapshot` listed unlabeled radio buttons of one group with the same name; their `value` is now shown.
|
|
57
|
+
|
|
58
|
+
### Removed
|
|
59
|
+
- Deprecated `Server#start_browser` / `Server#stop_browser`.
|
|
60
|
+
- `wait_for_selector` / `wait_for_text` were listed in the 1.0.0 notes before they existed; they now do.
|
|
61
|
+
|
|
62
|
+
### CI
|
|
63
|
+
- Docker images (standard and BotBrowser) are built on every pull request, and the standard image is
|
|
64
|
+
smoke-tested over HTTP and stdio with a real browser session.
|
|
65
|
+
- The release workflow fails when the release tag does not match `FerrumMCP::VERSION`.
|
|
66
|
+
|
|
67
|
+
### Upgrade notes
|
|
68
|
+
- Custom tools must implement `#perform(params)` (params arrive with symbol keys) and declare their interface
|
|
69
|
+
with `tool_name` / `description` / `param` instead of overriding `.input_schema`.
|
|
70
|
+
- `browser_options` keys are written without leading dashes (`"window-size"`); dashed keys are still accepted.
|
|
71
|
+
- `get_text` now collapses whitespace; pass `raw: true` for the previous behaviour.
|
|
72
|
+
|
|
73
|
+
## [1.0.0] - 2025-11-22
|
|
74
|
+
|
|
75
|
+
|
|
10
76
|
### Added
|
|
11
77
|
- Comprehensive documentation structure in `docs/` directory
|
|
12
78
|
- API reference with all 27+ tools documented
|
|
@@ -56,6 +122,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
56
122
|
- Added session limit recommendations
|
|
57
123
|
- Implemented XSS and XPath injection protections in multiple tools
|
|
58
124
|
|
|
125
|
+
|
|
59
126
|
## [0.1.0] - 2024-11-22
|
|
60
127
|
|
|
61
128
|
Initial release of FerrumMCP - Browser automation server implementing the Model Context Protocol.
|
|
@@ -222,8 +289,12 @@ This is the initial release, but note for future versions:
|
|
|
222
289
|
|
|
223
290
|
## Release Links
|
|
224
291
|
|
|
292
|
+
- [1.1.0] - Hardening, tool DSL, snapshot/waiting/tab tools (2026-09-28)
|
|
293
|
+
- [1.0.0] - Multi-session, BotBrowser, docs, gem publishing (2025-11-22)
|
|
225
294
|
- [0.1.0] - Initial release (2024-11-22)
|
|
226
295
|
- [Unreleased] - Current development
|
|
227
296
|
|
|
228
|
-
[Unreleased]: https://github.com/Eth3rnit3/FerrumMCP/compare/
|
|
297
|
+
[Unreleased]: https://github.com/Eth3rnit3/FerrumMCP/compare/v1.1.0...HEAD
|
|
298
|
+
[1.1.0]: https://github.com/Eth3rnit3/FerrumMCP/compare/v1.0.0...v1.1.0
|
|
299
|
+
[1.0.0]: https://github.com/Eth3rnit3/FerrumMCP/compare/v0.1.0...v1.0.0
|
|
229
300
|
[0.1.0]: https://github.com/Eth3rnit3/FerrumMCP/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# FerrumMCP 🌐
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Eth3rnit3/FerrumMCP/actions/workflows/ci.yml)
|
|
4
|
-
[](https://github.com/Eth3rnit3/FerrumMCP/actions/workflows/release.yml)
|
|
5
|
+
[](https://rubygems.org/gems/ferrum-mcp)
|
|
6
|
+
[](https://rubygems.org/gems/ferrum-mcp)
|
|
5
7
|
[](https://github.com/Eth3rnit3/FerrumMCP/actions/workflows/docker-publish.yml)
|
|
8
|
+
[](https://hub.docker.com/r/eth3rnit3/ferrum-mcp)
|
|
6
9
|
[](https://www.ruby-lang.org)
|
|
7
10
|
[](LICENSE)
|
|
8
|
-
[](https://hub.docker.com/r/eth3rnit3/ferrum-mcp)
|
|
9
11
|
|
|
10
12
|
> A browser automation server for the Model Context Protocol (MCP), enabling AI assistants to interact with web pages through a standardized interface.
|
|
11
13
|
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
|---------------|-------------|
|
|
18
20
|
| [**Getting Started**](docs/GETTING_STARTED.md) | Installation, setup, and first steps |
|
|
19
21
|
| [**Docker Deployment**](docs/DOCKER.md) | Complete Docker guide with Claude Desktop integration |
|
|
20
|
-
| [**API Reference**](docs/API_REFERENCE.md) | Complete documentation of all
|
|
22
|
+
| [**API Reference**](docs/API_REFERENCE.md) | Complete documentation of all 40 tools |
|
|
21
23
|
| [**Configuration**](docs/CONFIGURATION.md) | Environment variables and advanced configuration |
|
|
22
24
|
| [**Troubleshooting**](docs/TROUBLESHOOTING.md) | Common issues and solutions |
|
|
23
25
|
| [**Deployment**](docs/DEPLOYMENT.md) | Production deployment guide |
|
|
@@ -65,6 +67,12 @@ FerrumMCP is a **browser automation server** that implements the **Model Context
|
|
|
65
67
|
- URL navigation with network idle detection
|
|
66
68
|
- Browser history (back/forward)
|
|
67
69
|
- Page refresh
|
|
70
|
+
- Tabs (open, list, switch, close) and viewport control
|
|
71
|
+
- Optional host allow/block lists
|
|
72
|
+
|
|
73
|
+
✅ **Agent-friendly page snapshot**
|
|
74
|
+
- `snapshot` lists interactive elements with stable refs (`ref:e12`) usable by every other tool
|
|
75
|
+
- Explicit waits: `wait_for_selector`, `wait_for_text`, `wait_for_network_idle`
|
|
68
76
|
|
|
69
77
|
✅ **Interaction**
|
|
70
78
|
- Click, hover, drag-and-drop
|
|
@@ -186,7 +194,7 @@ ruby bin/ferrum-mcp
|
|
|
186
194
|
|
|
187
195
|
## Tools & Capabilities
|
|
188
196
|
|
|
189
|
-
FerrumMCP provides **
|
|
197
|
+
FerrumMCP provides **40 browser automation tools** organized into 8 categories:
|
|
190
198
|
|
|
191
199
|
### 1. Session Management (4 tools)
|
|
192
200
|
- `create_session` - Create browser sessions with custom config
|
|
@@ -200,16 +208,20 @@ FerrumMCP provides **27+ browser automation tools** organized into 6 categories:
|
|
|
200
208
|
- `go_forward` - Browser forward button
|
|
201
209
|
- `refresh` - Reload current page
|
|
202
210
|
|
|
203
|
-
### 3. Interaction (
|
|
204
|
-
- `click` - Click elements
|
|
211
|
+
### 3. Interaction (10 tools)
|
|
212
|
+
- `click` - Click elements (CSS, XPath or snapshot ref)
|
|
205
213
|
- `fill_form` - Fill form fields
|
|
206
214
|
- `press_key` - Keyboard input
|
|
207
215
|
- `hover` - Mouse hover
|
|
208
216
|
- `drag_and_drop` - Drag elements
|
|
217
|
+
- `scroll` - Scroll the page, a container, or an element into view
|
|
218
|
+
- `select_option` - Pick options in `<select>` elements
|
|
219
|
+
- `upload_file` - Attach files to file inputs
|
|
209
220
|
- `accept_cookies` - **Smart cookie banner detection** (8 strategies)
|
|
210
221
|
- `solve_captcha` - **AI-powered CAPTCHA solving** (⚠️ experimental, under development)
|
|
211
222
|
|
|
212
|
-
### 4. Extraction (
|
|
223
|
+
### 4. Extraction (7 tools)
|
|
224
|
+
- `snapshot` - **Compact page snapshot with stable element refs**
|
|
213
225
|
- `get_text` - Extract text content
|
|
214
226
|
- `get_html` - Get HTML content
|
|
215
227
|
- `screenshot` - Capture screenshots
|
|
@@ -217,7 +229,16 @@ FerrumMCP provides **27+ browser automation tools** organized into 6 categories:
|
|
|
217
229
|
- `get_url` - Get current URL
|
|
218
230
|
- `find_by_text` - XPath text search
|
|
219
231
|
|
|
220
|
-
### 5.
|
|
232
|
+
### 5. Waiting (3 tools)
|
|
233
|
+
- `wait_for_selector` - Wait for an element to be visible/hidden/attached/detached
|
|
234
|
+
- `wait_for_text` - Wait for text to appear
|
|
235
|
+
- `wait_for_network_idle` - Wait for pending requests to finish
|
|
236
|
+
|
|
237
|
+
### 6. Tabs & Viewport (5 tools)
|
|
238
|
+
- `list_tabs`, `new_tab`, `switch_tab`, `close_tab` - Tab management
|
|
239
|
+
- `set_viewport` - Viewport size and mobile emulation
|
|
240
|
+
|
|
241
|
+
### 7. Advanced (7 tools)
|
|
221
242
|
- `execute_script` - Run JavaScript
|
|
222
243
|
- `evaluate_js` - Evaluate JavaScript with return value
|
|
223
244
|
- `get_cookies` - Get browser cookies
|
|
@@ -226,7 +247,7 @@ FerrumMCP provides **27+ browser automation tools** organized into 6 categories:
|
|
|
226
247
|
- `get_attribute` - Get element attributes
|
|
227
248
|
- `query_shadow_dom` - Interact with Shadow DOM
|
|
228
249
|
|
|
229
|
-
###
|
|
250
|
+
### 8. MCP Resources (7 resources)
|
|
230
251
|
- `ferrum://browsers` - Discover configured browsers
|
|
231
252
|
- `ferrum://user-profiles` - Discover Chrome profiles
|
|
232
253
|
- `ferrum://bot-profiles` - Discover BotBrowser profiles
|