firefox-devtools-mcp 0.2.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.
- package/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/index.js +15826 -0
- package/dist/snapshot.injected.global.js +1 -0
- package/package.json +102 -0
- package/scripts/_helpers/page-loader.js +121 -0
- package/scripts/demo-server.js +325 -0
- package/scripts/setup-mcp-config.js +260 -0
- package/scripts/test-bidi-devtools.js +380 -0
- package/scripts/test-console.js +148 -0
- package/scripts/test-dialog.js +102 -0
- package/scripts/test-input-tools.js +233 -0
- package/scripts/test-lifecycle-hooks.js +124 -0
- package/scripts/test-screenshot.js +190 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tomáš Grasl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Firefox DevTools MCP
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/firefox-devtools-mcp)
|
|
4
|
+
[](https://github.com/freema/firefox-devtools-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://codecov.io/gh/freema/firefox-devtools-mcp)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Model Context Protocol server for automating Firefox via WebDriver BiDi (through Selenium WebDriver). Works with Claude Code, Claude Desktop, Cursor, Cline and other MCP clients.
|
|
9
|
+
|
|
10
|
+
Repository: https://github.com/freema/firefox-devtools-mcp
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Node.js ≥ 20.19.0
|
|
15
|
+
- Firefox 100+ installed (auto‑detected, or pass `--firefox-path`)
|
|
16
|
+
|
|
17
|
+
## Install and use with Claude Code (npx)
|
|
18
|
+
|
|
19
|
+
Recommended: use npx so you always run the latest published version from npm.
|
|
20
|
+
|
|
21
|
+
Option A — Claude Code CLI
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
claude mcp add firefox-devtools npx firefox-devtools-mcp@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Pass options either as args or env vars. Examples:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Headless + viewport via args
|
|
31
|
+
claude mcp add firefox-devtools npx firefox-devtools-mcp@latest -- --headless --viewport 1280x720
|
|
32
|
+
|
|
33
|
+
# Or via environment variables
|
|
34
|
+
claude mcp add firefox-devtools npx firefox-devtools-mcp@latest \
|
|
35
|
+
--env START_URL=https://example.com \
|
|
36
|
+
--env FIREFOX_HEADLESS=true
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Option B — Edit Claude Code settings JSON
|
|
40
|
+
|
|
41
|
+
Add to your Claude Code config file:
|
|
42
|
+
- macOS: `~/Library/Application Support/Claude/Code/mcp_settings.json`
|
|
43
|
+
- Linux: `~/.config/claude/code/mcp_settings.json`
|
|
44
|
+
- Windows: `%APPDATA%\Claude\Code\mcp_settings.json`
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcpServers": {
|
|
49
|
+
"firefox-devtools": {
|
|
50
|
+
"command": "npx",
|
|
51
|
+
"args": ["-y", "firefox-devtools-mcp@latest", "--headless", "--viewport", "1280x720"],
|
|
52
|
+
"env": {
|
|
53
|
+
"START_URL": "about:home"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Option C — Helper script (local dev build)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm run setup
|
|
64
|
+
# Choose Claude Code; the script saves JSON to the right path
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Try it with MCP Inspector
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @modelcontextprotocol/inspector npx firefox-devtools-mcp@latest --start-url https://example.com --headless
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then call tools like:
|
|
74
|
+
- `list_pages`, `select_page`, `navigate_page`
|
|
75
|
+
- `take_snapshot` then `click_by_uid` / `fill_by_uid`
|
|
76
|
+
- `list_network_requests` (always‑on capture), `get_network_request`
|
|
77
|
+
- `screenshot_page`, `list_console_messages`
|
|
78
|
+
|
|
79
|
+
## CLI options
|
|
80
|
+
|
|
81
|
+
You can pass flags or environment variables (names on the right):
|
|
82
|
+
|
|
83
|
+
- `--firefox-path` — absolute path to Firefox binary
|
|
84
|
+
- `--headless` — run without UI (`FIREFOX_HEADLESS=true`)
|
|
85
|
+
- `--viewport 1280x720` — initial window size
|
|
86
|
+
- `--profile-path` — use a specific Firefox profile
|
|
87
|
+
- `--firefox-arg` — extra Firefox arguments (repeatable)
|
|
88
|
+
- `--start-url` — open this URL on start (`START_URL`)
|
|
89
|
+
- `--accept-insecure-certs` — ignore TLS errors (`ACCEPT_INSECURE_CERTS=true`)
|
|
90
|
+
|
|
91
|
+
## Tool overview
|
|
92
|
+
|
|
93
|
+
- Pages: list/new/navigate/select/close
|
|
94
|
+
- Snapshot/UID: take/resolve/clear
|
|
95
|
+
- Input: click/hover/fill/drag/upload/form fill
|
|
96
|
+
- Network: list/get (ID‑first, filters, always‑on capture)
|
|
97
|
+
- Console: list/clear
|
|
98
|
+
- Screenshot: page/by uid
|
|
99
|
+
- Utilities: accept/dismiss dialog, history back/forward, set viewport
|
|
100
|
+
|
|
101
|
+
## Local development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install
|
|
105
|
+
npm run build
|
|
106
|
+
|
|
107
|
+
# Run with Inspector against local build
|
|
108
|
+
npx @modelcontextprotocol/inspector node dist/index.js --headless --viewport 1280x720
|
|
109
|
+
|
|
110
|
+
# Or run in dev with hot reload
|
|
111
|
+
npm run inspector:dev
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Troubleshooting
|
|
115
|
+
|
|
116
|
+
- Firefox not found: pass `--firefox-path "/Applications/Firefox.app/Contents/MacOS/firefox"` (macOS) or the correct path on your OS.
|
|
117
|
+
- First run is slow: Selenium sets up the BiDi session; subsequent runs are faster.
|
|
118
|
+
- Stale UIDs after navigation: take a fresh snapshot (`take_snapshot`) before using UID tools.
|
|
119
|
+
|
|
120
|
+
## Versioning
|
|
121
|
+
|
|
122
|
+
- Pre‑1.0 API: versions start at `0.x`. Use `@latest` with npx for the newest release.
|
|
123
|
+
|
|
124
|
+
## CI and Release
|
|
125
|
+
|
|
126
|
+
- GitHub Actions for CI, Release, and npm publish are included. See docs/ci-and-release.md for details and required secrets.
|