rea-captcha
Keep Browser Use tasks alive through CAPTCHA handoff by detecting challenges, coordinating authorized completion or human intervention, and resuming the same task.
Analyze page evidence (
captcha_analyze) from URL, title, HTML, text, or runtime signals without a browser adapter.Inspect a configured browser session (
captcha_inspect) for active verification challenges and get the handling policy.Complete authorized provider-test or owned-origin challenges (
captcha_complete) in the existing browser session and wait for fresh server-validated evidence.Wait/poll (
captcha_wait) for a challenge to clear or a bounded timeout to expire.Request a task-scoped human handoff (
captcha_handoff) bound to the current session/challenge generation.Verify and resume (
captcha_resume) the same task after the challenge clears, consuming the matching handoff once.Only for owned or explicitly authorized workflows; it does not bypass production interactive protection.
Allows detecting and completing Cloudflare Turnstile verification challenges within the agent's existing browser session, including authorized provider-test flows and fresh server-validated evidence.
Allows detecting and completing Google reCAPTCHA v2 verification challenges within the agent's existing browser session, including authorized provider-test flows and server-side validation.
When a Browser Use task hits a CAPTCHA halfway through, rea-captcha keeps the block and recovery inside the browser session the agent already owns. It detects supported verification challenges, coordinates an authorized action or human handoff, requires fresh server-validated evidence, and then returns control to the same task. It ships a TypeScript SDK, local stdio MCP server, browser-use plugin, Vercel-compatible Agent Skill, and optional authorized-origin local OCR.
Official source: install from
masakaai/rea-captchaand npm packagerea-captcha. The project has no hosted solver, telemetry, stealth claim, or dependency on Jet Browser. It reuses the agent's existing browser; the provider examples use documented non-production credentials only.
What the demo proves
These are complete agent-driven protected-action flows, not DOM-only fixtures. Each run detects a challenge, performs the authorized browser interaction in the same page, submits to the real validation boundary, observes fresh passed evidence, verifies the session cookie, and resumes the same controller. Google reCAPTCHA v2, Cloudflare Turnstile, and hCaptcha use their documented test modes plus vendor Siteverify endpoints; the owned image/text case uses an explicitly authorized local path and local server validation.
The first three cases load vendor-hosted JavaScript and accept the protected action only after the server receives success: true from the vendor verification endpoint. They use the vendors' documented non-production credentials: Google test keys, Cloudflare dummy keys, and hCaptcha test keys.
npm run demo:web # interactive local demo
npm run test:web-demo # all four live validation pathsRelated MCP server: kilogent-browser
Install
Browser Use
Install the version-aligned Python adapter from the verified release wheel:
python -m pip install 'rea-captcha[browser-use] @ https://github.com/masakaai/rea-captcha/releases/download/v0.3.1/rea_captcha-0.3.1-py3-none-any.whl'Attach the handoff guard to the Agent that already owns the browser session:
from rea_captcha import ChallengePlugin
challenge = ChallengePlugin(mode="local", human_handoff=True)
await challenge.attach(agent)The plugin borrows the agent's current BrowserSession; it does not launch or replace the browser. See the Browser Use handoff guide and complete example.
CI installs the supported Browser Use dependency and exercises the adapter against real Agent / BrowserSession pause-resume contracts; see the integration test.
MCP and coding agents
For local, stateless evidence analysis:
npx rea-captcha@0.3.1 mcp --statelessStateless mode does not control a browser. Same-session actions require a configured Playwright/CDP adapter; generate a host configuration with npx rea-captcha@0.3.1 agent-config --agent mcp-json.
Or ask Codex, Claude Code, Cursor, or another coding agent to wire the correct path for the project:
Install rea-captcha in this project and connect it to the browser session this agent already uses.How it works
MCP and coding agents
The official Registry entry is io.github.masakaai/rea-captcha and launches the zero-configuration stdio server through npm:
npx rea-captcha@0.3.1 mcp --statelessReview the pinned package version and approve npm's install prompt only when it matches the release you intend to run. The command does not suppress that prompt.
It exposes six tools: captcha_analyze, captcha_inspect, captcha_complete, captcha_handoff, captcha_wait, and captcha_resume. captcha_complete performs only a policy-authorized action in the configured existing browser and waits for fresh validation evidence. See the tool catalog for inputs and lifecycle semantics.
For a stateful local session, run setup and print a host configuration:
npx rea-captcha agent-config --agent codex
npx rea-captcha agent-config --agent mcp-jsonrea-captcha adds verification intelligence and bounded completion actions; it does not replace an agent's navigation tools. Both integrations must refer to the same browser session.
Hermes Agent users can inspect the Portable Agent Plugins v1 package. Its catalog-safe default is stateless evidence analysis; same-session browser actions still require an explicit stateful rea-captcha configuration.
TypeScript SDK
import { ChallengeController, ChallengePolicy } from 'rea-captcha';
import { PlaywrightChallengeAdapter } from 'rea-captcha/playwright';
const authorizedOrigin = 'https://fixture.example';
const controller = new ChallengeController({
browser: new PlaywrightChallengeAdapter({
id: 'checkout',
page,
agentActions: {
authorizedOrigins: [authorizedOrigin],
allowProviderTestAutomation: true,
submitSelector: 'button[type="submit"]'
}
}),
policy: new ChallengePolicy({
authorizedOrigins: [authorizedOrigin],
allowProviderTestAutomation: true
})
});
const inspection = await controller.inspect();
if (inspection.policy.decision === 'agent-action' || inspection.policy.decision === 'local-processing') {
await controller.complete({ timeoutMs: 30_000 });
await controller.resume();
} else if (inspection.policy.decision === 'human-handoff') {
const handoff = await controller.handoff({ taskId: 'checkout-run-42' });
await controller.wait({ timeoutMs: 120_000 });
await controller.resume({
taskId: 'checkout-run-42',
handoffId: handoff.handoff.id
});
}The controller borrows page; it does not create or close the browser. Human completion is a wake-up signal, not proof of success: the handoff identity is bound to the task, existing tab/session, and gate generation, and the controller still requires fresh evidence before consuming it once.
Browser providers
The recommended cross-agent provider is a browser already exposing CDP:
{
"version": 1,
"sessions": {
"local-chrome": {
"adapter": "playwright-cdp",
"endpoint": "http://127.0.0.1:9222",
"allowProviderTestAutomation": true,
"submitSelector": "button[type=submit]",
"authorizedOrigins": ["https://fixture.example"]
}
}
}Generic Playwright Page, Playwright-over-CDP, browser-use, and optional Jet Browser managed/standalone adapters are implemented. Jet Browser must be selected explicitly and is neither installed nor started by the default path. Configuration examples and provider boundaries are documented in architecture and cases.
browser-use and local OCR
The Python adapter is not published on PyPI yet, so an unqualified pip install rea-captcha will not work. The pinned wheel is built from the v0.3.1 tag, smoke-tested in GitHub Actions, and attached to the corresponding release.
For agent-driven completion, point rea-captcha's Playwright/CDP session at the same existing browser used by browser-use. The MCP lifecycle detects the block, performs an authorized action, verifies the result, and returns control without replacing the browser or task context.
The Python plugin shown in Install remains a lightweight detection and manual-recovery fallback for browser-use integrations that do not expose a compatible CDP action surface.
Local ddddocr is an optional primitive only for simple image/text challenges on an exact authorized origin. It is disabled unless both allowLocalImageText and authorizedOrigins are configured. No model weights are redistributed, and an OCR prediction remains untrusted evidence.
What is implemented
Evidence detection for reCAPTCHA, hCaptcha, Turnstile, GeeTest, DataDome, PerimeterX, AWS WAF, image/text inputs, and generic verification pages.
Deterministic states with bounded timeout, cancellation, and fresh-evidence resume checks.
Six stdio MCP tools, CLI/MCP parity, TypeScript SDK, browser-use hooks, and a Vercel-compatible Agent Skill.
Borrowed Playwright/CDP sessions plus optional Jet Browser adapters.
Local JSONL events with explicit ownership and no telemetry.
npm Trusted Publishing/provenance workflow and GitHub OIDC publication to the official MCP Registry.
Documentation
Community
Ask integration questions and share same-session agent examples in GitHub Discussions. For real-time chat, join the MASAKA Discord and use the dedicated #rea-captcha channel. Use GitHub Issues for reproducible bugs and follow the private security policy for vulnerabilities. Never post browser profiles, cookies, challenge tokens, API keys, or private page evidence.
Scope and disclaimer
rea-captcha is for owned or explicitly authorized workflows. Provider automation is accepted only when the adapter confirms the vendor's documented non-production test key. It does not bypass production interactive protection. Commercial solver APIs, credential transfer, stealth claims, and automatic completion of third-party production challenges are outside scope.
Inspired by morluto/rea.
License
Core code and integrations are MIT licensed. Optional dependencies and model artifacts keep their own terms; see Third-party notices and model licenses.
Available Tools
6 toolscaptcha_analyzeAnalyze page evidenceBRead-only
Analyze URL, title, HTML, text, or runtime signals already available to the calling agent. This read-only tool needs no configured browser adapter and does not control or preserve a browser session.
Inputs: url (required), html, text, title, +1 more.
captcha_completeComplete authorized verificationC
Let the agent complete an authorized provider-test or owned-origin challenge in the existing browser session, then wait for fresh server-validated evidence.
Inputs: session_id (required), poll_ms, timeout_ms.
captcha_handoffRequest human handoffC
Bind the current challenge to a caller-owned task and create a generation-scoped human handoff in the existing browser session.
Inputs: task_id (required), session_id (required).
captcha_inspectInspect verification challengeARead-only
Inspect a configured browser session for an active verification challenge and return evidence plus the handling policy.
Inputs: session_id (required).
captcha_resumeVerify and resumeA
Consume the matching task-scoped handoff once, re-inspect the existing browser session, and resume only after the current challenge is clear.
Inputs: session_id (required), task_id, handoff_id.
captcha_waitWait for verificationBRead-only
Poll the same browser session until its verification challenge clears or the bounded timeout expires.
Inputs: session_id (required), poll_ms, timeout_ms.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools are clearly distinct: handoff/resume form a clear pair, wait and complete target different outcomes. However, inspect and analyze both diagnose challenges (differing mainly by whether a browser session is used vs agent-supplied data), and complete vs resume could be blurred since both act on an existing session to move past a challenge.
All six tools use a consistent captcha_<verb> snake_case pattern (inspect, analyze, complete, handoff, resume, wait). The convention is predictable and readable throughout.
Six tools is well-scoped for a captcha-handling server, with each tool mapping to a distinct lifecycle stage (inspect, analyze, complete, handoff, resume, wait). No filler or redundant tools.
The surface covers a full challenge lifecycle: detection (inspect/analyze), resolution (complete), escalation (handoff), recovery (resume), and waiting (wait). Minor gaps like no explicit configuration/setup or detection-only tool, but the core end-to-end flow is covered.
Maintenance
Related MCP Connectors
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Browser automation MCP for whole web tasks in a cloud browser: saved logins, bot checks, replays.
Related MCP Servers
- AlicenseBqualityDmaintenanceA universal browser automation MCP server using Playwright, enabling programmatic control of Chrome with 63 tools for navigation, interaction, media control, and CDP-based diagnostics.6313 npm3MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that lets agents drive your real Chrome browser with existing logins and sessions via an outbound-only WebSocket extension. It exposes Playwright-compatible browser tools for navigation, clicking, typing, and snapshots.1Apache 2.0
- AlicenseAqualityAmaintenanceMCP server that drives your real Chrome/Edge/Opera browser through a Chrome extension and DevTools Protocol, preserving logins and session state, and can also perform OS-level mouse and keyboard input behind approval.5177 PyPI2MIT
- AlicenseNot gradedqualityAmaintenanceThis server enables MCP clients and AI agents to perform browser automation with Playwright-compatible tools, persistent profiles, extensions, proxy support, and humanized interactions. It can be run via npm or Docker over stdio or Streamable HTTP for web research, automation, testing, and regional QA.297 npmMIT