Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Giving an AI agent a captcha tool over MCP: setup, spend limits and failure handling

Описание и применение

Автоматическое решение капчи для агента, работающего через MCP, с ограничением расходов и защитой от манипуляций страницей.

Задача

An AI agent driving a browser through MCP must solve captchas, but each solve costs money and the page can influence when the model calls the solver.

Результат

The agent can now solve captchas automatically while respecting spend limits and host restrictions, reducing manual intervention and preventing abuse.

Рабочий процесс

  • Check if a solver is needed by testing with dummy keys for Cloudflare Turnstile and reCAPTCHA v2/v3.
  • Configure MCP servers: add a browser server (e.g., Playwright) and a captcha solver server with environment variables for API key, spend limit, and allowed hosts.
  • Keep the API key in the server environment, not in tool arguments.
  • In the flow, read the sitekey and URL from the page, call the solve tool, and inject the returned token into the appropriate form field.
  • Implement a spend‑limit guard in the solver server code to reserve worst‑case cost, enforce host checks, and count each solve once.
  • Handle different failure modes (e.g., no key, over‑budget, disallowed host) by returning structured error responses.
  • Use Playwright’s browser_evaluate or custom injection patterns to set the token field or trigger callbacks.

Доказательства

Adding a solver tool takes a few lines of config.

Источник

Every successful call costs money, the model decides when to call it, and the page it is reading can try to influence that decision.

Источник

The guard does three things: it fails closed when no cap is set, it reserves a worst‑case price before calling so parallel solves can't overshoot, and it counts each task once.

Источник

  • Дата записи: 2026-11-04T02:14:01.318Z