CrewAI
Framework for orchestrating AI agent teams. Equip your CrewAI agents with Scrapfly web scraping capabilities for autonomous data collection and research tasks.
Prerequisites
Before getting started, make sure you have the following:
- Python 3.10+ installed
crewaiandcrewai-toolspackages installed- Your Scrapfly API key (only if not using OAuth2)
Setup Instructions
CrewAI supports MCP tools through the tools integration. Follow these steps to equip your agent crew with Scrapfly capabilities.
-
Install Required Packages
Install CrewAI and the tools package with MCP support:
Tip: Virtual Environment
Use a virtual environment to manage dependencies:
-
Initialize Scrapfly MCP Tools
Select your preferred authentication method:
How it works: Your application displays an OAuth2 URL in the console. Open it in your browser to authorize - happens once, then managed automatically. See project-scoped setup for team collaboration.Sign up for free to get your API key. -
Create Agents with Scrapfly Tools
Build a CrewAI agent equipped with web scraping capabilities:
Pro Tip: The agent will automatically callscraping_instruction_enhancedto get required parameters before scraping! -
Build a Multi-Agent Crew
Create a team of agents that collaborate on web scraping and data analysis:
Example Prompts
Competitive Intelligence Crew
Content Aggregation Workflow
Market Research Team
Research Assistant Crew
Troubleshooting
Problem: ModuleNotFoundError: No module named 'crewai_tools'
Solution:
- Install the package:
pip install crewai-tools - Verify Python environment:
which python - Try upgrading:
pip install --upgrade crewai crewai-tools - Check Python version is 3.10+:
python --version
Problem: MCPTool cannot execute npx command
Solution:
- Ensure Node.js 18+ is installed:
node --version - Verify
npxis in PATH:npx --version - Restart terminal after installing Node.js
- Try full path:
command="/usr/local/bin/npx"
Problem: OAuth2 browser window cannot open in server/CI environment
Solution:
- Use API key authentication for production deployments
- Store API key in environment variable:
SCRAPFLY_API_KEY - Load from environment:
args=["mcp-remote", f"https://mcp.scrapfly.io/mcp?key={os.getenv('SCRAPFLY_API_KEY')}"]
Problem: Agent does not call Scrapfly tools when assigned scraping tasks
Solution:
- Verify tools loaded:
print([tool.name for tool in scrapfly_tools]) - Check agent has tools assigned:
tools=scrapfly_toolsin Agent creation - Use explicit task descriptions mentioning "scrape" or "web data"
- Enable verbose mode:
verbose=Trueto see agent reasoning
Problem: Crew execution hangs or times out during scraping
Solution:
- Check network connectivity to
https://mcp.scrapfly.io/mcp - Verify target URLs are accessible
- Increase task timeout if scraping large pages
- Enable verbose mode to see where execution stalls
Next Steps
- Explore available MCP tools and their capabilities
- See real-world examples of what you can build
- Learn about authentication methods in detail
- Read the FAQ for common questions