Skip to main content
Glama

palmifer-mcp

Zero-dependency Model Context Protocol (MCP) server wrapping palmifer to drive your real, logged-in Chrome (or a throwaway headless Chrome) over CDP — built for sandboxed desktop AI apps (Gemini App, Claude Desktop, Cursor, Antigravity) where agent shell commands cannot read Chrome's DevToolsActivePort or bind 127.0.0.1.

它是什么:把 palmifer 封装为宿主机侧的 stdio MCP Server(纯 Node.js ≥ 22,228 KB 零第三方 npm 依赖)。像 Gemini App 这类沙箱较严的桌面客户端,Agent 自己跑 shell 会遇到 EPERM / 无法连本地端口 / 无法启动子进程,通过 palmifer-mcp 就能直接把 25 个强类型浏览器工具暴露给 Agent。

核心优势(v0.4.1 实测):

  • 直连你已登录的真实 Chrome:在 chrome://inspect/#remote-debugging 勾一次开关、弹窗点一次 Allow,后台 daemon 持久复用连接;支持 new_window: true 独立窗口隔离,不弄乱你的主窗口标签页,也不会因为你切 tab 变成 hidden。

  • 毫秒级直连快路径:MCP Server 对已运行的本地 daemon 直接走 127.0.0.1 loopback HTTP,跳过每次拉起 Node 子进程的 ~150 ms 开销(实测 browser_tabs p50 0.97 ms vs 子进程模式 156.3 ms);private_start 冷启动 823 ms,首次整套启动→打开公网页面 1,874 ms(快于 @playwright/mcp 3,389 ms 与 chrome-devtools-mcp 2,808 ms)。

  • 省 Token 15x–24x 的免弹窗只读读取:browser_dom(fields=...) 用纯 DOM 选择器一次抽取出干净 JSON 数组(穿透 Shadow DOM、自动把相对链接解析为绝对 https://...、跳过空骨架行、支持 dedupe_by 去重),无需触发高风险的 browser_eval 弹窗;browser_text(main_only=true) 自动剔除 nav/header/footer/aside 噪音。7 个真实公网站点只读总计 5,291 tokens(对比 chrome-devtools-mcp 79,690 tokens、@playwright/mcp 125,847 tokens;即使使用有界 AX 树 browser_snapshot(limit=220) 也仅 10,289 tokens)。

  • 权限分级与防越权:readOnlyHint(7 个)、destructiveHint: false(10 个)、destructiveHint: true(8 个);browser_batch 严格禁止内部夹带破坏性工具(browser_eval / browser_click 等),并直接内嵌原生 JSON data 减少回传体积;-- 参数分隔符与沙箱路径校验防止命令行/路径注入。

  • 自带排障与托管 CLI:palmifer-mcp doctor 一眼看清当前 MCP 入口、daemon PID、运行中脚本路径和代码是否过期(mcpStale / daemon.stale);palmifer-mcp daemon install 可把 daemon 装为 macOS LaunchAgent 跑在宿主桌面会话中,彻底解决 Gemini App 沙箱内无法启动无头 Chrome(Mach IPC bootstrap_check_in 被拒)的问题。

Architecture

MCP Host (Gemini App / Claude Desktop / Cursor / Antigravity)
  │  stdio JSON-RPC 2.0
  ▼
palmifer-mcp (0.4.1, Node >= 22, 228 KB, zero deps)
  ├── fast-path: direct 127.0.0.1:8798 HTTP /run (~0.97 ms p50)
  └── fallback:  spawn vendor/palmifer/palmifer.mjs (starts daemon on first call)
        │
        ▼
  palmifer daemon (127.0.0.1:8798, token-auth)
        ├── real mode    ──CDP──▶ Your Chrome (existing logins, 1x Allow)
        ├── anon context ──CDP──▶ Cookie-less window inside current Chrome
        └── private mode ──CDP──▶ Throwaway headless Chrome (~823 ms cold start)

Related MCP server: TraeBridge MCP Server

Measured Benchmark (v0.4.1 vs Competitors)

Head-to-head benchmark across 9 real websites (Authenticated: X.com, Bilibili.com; Public: simonwillison.net, lobste.rs, ithome.com, sspai.com, bbc.com/news, en.wikipedia.org, github.com/trending) plus Shadow DOM / iframe fixtures. Full methodology and per-site tables live in bench/RESULTS.md.

KPI

palmifer-mcp 0.4.1

@playwright/mcp 0.0.86

chrome-devtools-mcp 1.14.0

Install size / deps

228 KB (0 deps)

19,176 KB

12,508 KB

Schema prompt tax (tools/list)

4,516 tokens

5,300 tokens

8,303 tokens

Cold start → first page ready

1,874 ms

3,389 ms

2,808 ms

7-site read-only text(main_only) tokens

5,291 tokens (AX snap: 10,289)

125,847 tokens (23.8x)

79,690 tokens (15.1x)

Structured Top-5 extract

2.9–5.3 ms (readOnlyHint: true)

506–1,823 ms (destructiveHint: true)

101–106 ms (evaluate_script)

Multi-step browse (github.com/trending)

2 rounds / 466.4 ms / 441 tok

4 rounds / 2,053.0 ms / 779 tok

4 rounds / 799.3 ms / 533 tok

Shadow DOM + Iframe read-only

6.32 ms / 44 tokens

3.37 ms / 84 tokens

3.63 ms / 78 tokens

Authenticated X.com & Bilibili.com

Real logged-in feed (both)

Hit X login wall / guest view

Hit X login wall / guest view

Requirements

  • Node.js >= 22 (zero npm install needed)

  • Google Chrome / Chromium / Edge / Brave

To drive your own signed-in Chrome:

  1. Open chrome://inspect/#remote-debugging in Chrome

  2. Tick "Allow remote debugging for this browser instance"

  3. Click Allow once when Chrome prompts on first connection

Install & Configure

Keep a stable local path under ~/.mcp/servers/ so MCP clients never point at temporary folders:

mkdir -p ~/.mcp/servers
git clone https://github.com/kjx-talesofai/palmifer-mcp.git ~/.mcp/servers/palmifer-mcp
node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs config --stable

Add to your MCP host (Gemini App, Claude Desktop, Cursor, Antigravity):

{
  "mcpServers": {
    "palmifer": {
      "command": "/opt/homebrew/bin/node",
      "args": [
        "/Users/<you>/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs"
      ],
      "env": {
        "PALMIFER_MCP_KEEP_DAEMON": "1"
      }
    }
  }
}

Tip: Replace /opt/homebrew/bin/node with the output of which node so GUI apps (which don't inherit shell PATH) can always launch Node >= 22. Setting PALMIFER_MCP_KEEP_DAEMON=1 keeps your Chrome Allow approval alive across MCP reconnects; set "0" if you want the daemon stopped on MCP exit.

Sandboxed macOS desktop apps (such as Gemini App's Seatbelt sandbox) block child processes from using Chrome's Mach IPC (bootstrap_check_in: Permission denied), which makes headless private_start fail inside the sandbox. Running the palmifer daemon in your normal user LaunchAgent session solves both headless private_start and persistent Chrome Allow across app restarts:

node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs daemon install

Manage or inspect anytime:

node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs doctor          # inspect PID, script paths, stale code
node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs restart         # stop running daemon so new disk code loads
node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs daemon status   # check LaunchAgent status
node ~/.mcp/servers/palmifer-mcp/bin/palmifer-mcp.mjs daemon uninstall

Environment Variables

Variable

Description

Default

PALMIFER_BIN

Override path to palmifer.mjs

vendor/palmifer/palmifer.mjs

PALMIFER_STATE_DIR

Daemon state directory (for multi-client isolation)

~/.cache/palmifer (falls back to $TMPDIR/palmifer-<uid>)

PALMIFER_DAEMON_PORT

Daemon loopback HTTP port

8798

PALMIFER_MCP_KEEP_DAEMON

Keep daemon alive on MCP exit ("1" or "0")

"0"

PALMIFER_MCP_DIRECT_HTTP

Set "0" to disable direct HTTP fast-path and always spawn

"1"

PALMIFER_MCP_TIMEOUT_MS

Per-tool execution timeout (ms)

180000

PALMIFER_FAST

Set "1" to skip human-paced delays globally

"0"

PALMIFER_CHROME_FLAGS

Extra Chrome flags for private_start

Inherits HTTPS_PROXY/HTTP_PROXY/ALL_PROXY automatically

Tools (25)

Tools carry MCP ToolAnnotations so hosts can auto-approve read-only & low-risk calls while prompting on destructive actions:

Read-Only (readOnlyHint: true, destructiveHint: false)

  • browser_status — Daemon, CDP mode/tabs, plus mcp diagnostics (version, pid, entry, mcpStale, daemon.stale)

  • browser_tabs — List open tabs with index, targetId, mine, anon, title, URL

  • browser_frames — List #fN iframes in a tab

  • browser_snapshot — Accessibility tree with @eN refs (actionable_only, filter, limit)

  • browser_text — Visible innerText, with main_only=true (strips nav/header/footer/aside clutter) or selector

  • browser_dom — Shadow-DOM-piercing query & read-only structured JSON extractor via fields (".", "@attr", "<css>", "<css>@<attr>", trailing "[]"), with automatic resolve_urls, skip_empty, and dedupe_by

  • browser_wait — Wait for CSS selector or visible text

Non-Destructive Navigation & Capture (readOnlyHint: false, destructiveHint: false, openWorldHint where noted)

  • browser_mode — private_start (http(s)|about:blank URL only, openWorldHint: true), private_status, use_private, use_real, anon_on, anon_status

  • browser_open — Open URL in new tab or isolated window (new_window=true, background=true)

  • browser_goto — Navigate current/specified tab (reuses isolated window)

  • browser_use_tab — Select active tab by index string, targetId, or substring

  • browser_front — Bring hidden tab to front (prefer front=true directly on actions)

  • browser_scroll — Real mouseWheel scrolling (down / up / bottom / top)

  • browser_screenshot — PNG/JPEG/WebP capture (full, scale, max_width, annotate, include_image)

  • browser_pdf — Render tab to PDF on disk

  • browser_network — Capture & inspect XHR/fetch traffic (start, list, detail, stop)

  • browser_batch — Run multiple read-only / non-destructive steps in one call with native JSON data (rejects destructiveHint=true tools)

Destructive / State-Changing (destructiveHint: true)

  • browser_click — Trusted click by @eN, CSS, text, or (x, y) (front, fast, verify)

  • browser_fill — Trusted focus + clear + type into input (front, fast, verify)

  • browser_press — Trusted key press (Enter, Tab, Escape, Meta+A, etc.)

  • browser_upload — Attach local files to <input type="file">

  • browser_eval — Evaluate arbitrary JS in page/iframe

  • browser_close_tab — Close specific tab, mine=true, or all=true

  • browser_session — Teardown & lifecycle: browser_close, anon_off, cancel, stop, restart_daemon

  • browser_cdp — Raw CDP Domain.method escape hatch

Tests & Benchmark

npm run check      # syntax check all .mjs files
npm test           # 14 unit, schema, security-hardening, batch-guard, stale-detection, and Mach sandbox fast-fail tests
npm run test:e2e   # full headless Chrome E2E suite (private_start, dom fields, text main_only, trusted events, upload, iframe, pdf, network, batch, anon, public web, HTTP vs spawn benchmark)

Author

Built by Jiaxin Kou · GitHub

License

MIT — see LICENSE.

Available Tools

25 tools
browser_batchA
Idempotent

Run multiple read-only/non-destructive steps in one MCP call to cut round-trips. Destructive tools (click/fill/press/eval/upload/close_tab/session/cdp) are rejected and must be called directly.

Inputs: steps (required), stop_on_error.

browser_cdpC
Destructive

Send raw CDP Domain.method command.

Inputs: method (required), tab, params, browser_level.

browser_clickA
Destructive

Send trusted click to @eN, CSS, text, or (x, y). Pass front=true if tab may be hidden, fast=true to skip pacing, verify='' to assert.

Inputs: x, y, nth, tab, +9 more.

browser_close_tabB
Destructive

Close a tab, tabs opened by palmifer (mine=true), or all tabs.

Inputs: all, tab, mine, force.

browser_domA
Read-onlyIdempotent

Read-only DOM probe & structured JSON extractor (pierces shadow roots, zero eval). Pass 'fields' with 'selector' (e.g. { author: '.user', text: '.body', link: 'a@href', tags: '.tag[]', id: '@data-id' }); '.'=text, '@attr'=attr, '[]'=array. Resolves relative URLs & skips empty rows by default. Use within='' to scope.

Inputs: all, tab, text, exact, +9 more.

browser_evalA
Destructive

Evaluate JS in page/iframe. Prefer read-only browser_dom(fields) or browser_text(main_only=true) for extraction; avoid fetch().

Inputs: tab, code, file, frame, +1 more.

browser_fillA
Destructive

Focus @eN, CSS, or (x, y) and type text (replaces unless append=true). Pass front=true if hidden and fast=true for instant trusted insert.

Inputs: value (required), x, y, tab, +7 more.

browser_framesB
Read-onlyIdempotent

List iframes (#fN) inside a tab.

Inputs: tab.

browser_frontA
Idempotent

Raise a tab to foreground. Prefer passing front=true directly on click/fill/press/scroll.

Inputs: tab.

browser_gotoB

Navigate current/specified tab to URL (prefer reusing an isolated window tab).

Inputs: url (required), tab, fast, no_wait.

browser_modeC

Low-risk mode switcher: private_start (headless, prefer when logins aren't needed), private_status, use_private, use_real, anon_on (fallback cookie-less context if sandbox blocks headless), anon_status.

Inputs: action (required), url, headed, dry_run, +1 more.

browser_networkA
Idempotent

Capture & inspect page network requests (start, list, detail, stop).

Inputs: action (required), tab, limit, filter, +1 more.

browser_openA

Open URL in a new tab (or new_window=true dedicated window). In real Chrome mode, prefer new_window=true so user tab switches won't hide agent tabs.

Inputs: url (required), fast, no_wait, background, +1 more.

browser_pdfB
Idempotent

Render tab to a PDF file inside cwd or temp dir.

Inputs: tab, path.

browser_pressA
Destructive

Send trusted key press (Enter, Tab, Escape, Meta+A). Pass front=true if hidden.

Inputs: key (required), tab, fast, front, +1 more.

browser_screenshotB
Idempotent

Capture screenshot to temp/cwd path (PNG/JPEG/WebP). Set include_image=true to return base64 inline.

Inputs: tab, full, path, scale, +4 more.

browser_scrollA
Idempotent

Scroll via real mouseWheel events (down/up/bottom/top). Pass front=true if hidden and fast=true for quick paging.

Inputs: max, tab, fast, front, +3 more.

browser_sessionA
Destructive

Destructive lifecycle ops: browser_close, anon_off, cancel, stop, restart_daemon. For starting/switching modes use browser_mode.

Inputs: action (required).

browser_snapshotA
Read-onlyIdempotent

Capture accessibility tree with @eN refs. Use actionable_only=true for compact interactive views.

Inputs: tab, frame, limit, filter, +1 more.

browser_statusA
Read-onlyIdempotent

Check daemon, CDP connection, mode (real vs private), tab count, and MCP/daemon stale diagnostics.

Inputs: port.

browser_tabsA
Read-onlyIdempotent

List open Chrome tabs with index, id, title, and URL.

Inputs: no named parameters.

browser_textB
Read-onlyIdempotent

Read visible innerText. Pass main_only=true (strips nav/header/footer/aside) or selector='' to avoid clutter.

Inputs: max, tab, frame, selector, +1 more.

browser_uploadC
Destructive

Attach local files to a element.

Inputs: files (required), selector (required), tab, frame.

browser_use_tabC
Idempotent

Select active tab by index string ('0'), targetId, or URL/title substring.

Inputs: tab (required).

browser_waitA
Read-onlyIdempotent

Wait for a CSS selector or visible text (read-only; for JS predicates use browser_eval).

Inputs: tab, text, frame, timeout, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, and descriptions actively steer between overlapping extraction modes (text vs dom vs snapshot) and lifecycle controls (mode vs session). Minor ambiguity remains around status variants, tab closing vs browser closing, and front vs use_tab.

    Naming Consistency4/5

    All tools consistently use the browser_ prefix with snake_case suffixes, making the namespace predictable. However, many names are noun-oriented (browser_tabs, browser_status, browser_pdf) rather than strict verb_noun action names.

    Tool Count3/5

    25 tools sits at the heavy end for a single MCP server. Browser automation justifies many primitives, but the inclusion of advanced/control tools like cdp, batch, network, and session makes the surface feel broad and borderline bloated.

    Completeness4/5

    The set covers navigation, tab lifecycle, extraction, interaction, waits, screenshots, PDF/upload, network inspection, CDP, and batching. Minor gaps such as dedicated hover/drag/select or cookie/storage management exist, though most are workaroundable via eval or raw CDP.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to directly control your real Chrome browser with full context including login sessions, cookies, and open tabs. It provides tools for page scanning, JavaScript execution, CDP control, screenshots, and physical mouse/keyboard input for authentic browser automation.
      20
      243
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI clients to control the user's already-open, logged-in browser pages in real time over a local WebSocket channel, without Playwright, Puppeteer, Selenium, or any browser driver. Exposes tools for navigation, semantic page snapshots, clicking, form filling, JavaScript evaluation, screenshots, network monitoring, cookie handling, and tab management via the CDP.
      20
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.
      95
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local Chrome control for AI clients over MCP stdio, HTTP, or CLI, exposing 20 tools to extract page text, number and click elements, type text, scroll, manage tabs, capture screenshots, and bind uploaded files to file inputs. Operations run entirely on the local machine with origin allowlists and refusal of untrusted URLs, without calling a cloud model or consuming model tokens.
      MIT