Skip to content
Back to search

firefox-devtools-mcp

Model Context Protocol server for Firefox DevTools - enables AI assistants to inspect and control Firefox browser through WebDriver BiDi

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/mozilla--firefox-devtools-mcp/badge.svg)](/listings/mozilla--firefox-devtools-mcp)

HTML

<a href="/listings/mozilla--firefox-devtools-mcp"><img src="/api/listings/mozilla--firefox-devtools-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Recommended: use `npx` so you run the latest published version from npm.

Option A — CLI

Claude Code

claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest

# Headless + viewport via args
claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest -- --headless --viewport 1280x720

# Or via environment variables
claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest \
  --env START_URL=https://example.com \
  --env FIREFOX_HEADLESS=true

Codex

codex mcp add firefox-devtools -- npx @mozilla/firefox-devtools-mcp@latest

# Headless + viewport via args
codex mcp add firefox-devtools -- \
  npx @mozilla/firefox-devtools-mcp@latest -- --headless --viewport 1280x720

# Or via environment variables
codex mcp add firefox-devtools \
  --env START_URL=https://example.com \
  --env FIREFOX_HEADLESS=true \
  -- npx @mozilla/firefox-devtools-mcp@latest

Option B — Edit the configuration file

Claude Code

Add to Claude Code’s mcp_settings.json:

{
  "mcpServers": {
    "firefox-devtools": {
      "command": "npx",
      "args": ["-y", "@mozilla/firefox-devtools-mcp@latest", "--headless", "--viewport", "1280x720"],
      "env": {
        "START_URL": "about:blank"
      }
    }
  }
}

Codex

Add to ~/.codex/config.toml:

[mcp_servers.firefox-devtools]
command = "npx"
args = ["-y", "@mozilla/firefox-devtools-mcp@latest", "--headless", "--viewport", "1280x720"]

[mcp_servers.firefox-devtools.env]
START_URL = "about:blank"

Option C — Helper script (local dev build)

npm run setup
# Choose Claude Code; the script saves JSON to the right path

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 30 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "firefox-devtools-plugins",
  3. "owner": {
  4. "name": "Mozilla"
  5. },
  6. "plugins": [
  7. {
  8. "name": "firefox-devtools-mcp",
  9. "source": "./plugins/firefox-devtools-mcp/",
  10. "description": "Control Firefox for browsing, web testing, and debugging. Fill forms, capture network and console activity, take screenshots, run scripts, and profile performance. Supports Android devices.",
  11. "homepage": "https://github.com/mozilla/firefox-devtools-mcp",
  12. "repository": "https://github.com/mozilla/firefox-devtools-mcp",
  13. "license": "MIT OR Apache-2.0",
  14. "author": {
  15. "name": "Mozilla"
  16. }
  17. },
  18. {
  19. "name": "firefox-devtools-troubleshoot",
  20. "source": "./plugins/firefox-devtools-troubleshoot/",
  21. "description": "Diagnose and fix Firefox DevTools MCP setup issues. Use this if the firefox-devtools-mcp plugin is not working.",
  22. "homepage": "https://github.com/mozilla/firefox-devtools-mcp",
  23. "repository": "https://github.com/mozilla/firefox-devtools-mcp",
  24. "license": "MIT OR Apache-2.0",
  25. "author": {
  26. "name": "Mozilla"
  27. }
  28. }
  29. ]
  30. }
