@askjo/camofox-browser-mcp

中文文档
1.18.1发布于 2026/10/05MITES Module构建来源已验证近 30 天下载 2200

Standalone stdio MCP server exposing the camofox-browser REST API as MCP tools (Claude Code, Codex, agy, Cursor, opencode). Proxies to an already-running camofox-browser REST server — does not itself require the browser binary, Playwright, or the core ser

原始使用文档
文档目录16 节
  1. Architecture
  2. 1. Start the REST server
  3. 2. Install the camofox-browser-mcp bin
  4. 3. Register with your host
  5. Claude Code
  6. Codex CLI
  7. Antigravity / agy
  8. Cursor
  9. opencode
  10. Common: env vars and from-source fallback
  11. 4. Verify
  12. Tools
  13. Workflow
  14. Environment variables
  15. Troubleshooting
  16. Testing (developer)

camofox-browser MCP server

A standalone Model Context Protocol server that exposes camofox-browser to any MCP-compatible host — Claude Code, Cursor, etc. — without requiring OpenClaw.

It mirrors the existing OpenClaw plugin 1:1: same 11 tool names, identical JSON-Schema parameters, and the same REST routes. Whether an agent reaches camofox via OpenClaw or MCP, the behavior is identical.

The initial MCP server implementation was contributed by @epicsagas.

Architecture

The MCP server is a thin stdio client over the camofox REST server. Two pieces:

  • REST server (server.js) — launches Camoufox, exposes the HTTP API on :9377. Run once, it stays up.
  • MCP server (mcp/server.mjs, exposed as the camofox-browser-mcp bin) — translates MCP tool calls into REST calls. Claude Code spawns one per session.

Registering the MCP server does not require being inside the camofox-browser checkout. The examples below work from any directory.

mcp/ is also an independently installable package (@askjo/camofox-browser-mcp, its own package.json). It depends on nothing but @modelcontextprotocol/sdk — no camoufox-js, playwright-core, express, or the ~300MB browser binary download that the core server pulls in. Tool names, JSON-Schema parameters, REST routes, and response shaping are defined in mcp/lib/tool-contracts.mjs, which ships inside the standalone package. The OpenClaw plugin (plugin.ts) imports the same canonical module, so the two hosts cannot drift. See Option D below if you only want the MCP adapter (e.g. pointing CAMOFOX_BASE_URL at a REST server running elsewhere).

1. Start the REST server

Clone the repo and start the server (one-time binary download on first run):

git clone https://github.com/jo-inc/camofox-browser && cd camofox-browser
npm install   # downloads Camoufox (~300MB) on first run
npm start     # → http://localhost:9377

This stays running in the background. It does not need to be your cwd afterwards.

2. Install the camofox-browser-mcp bin

The MCP server is the same for every host — what differs is only the config file you paste into. First, make the camofox-browser-mcp bin available on your PATH. Pick one:

# Option A — npm link (if you have the source checkout; picks up local edits)
cd camofox-browser && npm link

# Option B — global install (no source checkout needed)
npm install -g @askjo/camofox-browser

# Option C — npx (no install; runs the published standalone adapter)
#   Use this wherever a command is expected below.
npx -y @askjo/camofox-browser-mcp

# Option D — MCP adapter only, no core server deps (lightest footprint)
#   Skips camoufox-js/playwright-core/express and the browser binary download —
#   use this if a camofox-browser REST server is already running (locally or
#   remotely) and you only need the stdio adapter.
git clone https://github.com/jo-inc/camofox-browser && cd camofox-browser/mcp
npm install   # installs only @modelcontextprotocol/sdk (~24MB, no postinstall)
npm link      # camofox-browser-mcp now resolves from any directory

Verify the bin resolves from any directory:

which camofox-browser-mcp   # → .../bin/camofox-browser-mcp

3. Register with your host

All five hosts speak standard MCP, so they all run the same camofox-browser-mcp bin. Pick your host's config snippet below.

Claude Code

# CLI (user scope = available in every project)
claude mcp add camofox-browser -s user -- camofox-browser-mcp

