← Back to Blog
·5 min read·GateSolve Team

Solve CAPTCHAs in CrewAI with MCP (No Composio Required)

CrewAI has native MCP support. GateSolve has an MCP server. Put them together and your crew can solve CAPTCHAs without a single line of custom integration code.

The Problem

Your CrewAI agent needs to scrape a site, fill a form, or access data behind a Cloudflare Turnstile challenge. The agent hits the CAPTCHA and stops. You need a CAPTCHA solver, but wiring up API calls inside CrewAI tools is tedious and brittle.

2Captcha solved this by getting listed on Composio, so CrewAI users can install it as a connected MCP. But Composio adds a dependency layer. CrewAI already supports MCP servers natively — you can skip the middleware.

The Solution: GateSolve MCP + CrewAI

CrewAI's mcps field on agents accepts MCP servers directly. GateSolve's MCP server (@gatesolve/mcp-server) exposes solve_captcha and detect_captcha as tools. Connect them and the LLM handles the rest.

Option 1: Structured Config (Recommended)

from crewai import Agent, Task, Crew
from crewai.mcp import MCPServerStdio

# Create an agent with GateSolve MCP tools
scraper = Agent(
    role="Web Scraper",
    goal="Extract data from CAPTCHA-protected pages",
    backstory="Expert scraper that handles CAPTCHAs automatically",
    mcps=[
        MCPServerStdio(
            command="npx",
            args=["-y", "@gatesolve/mcp-server"],
            env={"GATESOLVE_API_KEY": "gs_your_key_here"}
        )
    ]
)

# The agent now has solve_captcha and detect_captcha tools
task = Task(
    description="""Go to https://example.com/protected-page.
    If there is a CAPTCHA, detect its type and solve it.
    Then extract the main content.""",
    agent=scraper,
    expected_output="Extracted page content"
)

crew = Crew(agents=[scraper], tasks=[task])
result = crew.kickoff()
print(result)

Option 2: String Reference (Quick Setup)

If you prefer the DSL approach, you can reference the MCP server directly — though you'll need the server running locally or via a remote endpoint:

scraper = Agent(
    role="Web Scraper",
    goal="Scrape CAPTCHA-protected sites",
    backstory="Handles CAPTCHAs via GateSolve",
    mcps=[
        MCPServerStdio(
            command="npx",
            args=["-y", "@gatesolve/mcp-server"],
            env={"GATESOLVE_API_KEY": "gs_your_key_here"}
        )
    ]
)

What Tools Does the Agent Get?

When you connect @gatesolve/mcp-server, the agent automatically discovers two tools:

  • solve_captcha — Submit a CAPTCHA for solving. Pass the URL, CAPTCHA type (turnstile, recaptcha, hcaptcha), and siteKey. Returns the solution token.
  • detect_captcha — Detect what type of CAPTCHA a URL has before attempting to solve. Returns the type and siteKey.

The LLM decides when to call each tool based on the task description. No hardcoded logic needed.

Multi-Agent Crews

CrewAI shines with multi-agent workflows. You can give the CAPTCHA solver to one specialist agent and let others focus on their tasks:

from crewai import Agent, Task, Crew
from crewai.mcp import MCPServerStdio

gatesolve_mcp = MCPServerStdio(
    command="npx",
    args=["-y", "@gatesolve/mcp-server"],
    env={"GATESOLVE_API_KEY": "gs_your_key_here"}
)

# Agent 1: Handles CAPTCHAs
unblocker = Agent(
    role="CAPTCHA Unblocker",
    goal="Detect and solve CAPTCHAs on target URLs",
    backstory="Specialist in bypassing web protections",
    mcps=[gatesolve_mcp]
)

# Agent 2: Extracts data (no CAPTCHA tools needed)
extractor = Agent(
    role="Data Extractor",
    goal="Extract structured data from web pages",
    backstory="Expert at parsing HTML and extracting information"
)

# Agent 3: Analyzes results
analyst = Agent(
    role="Data Analyst",
    goal="Analyze extracted data and produce insights",
    backstory="Expert data analyst"
)

# Chain tasks
solve_task = Task(
    description="Check https://example.com for CAPTCHAs and solve them",
    agent=unblocker,
    expected_output="CAPTCHA solution token or confirmation page is accessible"
)

extract_task = Task(
    description="Extract pricing data from the unblocked page",
    agent=extractor,
    expected_output="Structured pricing data"
)

analyze_task = Task(
    description="Analyze pricing trends from extracted data",
    agent=analyst,
    expected_output="Pricing analysis report"
)

crew = Crew(
    agents=[unblocker, extractor, analyst],
    tasks=[solve_task, extract_task, analyze_task]
)
result = crew.kickoff()

Why MCP Over Manual API Calls?

Manual APIMCP
SetupWrite custom CrewAI tool classAdd to mcps list
Tool discoveryHardcoded functionAutomatic via MCP protocol
UpdatesModify tool codenpx always gets latest
Multi-frameworkRewrite for each frameworkSame MCP server everywhere

Get Started

  1. Get a free API key at gatesolve.dev — 100 free solves, no credit card
  2. Install CrewAI: pip install crewai crewai-tools
  3. Add the MCP server to your agent's mcps config
  4. Run your crew — the agent handles CAPTCHAs automatically

Supported CAPTCHA types: Cloudflare Turnstile, reCAPTCHA v2/v3, and hCaptcha. Average solve time: ~12 seconds.

Compare: GateSolve vs 2Captcha via Composio

  • 2Captcha + Composio: Install Composio SDK → connect 2Captcha → import toolkit → wrap as CrewAI tools. Three dependencies, Composio account required.
  • GateSolve MCP: Add MCPServerStdio to agent mcps list. One dependency (npx), no middleware account.

Both work. GateSolve is a shorter path with fewer moving parts. Plus 100 free solves to test before committing.