Skip to main content
Glama
thenailedone

firefox-browser-control

by thenailedone

Firefox 浏览器控制 for Codex

从 Codex 控制你已经打开的 Firefox 会话。该插件可以列出并整理非隐私标签页,创建原生标签页分组,并安全地打开、激活、导航或关闭标签页。

Firefox 扩展及其配套桥接器在本地运行,没有 TCP 监听、遥测、广告或扩展直接发出的网络请求。用户请求的浏览器数据会传递到他们配置的 Codex 环境中;请参阅隐私政策。

它能做什么

  • 检查 Firefox 配套扩展是否已连接。

  • 列出标签页和原生标签页分组。

  • 对选定的标签页进行分组,或按 URL/标题匹配分组。

  • 解除分组、打开、激活、导航和关闭标签页。

这有意地使人无法读取页面内容、点击元素、填写表单、检查隐私浏览窗口,或导航到非 HTTP(S) URL。

示例提示:

*“By grānse,将已打开页面的地址按 permitted ` component."""

  • “在 Firefox 中,将已打开的 Gmail 标签页分组。”

  • “列出我在 Firefox 中打开的标签页。”

  • “在我 make 新加一个 Firefox 标签页中,打开项目文档。”

Related MCP server: universal-browser-bridge

安装

若需要在 /plugins/firefox-browser-control/INSTALL.md 中查看完整说明,详见 plugins/firefox-browser-control/INSTALL.md。简而言之:

git clone https://github.com/thenailedone/firefox-browser-control.git
cd firefox-browser-control
codex plugin marketplace add "$PWD"
codex plugin add firefox-browser-control@firefox-browser-control
node plugins/firefox-browser-control/scripts/install-native-host.mjs

Sign the extension from Mozilla Add-ons when it becomes available. 在开发期间,可从 about:debugging#/runtime/this-firefox 临时加载 plugins/firefox-browser-control/extension/manifest.json。 然后开始一个新的Codex任务。

如何工作

该实现是一个四部分组成的本地桥:

Codex
  │ MCP over stdio
  ▼
MCP server (Node.js)
  │ newline-delimited JSON over a user-only Unix socket
  ▼
Firefox native-messaging host (Node.js)
  │ Firefox native messaging over stdin/stdout
  ▼
Firefox WebExtension
  │ WebExtension APIs
  ▼
Non-private tabs and tab groups in the running Firefox profile
  1. Codex discovers .mcp.json from the plugin manifest and already launches scripts/mcp-server.mjs.

  2. MCP server 提供强描述的工具,例如 firefox_list_tabs 和 firefox_group_tabs.

  3. 工具调用被分配一个随机请求 ID,请求发送至本地 Unix socket。

  4. scripts/native-host.mjs 通过 Firefox 的 prefixed-length 原生消息协议转发请求。

  5. extension/background.js 使用 Firefox WebExtension API 执行请求的操作,并将结果沿同一路径返回。

该原生 host 在 Firefox 扩展连接期间保持持有该 socket。:由于 MCP server 每次调用都会建立短时 socket 连接,因而无需 Firefox 之外的守护进程。

为什么有两个协议

Codex 通过 stdio 来使用 Model Context Protocol,而 Firefox 扩展只能通过原生消息与本地程序交谈。这个小型的 Unix socket 中继将这两种环境相连,不打开 TCP 端口,也不会让浏览器暴露于网络中。

工具表面

工具

用途

firefox_status

确认扩展和本地桥已连接。

firefox_list_tabs

返回标签页 ID、清理后的源、窗口和组 ID。

firefox_list_groups

列出原生 Firefox 标签组 ID 及其显示状态。

firefox_group_tabs

将明确的标签页 ID 输入到命名组中。

firefox_group_tabs_by_url

按 URL / 名称匹配标签页,并按窗口分组。

firefox_ungroup_tabs

从当前组中移除标签页。

firefox_open_tab

打开一个 URL。

firefox_navigate_tab

导航到所选标签页。

firefox_activate_tab

聚焦标签页及其窗口。

firefox_close_tabs

关闭选中的标签页。

安全模型

  • 监听 Unix socket,而非网络端口。

  • 该 socket 限制为当前操作系统用户(0600)。

  • Firefox 只接受来自安装程序声明的扩展 ID 的原生消息。

  • 隐私窗口中的标签页对扩展不可见。

  • 完整 URL、URL 查询 / 片段、页面标题和页面内容不会返回给 Codex;标签页结果仅包含源(origins)。

  • MCP server 强制严格的 JSON Schema 和固定的工具到方法映射。

  • 请求在十秒后超时。

  • 扩展仅执行调度器中的标签页;导航限定为 HTTP(S) URL 以及 about:blank。

  • 当临时目录被会退,每个用户会获得 0700 目录,socket 权限为 0600。

扩展不会申请任何网站主机权限,也不会发出直接网络请求。 Only 当用户主动发送 Codex 标签页管理命令时,它才会发送脱敏浏览活动。

仓库布局

.agents/plugins/marketplace.json             Codex marketplace catalog
plugins/firefox-browser-control/
  .codex-plugin/plugin.json                  Plugin metadata
  .mcp.json                                  MCP server launch configuration
  extension/                                 Firefox WebExtension
  scripts/mcp-server.mjs                     MCP tool server
  scripts/native-host.mjs                    Firefox/native-socket relay
  scripts/install-native-host.mjs            Native-host installer
  scripts/review-client.mjs                  Standalone reviewer test client
  skills/control-firefox/SKILL.md            Agent usage guidance

开发

使用 Node.js 20 或更高版本运行所有检查:

npm test

构建 AMO 就绪的扩展压缩包:

npm run build:extension

ZIP 被写入 artifacts/。店铺列表文本、审阅说明和提交检查表位于 store/AMO_SUBMISSION.md。

修改扩展后,通过 about:debugging 中临时 Add-ons 旁的 Reload 按钮。修改插件元数据、技能或 MCP server 后,需要重新安装插件并启动新的 Codex 任务。

限制

  • 扩展未签名,因此 Firefox 重启后需要重新加载。

  • 自动安装 native host 目前仅支持 Linux 和 macOS。

  • 中继目前使用 Unix socket,不支持原生 Windows。

  • 该扩展需要 Node.js、native-host 以及 Codex 或单独审阅客户端。

  • 这是独立的社区集成,与 Mozilla 或 OpenAI 无关联或认可。

许可证

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables MCP-compatible AI agents to securely control Chrome tabs via a local bridge, with explicit per-tab sharing and human approval for consequential actions.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables MCP-capable CLIs to operate real, already-logged-in Firefox tabs via a WebExtension and native messaging, without simulated input. Supports navigation, clicking, typing, reading, screenshots, and console/network capture with policy gating and frame awareness.
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Local MCP server for Codex that provides on-demand, read-only access to Edge tabs and bookmarks, plus controlled interaction with agent-owned tabs. Requires manual activation via the browser extension and enforces a fail-closed security model.
    -