Or in ~/.claude.json (user) / .mcp.json (project, checked in):

{
  "mcpServers": {
    "camofox-browser": {
      "command": "camofox-browser-mcp"
    }
  }
}

Codex CLI

~/.codex/config.toml (user) or .codex/config.toml (project, trusted dirs only):

[mcp_servers.camofox-browser]
command = "camofox-browser-mcp"
env = { CAMOFOX_BASE_URL = "http://localhost:9377" }

Antigravity / agy

Global ~/.gemini/config/mcp_config.json or workspace .agents/mcp_config.json:

{
  "mcpServers": {
    "camofox-browser": {
      "command": "camofox-browser-mcp"
    }
  }
}

Cursor

Global ~/.cursor/mcp.json or project .cursor/mcp.json (checked in):

{
  "mcpServers": {
    "camofox-browser": {
      "command": "camofox-browser-mcp"
    }
  }
}

(Or via UI: Settings → Cursor Settings → MCP → Add New MCP Server.)

opencode

opencode.json in the project root, or global ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "camofox-browser": {
      "type": "local",
      "command": ["camofox-browser-mcp"]
    }
  }
}

Common: env vars and from-source fallback

If you need cookie import or a non-default REST URL, add env. Example for Claude Code:

claude mcp add camofox-browser -s user \
  --env CAMOFOX_BASE_URL=http://localhost:9377 \
  --env CAMOFOX_API_KEY=<key> \
  -- camofox-browser-mcp

For the other hosts, add the same keys to the env / environment field of that host's snippet.

From-source fallback (only if you're inside the checkout and haven't linked the bin):

# Replace `camofox-browser-mcp` with `node /absolute/path/to/mcp/server.mjs`
claude mcp add camofox-browser -- node /Users/you/src/camofox-browser/mcp/server.mjs

⚠️ Always prefer the camofox-browser-mcp bin (options A/B/C/D above). The node ./mcp/server.mjs form is path-dependent — relative paths break outside the checkout.

4. Verify

HostHow to verify
Claude Code/mcp — camofox-browser shows connected
Codex CLIcodex then check MCP server list
agy/mcp overlay in the agy CLI
CursorSettings → MCP — server shows green
opencodeopencode mcp list

You should see 11 tools: camofox_create_tab, camofox_snapshot, camofox_click, camofox_type, camofox_navigate, camofox_scroll, camofox_screenshot, camofox_evaluate, camofox_list_tabs, camofox_close_tab, camofox_import_cookies.

Tools

ToolPurpose
camofox_create_tabOpen a URL → returns tabId
camofox_snapshotAccessibility snapshot + element refs (e1, e2, ...) + screenshot
camofox_navigateGo to a URL or use a search macro (@google_search, @reddit_search, ...)
camofox_clickClick by element ref (e1) or CSS selector
camofox_typeType text into a ref/selector, optional pressEnter
camofox_scrollScroll by pixels (unreliable on lazy-load pages — prefer camofox_evaluate)
camofox_screenshotStandalone screenshot
camofox_evaluateRun JS in page context — extract data, call page APIs, scroll via window.scrollTo
camofox_list_tabsList open tabs in this session
camofox_close_tabClose a tab
camofox_import_cookiesImport a Netscape cookie file (needs CAMOFOX_API_KEY)

Workflow

Every interaction follows the same shape — snapshot before you act:

  1. create_tab({ url }) → tabId
  2. snapshot({ tabId }) → element refs (e1, e2, ...)
  3. click/type using those refs
  4. snapshot again to read the new state
  5. close_tab when done

Element refs are unambiguous and preferred over CSS selectors — a selector that matches multiple elements returns 422 strict mode violation, in which case re-snapshot and click by ref.

Environment variables

