web.stagehand | Version: 1.1.0 | Tools: 9
The web.stagehand plugin exposes a full Playwright-backed browser as MCP tools. Stagehand runs on port 3002 and is managed as a PM2 process (stagehand-server). The plugin is the primary mechanism for scraping platform statistics, performing HITL-assisted logins, and extracting fan data from platforms that block headless clients.
Session lifecycle
All tools exceptstart-session require a session_id. Sessions are stateful: cookies, DOM state, and navigation history persist within a session until close-session is called.
Tools
start-session — launch a browser
Launches a new Playwright browser instance on the Stagehand server. Returns a session_id that must be passed to all subsequent tool calls in this session.
Browser launches with:
--no-sandbox(required for Docker/non-root)--disable-blink-features=AutomationControlled(reduces bot detection)- 1920×1080 viewport
navigate — go to a URL
Navigates the browser to a URL and waits for the page to reach a stable state. Returns the final URL (post-redirect) and page title.
act — natural language browser action
Performs a natural-language browser action using Stagehand’s AI-driven interaction layer. The model interprets the instruction and maps it to concrete Playwright actions (click, type, scroll, select, etc.).
STAGEHAND_MODEL (default: ollama/qwen-2.5).
extract — structured data from page
Extracts structured data from the current page based on a natural-language instruction and an optional JSON schema. Returns a typed object.
observe — analyze interactive elements
Returns a list of interactive elements currently visible on the page — buttons, inputs, links, and their bounding boxes. Use this before act when the correct action target is ambiguous.
screenshot — capture current page
Takes a full-page screenshot of the current session state. Returns a base64-encoded PNG. Useful for debugging stuck sessions or documenting the state at HITL escalation points.
get-cookies / set-cookies — session rehydration
get-cookies retrieves all cookies from the current session. set-cookies injects a cookie array into the session, bypassing the login flow entirely.
This pair is the primary mechanism for platform session rehydration: encrypted cookie blobs stored in the platform_sessions Directus collection are decrypted by the server and injected via set-cookies before navigating to a platform. The agent lands in an already-authenticated state without replaying the login form.
close-session — terminate and clean up
Ends a browser session and releases all associated resources (Playwright browser, page, network interceptors). Should always be the final call in any browser task.
Use cases
Scraping platform stats
Navigate to OnlyFans or Fansly analytics pages, extract subscriber counts, earnings, and post performance metrics. Store results in
scraped_media or creator_profiles via cms.directus tools.HITL login flows
When a platform blocks headless Chrome or requires 2FA, the agent escalates to HITL mode: session is paused, a
hitl_sessions record is created, and the human creator completes the login manually. Once confirmed, the agent calls get-cookies to capture the authenticated session and stores it encrypted in platform_sessions.Fan data extraction
Extract fan profile data, tip history, and message threads from platform pages. Structure the output with
extract and store via cms.directus tools.Post verification
After a
publish_post BullMQ job completes, navigate to the post URL and verify it is live, correctly captioned, and properly priced.HITL escalation flow
When a platform actively blocks headless Chrome (Cloudflare bot detection, device fingerprint challenges, SMS 2FA), the agent switches toscrape_alert mode:
Configuration
| Setting | Value |
|---|---|
| Stagehand URL | http://127.0.0.1:3002 (configurable via STAGEHAND_URL) |
| Model | STAGEHAND_MODEL env (default: ollama/qwen-2.5) |
| Timeout | 60,000 ms |
| Concurrency | 3 simultaneous sessions |
| Viewport | 1920×1080 |