firefox-css-theme-mcp 0.1.2 → 0.1.4
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 +13 -4
- package/dist/firefox.js +39 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ Model Context Protocol (MCP) server for inspecting, querying, and live-debugging
|
|
|
15
15
|
#### Claude Code
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
claude mcp add firefox-css-theme -- npx -y firefox-css-theme-mcp
|
|
18
|
+
claude mcp add firefox-css-theme -- npx -y firefox-css-theme-mcp --nova-ui
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
#### Codex
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
codex mcp add firefox-css-theme -- npx -y firefox-css-theme-mcp
|
|
24
|
+
codex mcp add firefox-css-theme -- npx -y firefox-css-theme-mcp --nova-ui
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### Option B — IDE Configuration
|
|
@@ -33,7 +33,7 @@ Add the server configuration to your MCP settings file:
|
|
|
33
33
|
"mcpServers": {
|
|
34
34
|
"firefox-css-theme": {
|
|
35
35
|
"command": "npx",
|
|
36
|
-
"args": ["-y", "firefox-css-theme-mcp"]
|
|
36
|
+
"args": ["-y", "firefox-css-theme-mcp", "--nova-ui"]
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -57,12 +57,21 @@ npm run build
|
|
|
57
57
|
"mcpServers": {
|
|
58
58
|
"firefox-css-theme": {
|
|
59
59
|
"command": "node",
|
|
60
|
-
"args": [
|
|
60
|
+
"args": [
|
|
61
|
+
"/path/to/Firefox-CSS-Theme-MCP/dist/index.js",
|
|
62
|
+
"--nova-ui"
|
|
63
|
+
]
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
```
|
|
65
68
|
|
|
69
|
+
## Command-line Flags
|
|
70
|
+
|
|
71
|
+
| Flag | Type | Description |
|
|
72
|
+
| :---------- | :-------- | :------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| `--nova-ui` | `boolean` | Enables the Firefox Nova UI redesign preferences (`browser.nova.enabled` and `browser.newtabpage.activity-stream.nova.enabled`). |
|
|
74
|
+
|
|
66
75
|
## Available MCP Tools
|
|
67
76
|
|
|
68
77
|
- `launch_browser`: Launches Firefox with chrome debugging capabilities enabled.
|
package/dist/firefox.js
CHANGED
|
@@ -5,20 +5,40 @@ export class FirefoxBrowserManager {
|
|
|
5
5
|
async initialiseBrowser(binaryPath, profileDirectory) {
|
|
6
6
|
if (this.driverInstance)
|
|
7
7
|
return;
|
|
8
|
+
const isNovaUiEnabled = process.argv.includes("--nova-ui");
|
|
8
9
|
const firefoxOptions = new firefox.Options();
|
|
9
|
-
firefoxOptions.addArguments("-remote-
|
|
10
|
+
firefoxOptions.addArguments("-no-remote", "-new-instance");
|
|
10
11
|
firefoxOptions.setPreference("devtools.chrome.enabled", true);
|
|
11
12
|
firefoxOptions.setPreference("devtools.debugger.remote-enabled", true);
|
|
13
|
+
firefoxOptions.setPreference("devtools.debugger.prompt-connection", false);
|
|
12
14
|
firefoxOptions.setPreference("toolkit.legacyUserProfileCustomizations.stylesheets", true);
|
|
15
|
+
firefoxOptions.setPreference("marionette.allow-system-access", true);
|
|
16
|
+
firefoxOptions.setPreference("remote.allow-system-access", true);
|
|
17
|
+
firefoxOptions.setPreference("browser.nova.enabled", isNovaUiEnabled);
|
|
18
|
+
firefoxOptions.setPreference("browser.newtabpage.activity-stream.nova.enabled", isNovaUiEnabled);
|
|
13
19
|
if (binaryPath)
|
|
14
20
|
firefoxOptions.setBinary(binaryPath);
|
|
15
21
|
if (profileDirectory)
|
|
16
22
|
firefoxOptions.setProfile(profileDirectory);
|
|
17
|
-
|
|
18
|
-
.
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
const firefoxService = new firefox.ServiceBuilder()
|
|
24
|
+
.enableVerboseLogging(true)
|
|
25
|
+
.addArguments("--allow-system-access");
|
|
26
|
+
try {
|
|
27
|
+
this.driverInstance = await new Builder()
|
|
28
|
+
.forBrowser("firefox")
|
|
29
|
+
.setFirefoxOptions(firefoxOptions)
|
|
30
|
+
.setFirefoxService(firefoxService)
|
|
31
|
+
.build();
|
|
32
|
+
await this.ensureChromeContext();
|
|
33
|
+
await this.openBrowserToolbox().catch(() => { });
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (this.driverInstance) {
|
|
37
|
+
await this.driverInstance.quit().catch(() => { });
|
|
38
|
+
this.driverInstance = null;
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
22
42
|
}
|
|
23
43
|
async terminateBrowser() {
|
|
24
44
|
if (!this.driverInstance)
|
|
@@ -151,5 +171,18 @@ export class FirefoxBrowserManager {
|
|
|
151
171
|
const fullWindowScreenshotBase64 = await this.driverInstance.takeScreenshot();
|
|
152
172
|
return { base64Image: fullWindowScreenshotBase64, format: "png" };
|
|
153
173
|
}
|
|
174
|
+
async openBrowserToolbox() {
|
|
175
|
+
await this.ensureChromeContext();
|
|
176
|
+
return await this.executeChromeScript(() => {
|
|
177
|
+
try {
|
|
178
|
+
const { BrowserToolboxLauncher } = ChromeUtils.importESModule("resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs");
|
|
179
|
+
BrowserToolboxLauncher.init();
|
|
180
|
+
return { success: true };
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return { success: false };
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
154
187
|
}
|
|
155
188
|
export const globalFirefoxManager = new FirefoxBrowserManager();
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { globalFirefoxManager } from "./firefox.js";
|
|
6
6
|
const serverInstance = new McpServer({
|
|
7
7
|
name: "firefox-css-theme-mcp",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
});
|
|
10
10
|
serverInstance.registerTool("launch_browser", {
|
|
11
11
|
description: "Launch a Firefox instance with chrome debugging capabilities enabled.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firefox-css-theme-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Model Context Protocol server for inspecting and live-debugging Firefox UI DOM and CSS themes.",
|
|
5
5
|
"homepage": "https://github.com/easonwong-de/Firefox-CSS-Theme-MCP#readme",
|
|
6
6
|
"bugs": {
|