VarDefaultPurpose
CAMOFOX_BASE_URLhttp://localhost:9377REST server URL
CAMOFOX_USER_IDmcp-<random>Session isolation (one MCP server = one camofox session)
CAMOFOX_SESSION_KEYdefaultTab partition within the user
CAMOFOX_ACCESS_KEY(unset)Global bearer token gating the REST server (superkey). If set, forwarded as Authorization: Bearer <key> on every tool call automatically — must match the REST server's own CAMOFOX_ACCESS_KEY. Without this, a globally-authenticated REST server rejects all tool calls except cookie import.
CAMOFOX_API_KEY(unset)Self-chosen secret gating cookie import. Optional on localhost; required on remote/production and must match the REST server's CAMOFOX_API_KEY. Only affects camofox_import_cookies.

Troubleshooting

  • 503 session_expired / tab create timed out — the REST server's browser session died (often after a prior failed call destabilized it). Restart npm start.
  • camofox_scroll returns {ok:true} but the page doesn't move — expected on lazy-load / virtual-scroll pages; the server's mouse.wheel no-ops there. Use camofox_evaluate with window.scrollTo / scrollBy.
  • 422 strict mode violation ... resolved to N elements on click — CSS selector matched multiple elements. Re-snapshot and click by element ref.
  • 403 Forbidden on camofox_import_cookies — key mismatch between REST server and MCP server, or hitting a remote server without CAMOFOX_API_KEY.
  • 401/403 on every tool call, not just cookie import — the REST server has CAMOFOX_ACCESS_KEY set. Set the same CAMOFOX_ACCESS_KEY in the MCP server's env (see table above) — it's forwarded automatically as Authorization: Bearer once set.

Testing (developer)

Two layers, covering different things:

# 1. `test:mcp` installs the standalone adapter's locked dependencies, then
#    runs the in-repository and packed-tarball handshake tests. Neither needs
#    a REST server.
npm run test:mcp

# 2. Mock-HTTP contract tests — verifies the actual REST traffic each tool
#    produces: routes, methods, request bodies, CAMOFOX_ACCESS_KEY/CAMOFOX_API_KEY
#    auth headers, cookie parsing (Netscape file → `{ cookies }` body, never a
#    path), screenshot decoding, and error handling. Mocked REST server — no
#    live camofox-browser process needed. This is what makes the "OpenClaw and
#    MCP send identical requests" claim verifiable, not just asserted.
NODE_OPTIONS='--experimental-vm-modules' npx jest tests/unit/mcp-contracts.test.js

The packed-tarball check installs the generated @askjo/camofox-browser-mcp tarball in an empty directory before its handshake. It catches imports that reach outside the standalone package.

版本与发布记录

@askjo/camofox-browser-mcp 共发布 8 个版本,首次发布于 2026/08/02;过去 12 个月发布了 8 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.18.1latest2026/10/051 个月前
1.18.02026/10/011 个月前
1.17.02026/09/231 个月前
1.16.02026/09/151 个月前
1.15.02026/09/111 个月前
1.14.02026/08/202 个月前

关于 @askjo/camofox-browser-mcp 的常见问题

@askjo/camofox-browser-mcp 是什么?

Standalone stdio MCP server exposing the camofox-browser REST API as MCP tools (Claude Code, Codex, agy, Cursor, opencode). Proxies to an already-running camofox-browser REST server — does not itself require the browser binary, Playwright, or the core ser

如何安装 @askjo/camofox-browser-mcp?

在项目目录运行 npm install @askjo/camofox-browser-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 camofox-browser-mcp,可以用 npx camofox-browser-mcp 直接运行。

@askjo/camofox-browser-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/askjo__camofox-browser-mcp 是否存在。

@askjo/camofox-browser-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@askjo/camofox-browser-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@askjo/camofox-browser-mcp 可以商用吗?

@askjo/camofox-browser-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@askjo/camofox-browser-mcp 的下载量有多少?

根据 npm 官方下载统计,@askjo/camofox-browser-mcp 在 2026/10/07 – 2026/11/05 这 30 天内被下载 2,200 次,日均约 73 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@askjo/camofox-browser-mcp 还在维护吗?

最新版本 1.18.1 发布于 2026/10/05(1 个月前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/08/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。