Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0543a91
feat: add env vars and output capture, dynamic firefox (re)start
padenot Jan 9, 2026
826323e
Enable content script evaluation
padenot Jan 12, 2026
faf4478
Allow working in chrome context
padenot Jan 12, 2026
1cae9bf
Handle disconnected Firefox in restart_firefox tool
padenot Jan 16, 2026
cf70c83
Add test scripts for navigation, MOZ_LOG, and chrome context
padenot Jan 21, 2026
976c25f
fix(firefox): Use native --profile arg for reliable profile loading
dmose Jan 29, 2026
88bb114
fix(firefox): Preserve profile path across restart_firefox calls
dmose Jan 30, 2026
8d09203
feat(firefox): Add Firefox preferences configuration
dmose Jan 30, 2026
66c6a1a
fix(firefox): Wait for WebSocket ready before sending BiDi commands
dmose Jan 30, 2026
3d9ba94
fix(firefox): Fix pref tools failing when env var passed via CLI
dmose Jan 30, 2026
5ba9407
chore(tests): Remove plan step comments
dmose Feb 3, 2026
aa7fcb6
docs: Add browser.ml.enable as example pref
dmose Feb 3, 2026
11713ad
Add webExtension.install and webExtension.uninstall tools
Majdoddin Feb 6, 2026
8c50eef
Add list_extensions tool for extension discovery
Majdoddin Feb 6, 2026
e09c550
docs: Add webExtension tools to README
Majdoddin Feb 6, 2026
506e05a
Update src/tools/webextension.ts
padenot Feb 26, 2026
413dba4
fix: do not kill unrelated firefox child processes on test cleanup
juliandescottes Feb 27, 2026
73fa38a
Post rebase fixes and cleanups
juliandescottes Mar 27, 2026
9c36bf2
Add flags to disable script evaluation and privileged contexts by def…
juliandescottes Mar 27, 2026
d604b6d
Stop using privileged contexts to set initial preferences
juliandescottes Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Merged features from Mozilla's temporary fork (https://github.com/padenot/firefox-devtools-mcp):
- Add tool to evaluate JS against the content page
- Add tool to install, uninstall and list webextensions
- Add tool to restart Firefox
- Add tool to read and write preferences
- Improved support for reusing existing profile folder
- Support for MOZ_LOG
- Support privileged context
- Support for sending WebDriver BiDi commands

## [0.8.1] - 2026-03-17

### Fixed
- Increase snapshot test timeout

## [0.8.0] - 2026-03-17

### Added
- Support --connect-existing to attach to running Firefox

## [0.7.1] - 2026-02-13