README.md · README · 351 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Firefox DevTools MCP
  2. [![npm version](https://badge.fury.io/js/@mozilla%2Ffirefox-devtools-mcp.svg)](https://www.npmjs.com/package/@mozilla/firefox-devtools-mcp)
  3. [![CI](https://github.com/mozilla/firefox-devtools-mcp/workflows/CI/badge.svg)](https://github.com/mozilla/firefox-devtools-mcp/actions/workflows/ci.yml)
  4. [![codecov](https://codecov.io/gh/mozilla/firefox-devtools-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/mozilla/firefox-devtools-mcp)
  5. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE-MIT) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE-APACHE)
  6. <a href="https://glama.ai/mcp/servers/@mozilla/firefox-devtools-mcp"><img src="https://glama.ai/mcp/servers/@mozilla/firefox-devtools-mcp/badge" height="223" alt="Glama"></a>
  7. Model Context Protocol server that lets AI agents use Firefox. It has two main use cases:
  8. - **Agentic browsing**: the agent uses the browser for regular tasks, such as reading pages, filling forms and going through multi-step flows on websites.
  9. - **Agent-assisted web development**: the agent loads the page you are working on and inspects it with developer tools, such as the console, network requests, the debugger and the profiler.
  10. It controls Firefox through WebDriver BiDi (via Selenium WebDriver) and works with Claude Code, Claude Desktop, Cursor, Cline and other MCP clients.
  11. Repository: https://github.com/mozilla/firefox-devtools-mcp
  12. > **Note**: This MCP server requires a local Firefox browser installation and cannot run on cloud hosting services like glama.ai. Use `npx @mozilla/firefox-devtools-mcp@latest` to run locally, or use Docker with the provided Dockerfile.
  13. ## Security
  14. Browser MCP servers carry inherent risks. A few key practices:
  15. - **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.
  16. - **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.
  17. - **Enable only the tool modules you need.** The default `basic` preset already includes `evaluate_script`; `--tool-preset slim` drops it. Higher presets such as `--tool-preset developer` (debugging, network, console, profiler) and `--tool-preset mozilla` (privileged context) expand what the agent can do further.
  18. See [SECURITY.md](SECURITY.md) for a full breakdown of risks and how to report vulnerabilities.
  19. ## Requirements
  20. - Node.js ≥ 20.19.0
  21. - Firefox 100+ installed (auto‑detected, or pass `--firefox-path`)
  22. ## Install and use with Claude Code or Codex (npx)
  23. Recommended: use `npx` so you run the latest published version from npm.
  24. ### Option A — CLI
  25. #### Claude Code
  26. ```bash
  27. claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest
  28. # Headless + viewport via args
  29. claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest -- --headless --viewport 1280x720
  30. # Or via environment variables
  31. claude mcp add firefox-devtools npx @mozilla/firefox-devtools-mcp@latest \
  32. --env START_URL=https://example.com \
  33. --env FIREFOX_HEADLESS=true
  34. ```
  35. #### Codex
  36. ```bash
  37. codex mcp add firefox-devtools -- npx @mozilla/firefox-devtools-mcp@latest
  38. # Headless + viewport via args
  39. codex mcp add firefox-devtools -- \
  40. npx @mozilla/firefox-devtools-mcp@latest -- --headless --viewport 1280x720
  41. # Or via environment variables
  42. codex mcp add firefox-devtools \
  43. --env START_URL=https://example.com \
  44. --env FIREFOX_HEADLESS=true \
  45. -- npx @mozilla/firefox-devtools-mcp@latest
  46. ```
  47. ### Option B — Edit the configuration file
  48. #### Claude Code
  49. Add to Claude Code’s mcp_settings.json:
  50. ```json
  51. {
  52. "mcpServers": {
  53. "firefox-devtools": {
  54. "command": "npx",
  55. "args": ["-y", "@mozilla/firefox-devtools-mcp@latest", "--headless", "--viewport", "1280x720"],
  56. "env": {
  57. "START_URL": "about:blank"
  58. }
  59. }
  60. }
  61. }
  62. ```
  63. #### Codex
  64. Add to ~/.codex/config.toml:
  65. ```toml
  66. [mcp_servers.firefox-devtools]
  67. command = "npx"
  68. args = ["-y", "@mozilla/firefox-devtools-mcp@latest", "--headless", "--viewport", "1280x720"]
  69. [mcp_servers.firefox-devtools.env]
  70. START_URL = "about:blank"
  71. ```
  72. ### Option C — Helper script (local dev build)
  73. ```bash
  74. npm run setup
  75. # Choose Claude Code; the script saves JSON to the right path
  76. ```
  77. ## Try it with MCP Inspector
  78. ```bash
  79. npx @modelcontextprotocol/inspector npx @mozilla/firefox-devtools-mcp@latest --start-url https://example.com --headless
  80. ```
  81. Then call tools like:
  82. - `list_pages`, `select_page`, `navigate_page`
  83. - `take_snapshot` then `click_by_uid` / `fill_by_uid`
  84. - `list_network_requests` (always‑on capture), `get_network_request`
  85. - `list_downloads` (always‑on capture), `set_download_behavior`
  86. - `screenshot_page`, `list_console_messages`
  87. ## CLI options
  88. You can pass flags or environment variables (names on the right):
  89. - `--firefox-path` — absolute path to Firefox binary
  90. - `--headless` — run without UI (`FIREFOX_HEADLESS=true`)
  91. - `--viewport 1280x720` — initial window size
  92. - `--profile-path` — use a specific Firefox profile. Firefox runs in a `firefox_mcp_profile` subfolder of that path, marked with a `.firefox-mcp` file; pointing `--profile-path` at a marked profile reuses it directly
  93. - `--firefox-arg` — extra Firefox arguments (repeatable)
  94. - `--start-url` — open this URL on start (`START_URL`)
  95. - `--accept-insecure-certs` — ignore TLS errors (`ACCEPT_INSECURE_CERTS=true`)
  96. - `--connect-existing` — attach to an already-running Firefox instead of launching a new one (`CONNECT_EXISTING=true`)
  97. - `--marionette-port` — Marionette port for connect-existing mode, default 2828 (`MARIONETTE_PORT`)
  98. - `--idle-timeout` — seconds without tool calls after which a connect-existing session releases Firefox, default 1800. Firefox accepts one client at a time, so other clients can only connect once it is released. The next tool call reconnects and selects the tab that is active in Firefox at that moment (`IDLE_TIMEOUT`)
  99. - `--pref name=value` — set Firefox preference at startup via `moz:firefoxOptions` (repeatable)
  100. - `--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`)
  101. - `--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).
  102. - `--enable-script` — _deprecated, use `--tool-preset developer` or `--tools ... script debugging`._ Selects the `developer` tool preset. (`ENABLE_SCRIPT=true`)
  103. - `--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`)
  104. - `--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.
  105. - `--android-wipe-app-data` — confirm that Android mode wipes all data of the target app. Required together with `--android-device`. (`ANDROID_WIPE_APP_DATA=true`)
  106. - `--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`)
  107. - `--unrestricted-save-paths` — let the `saveTo` parameter write anywhere on disk instead of the default roots. See [Saving bulky output to disk](#saving-bulky-output-to-disk) and the security note in [SECURITY.md](SECURITY.md). (`UNRESTRICTED_SAVE_PATHS=true`)
  108. - `--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`
  109. ### Tool modules and presets
  110. Tools are grouped into modules. You choose which modules to expose either with a named preset
  111. (`--tool-preset`) or with an explicit list (`--tools`). When both are given, `--tools` wins and
  112. the preset is ignored.
  113. Presets (each is a superset of the previous):
  114. - `slim` — the minimum to browse and interact with pages
  115. - `basic` (default) — adds tools for regular browsing
  116. - `developer` — adds tools for web developers
  117. - `mozilla` — adds tools for Firefox developers
  118. - `all` — every module
  119. See [docs/tools.md](docs/tools.md#modules-and-presets) for the list of modules and the modules
  120. in each preset.
  121. Note that `basic`, the default, includes `script` and therefore the `evaluate_script` tool.
  122. See [SECURITY.md](SECURITY.md#tool-modules-and-presets) for what that means for the attack
  123. surface, and use `--tool-preset slim` or an explicit `--tools` list to drop it.
  124. ```bash
  125. # Use the developer preset (adds network, console, debugging and profiler tools)
  126. npx @mozilla/firefox-devtools-mcp --tool-preset developer
  127. # Enable only the modules you need
  128. npx @mozilla/firefox-devtools-mcp --tools pages network console
  129. ```
  130. The `prefs` and `privileged` modules require `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` and are only
  131. available in the Mozilla-internal build. The `launch` module requires the Mozilla-internal
  132. build too: it restarts Firefox under a caller-chosen binary, profile, environment and set of
  133. preferences, which is a configuration change the operator should own. Use `--pref`,
  134. `--firefox-path` and the other command-line options instead. The `bidi` module also requires
  135. the Mozilla-internal build: it sends any WebDriver BiDi command, so it gives access to what the
  136. other modules expose. The public package skips these modules even if requested and logs a
  137. warning naming the modules it dropped.
  138. ### Useful preferences (`--pref`)
  139. - 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.
  140. - remote.log.level=Trace. Enable verbose WebDriver protocol logs in Firefox. The MCP server will automatically pass the matching log level to geckodriver so both sides log at the same verbosity.
  141. - app.update.disabledForTesting=false. Allow Firefox to automatically download and apply updates. Note that updates may interrupt your session. Requires also setting remote.prefs.recommended=false.
  142. ### Firefox for Android
  143. Use `--android-device` to automate Firefox running on an Android device. Requires `adb` on your PATH and geckodriver, which is managed automatically.
  144. > **Warning:** Android mode wipes all data of the target app before every session.
  145. > Tabs, history, bookmarks, passwords, cookies and settings are all lost. geckodriver runs
  146. > `adb shell pm clear <package>` when creating the session and offers no way to skip it,
  147. > then runs the session on its own temporary profile which is deleted afterwards.
  148. > Because of this, `--android-device` requires `--android-wipe-app-data`, and you should
  149. > install a build dedicated to automation rather than automating the browser you use.
  150. > [Bug 2064088](https://bugzilla.mozilla.org/show_bug.cgi?id=2064088) tracks adding an
  151. > option to geckodriver to keep the existing app data.
  152. ```bash
  153. # List connected devices
  154. adb devices
  155. # Launch Firefox for Android on the single connected device
  156. npx @mozilla/firefox-devtools-mcp --android-device auto --android-wipe-app-data
  157. # Target a specific device
  158. npx @mozilla/firefox-devtools-mcp --android-device <serial> --android-wipe-app-data
  159. # Use Firefox Nightly instead
  160. npx @mozilla/firefox-devtools-mcp --android-device <serial> --android-package org.mozilla.fenix --android-wipe-app-data
  161. ```
  162. Port forwarding between the host and device is handled automatically by geckodriver.
  163. ### Connect to existing Firefox
  164. Use `--connect-existing` to automate your real browsing session, with cookies, logins, and open tabs intact:
  165. ```bash
  166. # Start Firefox with Marionette and the Remote Agent (BiDi)
  167. firefox --marionette --remote-debugging-port
  168. # Run the MCP server
  169. npx @mozilla/firefox-devtools-mcp --connect-existing --marionette-port 2828
  170. ```
  171. 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.
  172. If Firefox is already running with the same profile, the command above only opens a new window in that instance: the flags are ignored, so neither Marionette nor the Remote Agent starts.
  173. To keep your everyday Firefox running without Marionette, give the MCP server its own profile. Firefox runs one process per profile, so both instances run side by side, and the agent only reaches what you sign in to in that profile:
  174. ```bash
  175. # Once: create a dedicated profile
  176. firefox -CreateProfile firefox-mcp
  177. # Start it with Marionette and the Remote Agent, next to your everyday Firefox
  178. firefox -P firefox-mcp --marionette --remote-debugging-port
  179. ```
  180. > **Warning:** Do not leave Marionette enabled during normal browsing. It sets
  181. > `navigator.webdriver = true` and changes other browser fingerprint signals,
  182. > which can trigger bot detection on sites protected by Cloudflare, Akamai, etc.
  183. > Only enable Marionette when you need MCP automation, then restart Firefox
  184. > normally afterward, or run it in a dedicated profile as shown above.
  185. ## Tool overview
  186. See [docs/tools.md](docs/tools.md) for the full list of tools by module, with
  187. descriptions and parameters (generated from the source).
  188. ### Saving bulky output to disk
  189. Large tool output can consume significant context in CLI clients like Claude Code. Several
  190. tools accept an optional `saveTo` parameter that writes the result to a file instead of
  191. returning it inline. See [docs/tools.md](docs/tools.md#tools-that-accept-saveto) for the list.
  192. `saveTo` takes one of three forms:
  193. - a file path (relative to the current working directory, or absolute within `~/.firefox-mcp/output`; parent directories are created). Paths reaching a Firefox profile, or the files this server reads back, are refused
  194. - an existing directory (a timestamped file is generated inside it)
  195. - `true` (a timestamped file is generated under `~/.firefox-mcp/output/`)
  196. The response returns the path and byte size. The saved file always holds the full,
  197. untruncated data: the inline size safeguards (console message caps, network header
  198. truncation, snapshot line caps) never apply to it.
  199. The text-producing tools also accept `preview`, a number of characters of the saved output to
  200. echo back inline as a short excerpt. The list in docs/tools.md shows which tools support it.
  201. ```
  202. screenshot_page({ saveTo: "page.png" })
  203. take_snapshot({ saveTo: true })
  204. list_network_requests({ urlContains: "api", saveTo: "network.json" })
  205. evaluate_script({ function: "() => performance.getEntries()", saveTo: true, preview: 2000 })
  206. ```
  207. By default, save paths are restricted: relative paths resolve against the current working
  208. directory, and absolute paths are only allowed within `~/.firefox-mcp`. Paths that
  209. escape these locations are rejected. Start the server with `--unrestricted-save-paths` to
  210. write to arbitrary locations, including absolute paths outside that directory.
  211. Saved files can then be viewed for instance with Claude Code's `Read` tool without impacting context size.
  212. ## Local development
  213. ```bash
  214. npm install
  215. npm run build
  216. # Run with Inspector against local build
  217. npx @modelcontextprotocol/inspector node dist/index.js --headless --viewport 1280x720
  218. # Or run in dev with hot reload
  219. npm run inspector:dev
  220. ```
  221. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on local development, testing, and CI.
  222. ## Troubleshooting
  223. - Firefox not found: pass `--firefox-path "/Applications/Firefox.app/Contents/MacOS/firefox"` (macOS) or the correct path on your OS.
  224. - First run is slow: Selenium sets up the BiDi session; subsequent runs are faster.
  225. - Stale UIDs: a UID stays valid until its element is removed or the page navigates; take a fresh snapshot (`take_snapshot`) when a UID tool reports one is gone.
  226. - Windows 10: Error during discovery for MCP server 'firefox-devtools': MCP error -32000: Connection closed
  227. - **Solution 1** Wrap with `cmd /c` ([details](https://github.com/modelcontextprotocol/servers/issues/1082#issuecomment-2791786310)):
  228. ```json
  229. "mcpServers": {
  230. "firefox-devtools": {
  231. "command": "cmd",
  232. "args": ["/c", "npx", "-y", "@mozilla/firefox-devtools-mcp@latest"]
  233. }
  234. }
  235. ```
  236. - **Solution 2** Use the absolute path to `npx` (adjust extension — `.cmd`, `.bat`, `.exe`, or `.ps1` — to match your setup):
  237. ```json
  238. "mcpServers": {
  239. "firefox-devtools": {
  240. "command": "C:\\nvm4w\\nodejs\\npx.ps1",
  241. "args": ["-y", "@mozilla/firefox-devtools-mcp@latest"]
  242. }
  243. }
  244. ```
  245. ## Versioning
  246. - Pre‑1.0 API: versions start at `0.x`. Use `@latest` with npx for the newest release.
  247. ## Contributing
  248. See [CONTRIBUTING.md](CONTRIBUTING.md) for how to file issues, run tests, and work on the project locally.
  249. ## Author
  250. Maintained by [Mozilla](https://www.mozilla.org).
  251. ## License
  252. Licensed under either of [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE) at your option.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.