← Back to Blog
·6 min read·GateSolve Team

Solve CAPTCHAs in browser-use with MCP (Zero Custom Code)

Your browser-use agent is cruising through a task, then hits a Cloudflare Turnstile. Game over — unless you have a CAPTCHA solver wired in. Here is how to add one with zero custom code using MCP.

The Problem: Agents Cannot Solve CAPTCHAs Themselves

Browser automation frameworks like browser-use (83K+ stars) give AI agents the ability to browse the web. But Cloudflare, Google, and hCaptcha detect automated browsers through CDP fingerprinting, binding injection, and hardware signals. Your agent's browser is flagged before the CAPTCHA even renders.

Stealth plugins help with basic bot detection, but CAPTCHAs are a different layer. The challenge is designed to block exactly what your agent is: an automated process on a datacenter IP with a headless browser fingerprint.

The Solution: MCP + Async Solver

Model Context Protocol (MCP) lets AI agents discover and use tools without custom integration code. GateSolve publishes an MCP server that exposes solve_captcha as a tool. When your agent hits a CAPTCHA, it calls the tool, gets a token back, and continues.

The solve happens in a completely separate browser environment — different IP, different fingerprint, no CDP detection. Your agent never touches the CAPTCHA challenge directly.

Architecture

Agent (browser-use / Claude / custom)
  │
  ├── Detects CAPTCHA on page
  │
  ├── Calls solve_captcha via MCP protocol
  │       │
  │       └── GateSolve MCP Server (local stdio process)
  │               │
  │               └── GateSolve API (async solve)
  │                       │
  │                       └── Dedicated solver (Camoufox, clean IP)
  │                               │
  │                               └── Returns valid token
  │
  └── Injects token into page, continues task

Setup: 2 Minutes

Step 1: Install the MCP Server

npm install -g @gatesolve/mcp-server

Step 2: Add to Your MCP Config

Add GateSolve to your MCP configuration file. This works with Claude Desktop, browser-use, Cursor, Windsurf, or any MCP-compatible client:

{
  "mcpServers": {
    "gatesolve": {
      "command": "npx",
      "args": ["@gatesolve/mcp-server"],
      "env": {
        "GATESOLVE_API_KEY": "gs_your_key"
      }
    }
  }
}

Step 3: There Is No Step 3

Your agent now has access to solve_captcha. When it encounters a CAPTCHA during browsing, the LLM can call the tool, receive a token, and inject it into the page. No polling loops, no HTTP client setup, no auth header management.

How It Works With browser-use

browser-use has native MCP support via register_mcp_tools(). Once registered, GateSolve's solve_captcha becomes an available agent action:

from browser_use import Agent
from langchain_openai import ChatOpenAI

# browser-use natively discovers MCP tools
# Once registered, solve_captcha becomes an available action
agent = Agent(
    task="Go to example.com and complete the form",
    llm=ChatOpenAI(model="gpt-4o"),
)
result = await agent.run()

Under the Hood

// What happens under the hood when the agent hits a CAPTCHA:
// 1. Agent detects CAPTCHA challenge on the page
// 2. Agent calls solve_captcha via MCP
// 3. GateSolve solves it asynchronously (separate browser, clean IP)
// 4. Token returned to agent
// 5. Agent injects token and continues

{
  "tool": "solve_captcha",
  "arguments": {
    "url": "https://example.com/login",
    "type": "turnstile",
    "sitekey": "0x4AAAA..."
  }
}
// Returns: { "token": "0.Abc123...", "solve_time_ms": 8400 }

MCP vs Manual API: Why It Matters

You could integrate GateSolve's REST API directly. But MCP changes the integration model fundamentally:

Manual API Approach

# The old way: manual API calls in your agent code
import httpx, time

# Submit solve request
resp = httpx.post("https://gatesolve.dev/api/solve", json={
    "url": "https://example.com",
    "type": "turnstile",
    "sitekey": "0x4AAAA..."
}, headers={"Authorization": "Bearer gs_your_key"})
job_id = resp.json()["id"]

# Poll for result (you have to build this loop)
while True:
    result = httpx.get(f"https://gatesolve.dev/api/solve?id={job_id}",
        headers={"Authorization": "Bearer gs_your_key"})
    if result.json()["status"] == "completed":
        token = result.json()["token"]
        break
    time.sleep(2)

MCP Approach

# The MCP way: one tool call, agent handles the rest
# No polling loop. No HTTP client. No auth header management.
# The LLM just calls solve_captcha when it sees a CAPTCHA.

# In your MCP config (claude_desktop_config.json, etc.):
# "gatesolve": { "command": "npx", "args": ["@gatesolve/mcp-server"] }

# That is it. The agent discovers and calls the tool automatically.

The difference:

  • Zero integration code — the MCP server handles auth, polling, and error handling
  • Agent-native — the LLM decides when to call solve_captcha based on what it sees on the page
  • Portable — same MCP config works across Claude Desktop, browser-use, Cursor, n8n, and any MCP client
  • Discoverable — listed on the official MCP Registry as io.github.arsonx-dev/gatesolve-mcp

Supported Frameworks

FrameworkMCP SupportIntegration Method
browser-useNativeregister_mcp_tools()
Claude DesktopNativeclaude_desktop_config.json
Cursor / WindsurfNativeMCP settings panel
n8nVia nodeMCP community node
Custom agentsAny MCP clientstdio or HTTP transport

Why Not Just Use a Stealth Browser?

Stealth browsers (Playwright with stealth plugin, Puppeteer with puppeteer-extra) help avoid basic bot detection. But CAPTCHAs are triggered after detection, and modern challenges like Turnstile run behavioral analysis that stealth plugins cannot fake.

More importantly, solving a CAPTCHA in your agent's browser means your agent's fingerprint is the one being evaluated. GateSolve solves the CAPTCHA in a completely separate environment with a clean fingerprint and residential-grade detection profile. Your agent just receives the token.

Get Started

GateSolve offers 100 free solves per API key. No credit card required.

  1. Sign up at gatesolve.dev
  2. Get your API key
  3. Add the MCP config above
  4. Your agent can now solve CAPTCHAs

Already using 2Captcha or CapSolver? GateSolve's MCP server is a drop-in addition — no need to remove existing integrations. Try it alongside and compare.


GateSolve is listed on the official MCP Registry as io.github.arsonx-dev/gatesolve-mcp. Install with npm install -g @gatesolve/mcp-server or pip install gatesolve for the Python SDK.