### Fixed
Expand All @@ -32,7 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Enhanced Vue/Livewire/Alpine.js support**: New snapshot options for modern JavaScript frameworks
- `includeAll` parameter: Include all visible elements without relevance filtering
- `selector` parameter: Scope snapshot to specific DOM subtree using CSS selector
- Fixes [#36](https://github.com/freema/firefox-devtools-mcp/issues/36) - DOM filtering problem with Vue and Livewire applications
- Fixes [#36](https://github.com/mozilla/firefox-devtools-mcp/issues/36) - DOM filtering problem with Vue and Livewire applications
- **Test fixtures**: Added new HTML fixtures for testing visibility edge cases (`visibility.html`, `selector.html`)

### Changed
Expand All @@ -59,7 +80,7 @@ Released on npm, see GitHub releases for details.
### Added
- Windows-specific integration test runner (`scripts/run-integration-tests-windows.mjs`)
- Runs integration tests directly via Node.js to avoid vitest fork issues on Windows
- See [#33](https://github.com/freema/firefox-devtools-mcp/issues/33) for details
- See [#33](https://github.com/mozilla/firefox-devtools-mcp/issues/33) for details
- Documentation for Windows integration tests in `docs/ci-and-release.md`
- Branch protection enabled on `main` branch

Expand Down Expand Up @@ -184,15 +205,15 @@ Released on npm, see GitHub releases for details.
- UID-based element referencing system
- Headless mode support

[0.7.1]: https://github.com/freema/firefox-devtools-mcp/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/freema/firefox-devtools-mcp/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/freema/firefox-devtools-mcp/compare/v0.6.0...v0.6.1
[0.5.3]: https://github.com/freema/firefox-devtools-mcp/compare/v0.5.2...v0.5.3
[0.5.2]: https://github.com/freema/firefox-devtools-mcp/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/freema/firefox-devtools-mcp/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/freema/firefox-devtools-mcp/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/freema/firefox-devtools-mcp/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/freema/firefox-devtools-mcp/compare/v0.2.5...v0.3.0
[0.2.5]: https://github.com/freema/firefox-devtools-mcp/compare/v0.2.3...v0.2.5
[0.2.3]: https://github.com/freema/firefox-devtools-mcp/compare/v0.2.0...v0.2.3
[0.2.0]: https://github.com/freema/firefox-devtools-mcp/releases/tag/v0.2.0
[0.7.1]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.6.1...v0.7.0
[0.6.1]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.6.0...v0.6.1
[0.5.3]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.5.2...v0.5.3
[0.5.2]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.2.5...v0.3.0
[0.2.5]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.2.3...v0.2.5
[0.2.3]: https://github.com/mozilla/firefox-devtools-mcp/compare/v0.2.0...v0.2.3
[0.2.0]: https://github.com/mozilla/firefox-devtools-mcp/releases/tag/v0.2.0
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Firefox DevTools MCP

[![npm version](https://badge.fury.io/js/firefox-devtools-mcp.svg)](https://www.npmjs.com/package/firefox-devtools-mcp)
[![CI](https://github.com/freema/firefox-devtools-mcp/workflows/CI/badge.svg)](https://github.com/freema/firefox-devtools-mcp/actions/workflows/ci.yml)
[![CI](https://github.com/mozilla/firefox-devtools-mcp/workflows/CI/badge.svg)](https://github.com/mozilla/firefox-devtools-mcp/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/freema/firefox-devtools-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/freema/firefox-devtools-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<a href="https://glama.ai/mcp/servers/@freema/firefox-devtools-mcp"><img src="https://glama.ai/mcp/servers/@freema/firefox-devtools-mcp/badge" height="223" alt="Glama"></a>
<a href="https://glama.ai/mcp/servers/@mozilla/firefox-devtools-mcp"><img src="https://glama.ai/mcp/servers/@freema/firefox-devtools-mcp/badge" height="223" alt="Glama"></a>

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.

Repository: https://github.com/freema/firefox-devtools-mcp
Repository: https://github.com/mozilla/firefox-devtools-mcp

> **Note**: This MCP server requires a local Firefox browser installation and cannot run on cloud hosting services like glama.ai. Use `npx firefox-devtools-mcp@latest` to run locally, or use Docker with the provided Dockerfile.

Expand Down Expand Up @@ -95,6 +95,11 @@ You can pass flags or environment variables (names on the right):
- `--accept-insecure-certs` — ignore TLS errors (`ACCEPT_INSECURE_CERTS=true`)
- `--connect-existing` — attach to an already-running Firefox instead of launching a new one (`CONNECT_EXISTING=true`)
- `--marionette-port` — Marionette port for connect-existing mode, default 2828 (`MARIONETTE_PORT`)
- `--pref name=value` — set Firefox preference at startup via `moz:firefoxOptions` (repeatable)
- `--enable-script` — enable the `evaluate_script` tool, which executes arbitrary JavaScript in the page context (`ENABLE_SCRIPT=true`)
- `--enable-privileged-context` — enable privileged context tools: list/select privileged contexts, evaluate privileged scripts, get/set Firefox prefs, and list extensions. Requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` (`ENABLE_PRIVILEGED_CONTEXT=true`)

> **Note on `--pref`:** 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. The `--pref` option allows overriding these defaults when needed.

### Connect to existing Firefox

Expand Down Expand Up @@ -126,6 +131,10 @@ BiDi-dependent features (console events, network events) are not available in co
- Network: list/get (ID‑first, filters, always‑on capture)
- Console: list/clear
- Screenshot: page/by uid (with optional `saveTo` for CLI environments)
- Script: evaluate_script
- Privileged Context: list/select privileged ("chrome") contexts, evaluate_privileged_script (requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`)
- WebExtension: install_extension, uninstall_extension, list_extensions (list requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`)
- Firefox Management: get_firefox_info, get_firefox_output, restart_firefox, set_firefox_prefs, get_firefox_prefs
- Utilities: accept/dismiss dialog, history back/forward, set viewport

### Screenshot optimization for Claude Code
Expand Down Expand Up @@ -195,4 +204,4 @@ npm run inspector:dev

## Author

Created by [Tomáš Grasl](https://www.tomasgrasl.cz/)
Created by [Tomáš Grasl](https://www.tomasgrasl.cz/), maintained by [Mozilla](https://www.mozilla.org).
2 changes: 1 addition & 1 deletion docs/ci-and-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Release flow

Windows Integration Tests
- On Windows, vitest has known issues with process forking when running integration tests that spawn Firefox.
- See: https://github.com/freema/firefox-devtools-mcp/issues/33
- See: https://github.com/mozilla/firefox-devtools-mcp/issues/33
- To work around this, we use a separate test runner (`scripts/run-integration-tests-windows.mjs`) that runs integration tests directly via Node.js without vitest's process isolation.
- The CI workflow detects Windows and automatically uses this runner instead of vitest for integration tests.
- Unit tests still run via vitest on all platforms.
Expand Down
59 changes: 56 additions & 3 deletions docs/firefox-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ Selenium automatically manages Firefox through geckodriver:
--firefox-path <path> # Firefox executable path
--headless # Run Firefox headless
--viewport <WxH> # Set viewport size (e.g., 1280x720)
--profile-path <path> # Firefox profile path
--start-url <url> # Initial URL to navigate to
--pref <name=value> # Set Firefox preference (repeatable, requires MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1)
```

**Environment Variables:**
Expand All @@ -151,9 +153,44 @@ START_URL=https://example.com
```

**Profile Management:**
- Selenium creates temporary profiles automatically
- Custom profile support via `firefoxOptions.setProfile()`
- Automatic cleanup on shutdown
- Use `--profile-path` to specify a Firefox profile directory
- Profile is loaded in-place via Firefox's native `--profile` argument (not copied to temp)
- Runtime profile changes supported via `restart_firefox` tool's `profilePath` parameter

### Firefox Preferences

When Firefox runs in WebDriver BiDi mode (automated testing), it applies [RecommendedPreferences](https://searchfox.org/firefox-main/source/remote/shared/RecommendedPreferences.sys.mjs) that change default behavior for test reliability. The `--pref` option and preference tools allow overriding these when needed.

**Use cases:**
- Firefox development and debugging
- Testing scenarios requiring production-like behavior
- Enabling specific features disabled by RecommendedPreferences

**Example:** The `browser.ml.enable` preference controls Firefox's ML/AI features. RecommendedPreferences disables this by default, making it impossible to use this MCP server to develop or test AI-powered features like Smart Window without explicitly enabling it.

**Setting preferences:**

At startup via CLI:
```bash
# Enable ML/AI features like Smart Window
npx firefox-devtools-mcp --pref "browser.ml.enable=true"
```

At runtime via tools (requires `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`):
```javascript
// Set preferences (e.g., enable ML features)
await set_firefox_prefs({ prefs: { "browser.ml.enable": true } });

// Get preference values
await get_firefox_prefs({ names: ["browser.ml.enable"] });

// Via restart_firefox
await restart_firefox({ prefs: { "browser.ml.enable": true } });
```

**Note:** Preference tools require `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` environment variable.

**Preference persistence:** Preferences set via CLI or `restart_firefox` are preserved across restarts. When `restart_firefox` is called without a `prefs` parameter, existing preferences are re-applied automatically.

## Available Tools

Expand Down Expand Up @@ -188,6 +225,22 @@ The server provides comprehensive browser automation tools:
| `stop_network_monitoring` | Disable network capture | ✅ Implemented |
| `performance_get_metrics` | Get timing metrics | ✅ Via `performance` API |

### Firefox Management

| Tool | Description | Parameters |
|------|-------------|------------|
| `get_firefox_info` | Get current Firefox configuration | (none) |
| `get_firefox_output` | Get Firefox stdout/stderr/MOZ_LOG output | `lines`, `grep`, `since` |
| `restart_firefox` | Restart or configure Firefox | `firefoxPath`, `profilePath`, `env`, `headless`, `startUrl`, `prefs` |
| `set_firefox_prefs` | Set Firefox preferences at runtime | `prefs` (object) |
| `get_firefox_prefs` | Get Firefox preference values | `names` (array) |

**Note:** `set_firefox_prefs` and `get_firefox_prefs` require `MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1` environment variable.

**Note:** `restart_firefox` works in two modes:
- If Firefox is running: closes and restarts with new configuration
- If Firefox is not running: configures options for next tool call that triggers launch

✅ = Fully implemented

## Migration from RDP
Expand Down
148 changes: 0 additions & 148 deletions docs/future-features.md

This file was deleted.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/freema/firefox-devtools-mcp.git"
"url": "git+https://github.com/mozilla/firefox-devtools-mcp.git"
},
"bugs": {
"url": "https://github.com/freema/firefox-devtools-mcp/issues"
"url": "https://github.com/mozilla/firefox-devtools-mcp/issues"
},
"homepage": "https://github.com/freema/firefox-devtools-mcp#readme",
"homepage": "https://github.com/mozilla/firefox-devtools-mcp#readme",
"publishConfig": {
"access": "public"
}
Expand Down
Loading