Firecrawl Agent - 基于MCP的高级网络爬虫 欢迎使用Firecrawl MCP Agent!这款强大的代理展示了如何通过模型上下文协议(MCP)将Firecrawl的高级网络爬虫功能与Google ADK集成。 您将学到的内容 Firecrawl集成:连接到Firecrawl全面的网络爬虫平台 高级网络爬虫:单页面、批量处理和全网站爬取 AI驱动的数据提取:利用大语言模型从网页内容中提取结构化数据 研究能力:进行多源分析的深度网络研究 实际应用:数据提取与研究的实用案例 核心功能 全面工具集 单页面爬虫:从单个URL中提取内容,支持高级选项 批量处理:高效地并行爬取多个URL 网站映射:发现网站上的所有URL以供探索 网络搜索:搜索网络并从结果中提取内容
欢迎使用Firecrawl MCP Agent!这款强大的代理展示了如何通过模型上下文协议(MCP)将Firecrawl的高级网络爬虫功能与Google ADK集成。
Node.js:Firecrawl MCP服务器所需
# Install Node.js if not already installed # Visit https://nodejs.org/ for installation instructions
Firecrawl API密钥:从Firecrawl.dev获取您的API密钥
# Set your API key as an environment variable export FIRECRAWL_API_KEY=your_api_key_here
Google ADK依赖:确保您已安装所需的软件包
pip install -r ../requirements.txt
# Set your Firecrawl API key export FIRECRAWL_API_KEY=fc-your_api_key_here # Optional: Configure retry settings export FIRECRAWL_RETRY_MAX_ATTEMPTS=5 export FIRECRAWL_RETRY_INITIAL_DELAY=2000
# From the tutorials root directory pip install -r requirements.txt
# From the tutorials root directory adk web
然后从下拉菜单中选择firecrawl_mcp_agent。
User: "Scrape the homepage of https://example.com" Agent: Uses firecrawl_scrape to extract clean content in Markdown format
User: "Extract content from these three articles: [url1, url2, url3]" Agent: Uses firecrawl_batch_scrape for efficient parallel processing
User: "Find all blog post URLs on https://blog.example.com" Agent: Uses firecrawl_map to discover and list all available URLs
User: "Search for research papers on AI Agents in the last 4 weeks and extract key information" Agent: Uses firecrawl_search to find relevant papers and extract summaries
User: "Extract product details (name, price, description) from this e-commerce page" Agent: Uses firecrawl_extract with custom schema for structured data
User: "Perform comprehensive research on sustainable energy technologies" Agent: Uses firecrawl_deep_research for multi-source analysis and synthesis
User: "Crawl the documentation section of https://docs.example.com" Agent: Uses firecrawl_crawl with appropriate depth and filtering
| 工具 | 目的 | 最佳适用场景 |
|---|---|---|
firecrawl_scrape |
Single page extraction | Known URLs, specific pages |
firecrawl_batch_scrape |
Multiple URL processing | Lists of URLs, parallel extraction |
firecrawl_map |
URL discovery | Exploring site structure |
| Tool | Purpose | Best For |
|---|---|---|
firecrawl_search |
Web search + extraction | Finding relevant content |
firecrawl_crawl |
Full site crawling | Comprehensive site analysis |
firecrawl_extract |
Structured data extraction | Specific data points |
firecrawl_deep_research |
Multi-source research | Complex research tasks |
| Tool | Purpose | Best For |
|---|---|---|
firecrawl_generate_llmstxt |
LLMs.txt generation | AI interaction guidelines |
firecrawl_check_crawl_status |
Monitor crawl progress | Long-running operations |
firecrawl_check_batch_status |
Monitor batch progress | Batch operation tracking |
firecrawl_scrapefirecrawl_batch_scrapefirecrawl_map firstfirecrawl_searchfirecrawl_extractfirecrawl_deep_researchfirecrawl_crawl (with limits)onlyMainContent: true 提取干净内容# Example configuration for scrape operations { "formats": ["markdown"], # Output format "onlyMainContent": True, # Extract main content only "waitFor": 1000, # Wait time for page load "timeout": 30000, # Request timeout "mobile": False, # Use mobile rendering "includeTags": ["article", "main"], # Include specific HTML tags "excludeTags": ["nav", "footer"] # Exclude specific HTML tags }
# Example batch configuration { "maxUrls": 50, # Maximum URLs to process "parallelLimit": 5, # Parallel processing limit "options": { "formats": ["markdown"], "onlyMainContent": True } }
# Example crawl configuration { "maxDepth": 2, # Crawl depth limit "limit": 100, # Maximum pages to crawl "allowExternalLinks": False, # Stay within domain "deduplicateSimilarURLs": True # Remove duplicate content }
连接错误
# Check Node.js installation node --version # Test Firecrawl MCP server npx -y firecrawl-mcp
API密钥问题
# Verify API key is set echo $FIRECRAWL_API_KEY # Test API key validity curl -H "Authorization: Bearer $FIRECRAWL_API_KEY" https://api.firecrawl.dev/v1/scrape
工具未找到
# Test MCP server connection npx @modelcontextprotocol/inspector # Run agent with debug output adk web --debug
免责声明:
本文档采用基于机器的 AI 翻译服务进行翻译。尽管我们力求准确,但请注意,自动翻译可能存在错误或不准确之处。应以原文语言版本的原始文档作为权威依据。如需获取关键信息,建议使用专业的人工翻译。对于因使用本翻译而产生的任何误解或误读,我们概不负责。