lightpanda-browser
Lightpanda: the headless browser built from scratch for AI agents and automation. Written in Zig with V8, MCP-integrated browser automation. Trigger: When AI agents need high-performance browser automation, web scraping, CDP server access, or MCP browser tools for navigating websites and extracting data.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-08-26
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- lightpanda-browser
- license
- AGPL-3.0
- metadata
- { "author": "lightpanda-io", "version": "1.0" }
- description
- Lightpanda: the headless browser built from scratch for AI agents and automation. Written in Zig with V8, MCP-integrated browser automation. Trigger: When AI agents need high-performance browser automation, web scraping, CDP server access, or MCP browser tools for navigating websites and extracting data.
03 SKILL.md 正文
What is Lightpanda?
A headless browser built from scratch for AI agents and automation:
- Not a Chromium fork — written from scratch in Zig with V8 engine
- ~16x less memory than headless Chrome (123MB vs 2GB for 100 pages)
- ~9x faster than headless Chrome (5s vs 46s for 100 pages)
- MCP server integrated (stdio and HTTP transport)
- CDP-compatible with Puppeteer/Playwright
- Agent mode with native AI integration
- Zero graphical rendering engine (text-only, memory efficient)
MCP Workflow (PREFERRED for Agents)
Lightpanda ships with MCP tools that agents should use directly.
MCP Tools Available
| Tool | Parameters | Description |
|---|---|---|
goto |
url, wait?, timeout? |
Navigate to a URL |
title |
- | Get the page title |
tree |
selector?, backendNodeId?, maxDepth?, maxBytes? |
Semantic DOM tree overview |
markdown |
selector?, backendNodeId?, maxBytes?, url? |
Extract readable markdown from page/subtree |
html |
selector?, backendNodeId?, url? |
Get raw HTML of page/subtree |
findElement |
role, name |
Locate element by role/name |
nodeDetails |
backendNodeId |
Get CSS selector and attributes for a node |
interactiveElements |
- | List clickable/typeable elements |
click |
selector, backendNodeId? |
Click an element |
fill |
selector, value |
Fill input field |
type |
selector, text |
Type text into input |
selectOption |
selector, value |
Select dropdown option |
setChecked |
selector, checked |
Check/uncheck checkbox |
evaluate |
expression, await? |
Run JavaScript |
waitForSelector |
selector, timeout? |
Wait for element |
waitForState |
state, timeout? |
Wait for network idle/load |
extract |
schema, selector? |
Extract structured data via schema |
getUrl |
- | Get current URL |
back |
- | Navigate back |
forward |
- | Navigate forward |
reload |
ignoreCache? |
Reload page |
close |
- | Close the browser |
getEnv |
name? |
List available environment vars (LP_*) |
search |
query, maxResults? |
Web search (uses connected LLM) |
session_new |
- | Create a new browsing session |
session_list |
- | List sessions (HTTP mode) |
session_close |
id |
Close a session (HTTP mode) |
MCP Server Configuration
stdio (default) - for OpenCode subprocess:
{
"mcpServers": {
"lightpanda": {
"command": "lightpanda",
"args": ["mcp"]
}
}
}
HTTP - for network connection (supports multiple isolated sessions):
lightpanda mcp --port 9223
Or with explicit bind address:
lightpanda mcp --port 9223 --host 0.0.0.0
MCP Exploration Pattern
Before scraping, follow this sequence:
- Navigate with
goto <url>or combine with read:markdown <url>/html <url>/tree <url> - Snapshot structure with
treefor a semantic overview - Interact with forms/elements using
click,fill,type - Extract data with
extract <schema>ormarkdown/html - Verify with
title,getUrl
Avoid standalone
goto— prefermarkdown <url>orhtml <url>to navigate and read in one call.
CLI vs MCP — Not Interchangeable
Critical: MCP tools (
goto,tree,click,fill,extract, etc.) are NOT CLI flags. Do NOT runlightpanda treeorlightpanda click— they don't exist. MCP tools only work vialightpanda mcp(JSON-RPC).lightpanda fetchis the CLI read-only equivalent.
| Intent (MCP tool) | CLI Equivalent | Direct? |
|---|---|---|
goto + markdown/html/tree |
`lightpanda fetch <url> --dump markdown | html |
waitForSelector / waitForState |
lightpanda fetch --wait-selector "#x" --wait-until networkidle0 <url> |
✅ Yes |
evaluate / inject JS |
lightpanda fetch --inject-script "js" --wait-script "expr" <url> |
⚠️ Partial |
click / fill / type / selectOption / setChecked |
No CLI — requires lightpanda mcp or lightpanda serve (CDP) |
❌ MCP only |
extract {schema} |
fetch --dump markdown + parse externally |
⚠️ Partial |
Sessions session_new/list/close |
lightpanda mcp --port 9223 + curl POST /mcp with Mcp-Session-Id header |
✅ Via HTTP |
Terminal usage of MCP (when you must):
lightpanda mcp --port 9223 # HTTP mode, one session per client
# then in another shell:
curl -X POST http://127.0.0.1:9223/mcp -H "Content-Type: application/json" -H "Mcp-Session-Id: s1" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"markdown","arguments":{"url":"https://example.com"}}}'
CLI Workflow
Fetch a page (CLI mode)
lightpanda fetch https://example.com # prints markdown
lightpanda fetch --obey-robots --dump html https://example.com # dump HTML
lightpanda fetch --dump markdown https://example.com # dump markdown
lightpanda fetch --dump links https://example.com # dump links
lightpanda fetch --dump assets https://example.com # dump assets
lightpanda fetch --obey-robots --dump markdown --log-level info https://example.com
Waiting options
lightpanda fetch --wait-selector "#content" https://example.com
lightpanda fetch --wait-ms 2000 https://example.com
lightpanda fetch --wait-until networkidle0 https://example.com
Start a CDP server (for Puppeteer/Playwright)
lightpanda serve --host 127.0.0.1 --port 9222
lightpanda serve --obey-robots --log-level info --port 9222
Agent mode
lightpanda agent # auto-detects API key from env
lightpanda agent --task "top story on news.ycombinator.com?"
lightpanda agent --no-llm # basic REPL, no LLM
lightpanda agent session.js # run a recorded script
lightpanda agent --provider gemini --task "..." # force a specific provider
Puppeteer / Playwright Integration
Connect to Lightpanda's CDP server as a drop-in replacement:
Puppeteer
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.connect({
browserWSEndpoint: "ws://127.0.0.1:9222",
});
const context = await browser.createBrowserContext();
const frame = await context.newPage();
await frame.goto('https://example.com', {waitUntil: "networkidle0"});
console.log(await frame.title());
await frame.close();
await context.close();
await browser.disconnect();
Playwright
import { chromium } from 'playwright-core';
const browser = await chromium.connectOverCDP({
wsEndpoint: "ws://127.0.0.1:9222",
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com');
console.log(await page.title());
await browser.close();
Agent Mode
lightpanda agent provides an interactive AI agent that controls the browser natively:
- Describe tasks in plain English or slash commands
- Navigate, click, fill forms, extract structured data
- Output is a PandaScript (vanilla JS with native browser primitives)
- Supports Anthropic, OpenAI, Gemini, Google Vertex AI, Hugging Face, Ollama
- Can run without LLM using
--no-llm(REPL mode)
Providers
lightpanda agent --provider openai --task "..."
lightpanda agent --provider anthropic --task "..."
lightpanda agent --provider gemini --task "..."
lightpanda agent --provider vertex --task "..."
lightpanda agent --provider ollama --task "..."
lightpanda agent --provider huggingface --task "..."
Environment Variables
OPENAI_API_KEYANTHROPIC_API_KEYGOOGLE_API_KEYVERTEX_API_KEY+GOOGLE_CLOUD_PROJECTHF_TOKENOLLAMA_HOST
Telemetry and Privacy
By default, Lightpanda collects usage telemetry. Disable with:
export LIGHTPANDA_DISABLE_TELEMETRY=true
Privacy policy: https://lightpanda.io/privacy-policy
Installation
Homebrew (macOS / Linux)
brew install lightpanda-io/browser/lightpanda
Arch AUR
yay -S lightpanda-nightly-bin
Download binary
# Linux x86_64
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux
chmod a+x ./lightpanda
# macOS aarch64
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos
chmod a+x ./lightpanda
Docker
docker run -d --name lightpanda -p 127.0.0.1:9222:9222 lightpanda/browser:nightly
Build from source
git clone https://github.com/lightpanda-io/browser.git
cd browser
make build
When to Use Lightpanda vs Obscura vs Playwright
| Scenario | Recommendation |
|---|---|
| AI agent MCP automation | Lightpanda or Obscura (native MCP tools) |
| High-performance scraping | Lightpanda (~9x faster, 16x less memory) |
| Scraping with bot detection | Obscura (stealth mode) |
| Complex E2E testing | Playwright (better debugging) |
| Test suites with tracing | Playwright (built-in) |
| Agent mode (AI-driven) | Lightpanda (native agent, PandaScript) |
| Teams without Zig/Rust | Playwright or Obscura (Node.js easier) |
Supported Web APIs
Lightpanda implements:
- DOM tree, DOM APIs, DOM dump
- JavaScript support (V8)
- Ajax: XHR API, Fetch API
- HTML parser (html5ever)
- HTTP loader (Libcurl)
- CDP/WebSocket server
- Click, input form, cookies, custom headers, proxy, network interception
- CORS support
robots.txtrespect with--obey-robots
Core Dumps
Suppress crash core dumps:
export LIGHTPANDA_DISABLE_CORE_DUMP=true
Resources
- Docs: https://lightpanda.io/docs
- GitHub: https://github.com/lightpanda-io/browser
- Nightly builds: https://github.com/lightpanda-io/browser/releases/tag/nightly
- Docker: https://hub.docker.com/r/lightpanda/browser
- Discord: https://discord.gg/K63XeymfB5
04 同仓库更多 Skills
zustand-5
Zustand 5 state management patterns. Trigger: When managing React state with Zustand.
zod-4
Zod 4 schema validation patterns. Trigger: When using Zod for validation - breaking changes from v3.
x-bookmark-quote-posts
Workflow para revisar bookmarks de X/Twitter y convertirlos en drafts de quote posts. Accede a la sección de bookmarks vía browser headless, extrae posts recientes, y genera drafts con voz personal del usuario. No publica ni muta X — solo genera contenido para revisión. Trigger: X bookmarks, Twitter bookmarks, quote posts, bookmark automation, crear quote posts, revisar bookmarks, growth content X.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
work-unit-commits
Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.