@mozilla/firefox-devtools-mcp-moz 0.9.12 → 0.9.15
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/README.md +76 -17
- package/dist.moz/index.js +13039 -25126
- package/package.json +1 -1
- package/plugins/firefox-devtools-mcp/.claude-plugin/plugin.json +2 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Browser MCP servers carry inherent risks. A few key practices:
|
|
|
19
19
|
|
|
20
20
|
- **Use a dedicated Firefox profile.** Never run the server against your regular profile — the agent has access to whatever the browser can reach, including cookies and saved sessions.
|
|
21
21
|
- **Be cautious about which sites you visit.** Pages can return content designed to manipulate the agent (prompt injection). Stick to sites you control or trust.
|
|
22
|
-
- **
|
|
22
|
+
- **Enable only the tool modules you need.** Higher presets such as `--tool-preset developer` (script, debugging) and `--tool-preset mozilla` (privileged context) significantly expand what the agent can do.
|
|
23
23
|
|
|
24
24
|
See [SECURITY.md](SECURITY.md) for a full breakdown of risks and how to report vulnerabilities.
|
|
25
25
|
|
|
@@ -90,6 +90,7 @@ Then call tools like:
|
|
|
90
90
|
- `list_pages`, `select_page`, `navigate_page`
|
|
91
91
|
- `take_snapshot` then `click_by_uid` / `fill_by_uid`
|
|
92
92
|
- `list_network_requests` (always‑on capture), `get_network_request`
|
|
93
|
+
- `list_downloads` (always‑on capture), `set_download_behavior`
|
|
93
94
|
- `screenshot_page`, `list_console_messages`
|
|
94
95
|
|
|
95
96
|
## CLI options
|
|
@@ -106,13 +107,44 @@ You can pass flags or environment variables (names on the right):
|
|
|
106
107
|
- `--connect-existing` — attach to an already-running Firefox instead of launching a new one (`CONNECT_EXISTING=true`)
|
|
107
108
|
- `--marionette-port` — Marionette port for connect-existing mode, default 2828 (`MARIONETTE_PORT`)
|
|
108
109
|
- `--pref name=value` — set Firefox preference at startup via `moz:firefoxOptions` (repeatable)
|
|
109
|
-
- `--
|
|
110
|
-
- `--
|
|
110
|
+
- `--tool-preset` — select which tool modules to enable: `slim`, `basic` (default), `developer`, `mozilla`, or `all`. See [Tool modules and presets](#tool-modules-and-presets). (`TOOL_PRESET`)
|
|
111
|
+
- `--tools` — explicit list of tool modules to enable, overriding `--tool-preset` entirely (e.g. `--tools pages network script`). See [Tool modules and presets](#tool-modules-and-presets).
|
|
112
|
+
- `--enable-script` — _deprecated, use `--tool-preset developer` or `--tools ... script debugging`._ Selects the `developer` tool preset. (`ENABLE_SCRIPT=true`)
|
|
113
|
+
- `--enable-privileged-context` — _deprecated, use `--tool-preset mozilla` or `--tools ... privileged prefs`._ Selects the `mozilla` tool preset. Requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` (`ENABLE_PRIVILEGED_CONTEXT=true`)
|
|
111
114
|
- `--android-device` — enable Firefox for Android mode; value is the ADB device serial (e.g. `emulator-5554`). Run `adb devices` to list connected devices. Omit the value or use `auto` to select the single connected device automatically.
|
|
112
115
|
- `--android-package` — Android app package name, default `org.mozilla.firefox`. Other packages: `org.mozilla.firefox_beta` for Firefox Beta, `org.mozilla.fenix` for Firefox Nightly, `org.mozilla.fenix.debug` for Firefox Nightly Debug, `org.mozilla.geckoview_example` for geckoview (`ANDROID_PACKAGE`)
|
|
113
116
|
- `--log-file` — write MCP server logs to a file instead of stderr. Useful for debugging sessions with MCP clients that hide server output. Set `DEBUG=*` to also include verbose debug logs. Example: `--log-file /tmp/firefox-mcp.log`
|
|
114
117
|
|
|
115
118
|
|
|
119
|
+
### Tool modules and presets
|
|
120
|
+
|
|
121
|
+
Tools are grouped into modules. You choose which modules to expose either with a named preset
|
|
122
|
+
(`--tool-preset`) or with an explicit list (`--tools`). When both are given, `--tools` wins and
|
|
123
|
+
the preset is ignored.
|
|
124
|
+
|
|
125
|
+
Modules: `pages`, `snapshot`, `input`, `network`, `console`, `screenshot`, `utilities`,
|
|
126
|
+
`management`, `webextension`, `profiler`, `screencast`, `script`, `debugging`, `prefs`,
|
|
127
|
+
`privileged`.
|
|
128
|
+
|
|
129
|
+
Presets (each is a superset of the previous):
|
|
130
|
+
|
|
131
|
+
- `slim` — `pages`, `snapshot`, `input`, `network`, `console`
|
|
132
|
+
- `basic` (default) — `slim` plus `screenshot`, `utilities`, `management`, `webextension`, `profiler`, `screencast`
|
|
133
|
+
- `developer` — `basic` plus `script`, `debugging`
|
|
134
|
+
- `mozilla` — `developer` plus `prefs`, `privileged`
|
|
135
|
+
- `all` — every module
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Use the developer preset (adds script and debugging tools)
|
|
139
|
+
npx @mozilla/firefox-devtools-mcp --tool-preset developer
|
|
140
|
+
|
|
141
|
+
# Enable only the modules you need
|
|
142
|
+
npx @mozilla/firefox-devtools-mcp --tools pages network console
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The `prefs` and `privileged` modules require `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` and are only
|
|
146
|
+
available in the Mozilla-internal build; the public package silently skips them even if requested.
|
|
147
|
+
|
|
116
148
|
### Useful preferences (`--pref`)
|
|
117
149
|
|
|
118
150
|
- remote.prefs.recommended=false. When Firefox runs in automation, it applies [RecommendedPreferences](https://searchfox.org/firefox-main/source/remote/shared/RecommendedPreferences.sys.mjs) that modify browser behavior for testing. Set remote.prefs.recommended to false to skip those and have a configuration closer to a regular Firefox instance.
|
|
@@ -141,19 +173,17 @@ Port forwarding between the host and device is handled automatically by geckodri
|
|
|
141
173
|
|
|
142
174
|
### Connect to existing Firefox
|
|
143
175
|
|
|
144
|
-
Use `--connect-existing` to automate your real browsing session
|
|
176
|
+
Use `--connect-existing` to automate your real browsing session, with cookies, logins, and open tabs intact:
|
|
145
177
|
|
|
146
178
|
```bash
|
|
147
|
-
# Start Firefox with Marionette
|
|
148
|
-
firefox --marionette
|
|
179
|
+
# Start Firefox with Marionette and the Remote Agent (BiDi)
|
|
180
|
+
firefox --marionette --remote-debugging-port
|
|
149
181
|
|
|
150
182
|
# Run the MCP server
|
|
151
183
|
npx @mozilla/firefox-devtools-mcp --connect-existing --marionette-port 2828
|
|
152
184
|
```
|
|
153
185
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
BiDi-dependent features (console events, network events) are not available in connect-existing mode; all other features work normally.
|
|
186
|
+
Both flags are required because the MCP uses both WebDriver Classic (`--marionette`) and WebDriver BiDi (`--remote-debugging-port`). If Firefox is only started with `--marionette`, the MCP server fails to connect and asks you to restart Firefox with both flags.
|
|
157
187
|
|
|
158
188
|
> **Warning:** Do not leave Marionette enabled during normal browsing. It sets
|
|
159
189
|
> `navigator.webdriver = true` and changes other browser fingerprint signals,
|
|
@@ -164,29 +194,58 @@ BiDi-dependent features (console events, network events) are not available in co
|
|
|
164
194
|
## Tool overview
|
|
165
195
|
|
|
166
196
|
- Pages: list/new/navigate/select/close
|
|
167
|
-
- Snapshot/UID: take/resolve/clear
|
|
197
|
+
- Snapshot/UID: take/resolve/clear (take supports optional `saveTo`)
|
|
168
198
|
- Input: click/hover/fill/drag/upload/form fill
|
|
199
|
+
<<<<<<< HEAD
|
|
200
|
+
- Network: list/get (ID‑first, filters, always‑on capture; both support optional `saveTo`)
|
|
201
|
+
- Console: list/clear (list supports optional `saveTo`)
|
|
202
|
+
=======
|
|
169
203
|
- Network: list/get (ID‑first, filters, always‑on capture)
|
|
204
|
+
- Downloads: list_downloads/clear_downloads (always‑on capture), set_download_behavior (allow/deny/default)
|
|
170
205
|
- Console: list/clear
|
|
206
|
+
>>>>>>> 6873767 (Bug 2055949 - [firefox-devtools-mcp] expose download events to firefox devtools mcp)
|
|
171
207
|
- Screenshot: page/by uid (with optional `saveTo` for CLI environments)
|
|
172
|
-
- Script: evaluate_script
|
|
208
|
+
- Script: evaluate_script (with optional `saveTo` for bulky results)
|
|
173
209
|
- Privileged Context: list/select privileged ("chrome") contexts, evaluate_privileged_script (requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`)
|
|
174
210
|
- WebExtension: install_extension, uninstall_extension, list_extensions (list requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`)
|
|
175
211
|
- Firefox Management: get_firefox_info, get_firefox_output, restart_firefox, set_firefox_prefs, get_firefox_prefs
|
|
176
212
|
- Profiler: profiler_is_active, profiler_start (preset or explicit config), profiler_stop (saves profile to downloads directory)
|
|
213
|
+
- Screencast: screencast_start (records the page viewport to a video file in the downloads directory), screencast_stop (requires Firefox 154+)
|
|
177
214
|
- Utilities: accept/dismiss dialog, history back/forward, set viewport
|
|
178
215
|
|
|
179
|
-
###
|
|
216
|
+
### Saving bulky output to disk
|
|
217
|
+
|
|
218
|
+
Large tool output can consume significant context in CLI clients like Claude Code. The
|
|
219
|
+
`screenshot_page`, `screenshot_by_uid`, `take_snapshot`, `list_console_messages`,
|
|
220
|
+
`list_network_requests`, `get_network_request`, `evaluate_script`, and
|
|
221
|
+
`evaluate_privileged_script` tools accept an optional `saveTo` parameter that writes the
|
|
222
|
+
result to a file instead of returning it inline. `saveTo` takes one of three forms:
|
|
180
223
|
|
|
181
|
-
|
|
182
|
-
|
|
224
|
+
- a file path (relative to the current working directory, or absolute within `~/.firefox-devtools-mcp`; parent directories are created)
|
|
225
|
+
- an existing directory (a timestamped file is generated inside it)
|
|
226
|
+
- `true` (a timestamped file is generated under `~/.firefox-devtools-mcp/output/`)
|
|
227
|
+
|
|
228
|
+
The response returns the path and byte size. The saved file always holds the full,
|
|
229
|
+
untruncated data: the inline size safeguards (console message caps, network header
|
|
230
|
+
truncation, snapshot line caps) never apply to it.
|
|
231
|
+
|
|
232
|
+
The text-producing tools (everything except the screenshots) also accept `preview`, a number
|
|
233
|
+
of characters of the saved output to echo back inline as a short excerpt. Screenshots have no
|
|
234
|
+
preview.
|
|
183
235
|
|
|
184
236
|
```
|
|
185
|
-
screenshot_page({ saveTo: "
|
|
186
|
-
|
|
237
|
+
screenshot_page({ saveTo: "page.png" })
|
|
238
|
+
take_snapshot({ saveTo: true })
|
|
239
|
+
list_network_requests({ urlContains: "api", saveTo: "network.json" })
|
|
240
|
+
evaluate_script({ function: "() => performance.getEntries()", saveTo: true, preview: 2000 })
|
|
187
241
|
```
|
|
188
242
|
|
|
189
|
-
|
|
243
|
+
By default, save paths are restricted: relative paths resolve against the current working
|
|
244
|
+
directory, and absolute paths are only allowed within `~/.firefox-devtools-mcp`. Paths that
|
|
245
|
+
escape these locations are rejected. Start the server with `--unrestricted-save-paths` to
|
|
246
|
+
write to arbitrary locations, including absolute paths outside that directory.
|
|
247
|
+
|
|
248
|
+
Saved files can then be viewed with Claude Code's `Read` tool without impacting context size.
|
|
190
249
|
|
|
191
250
|
## Local development
|
|
192
251
|
|