SC

sadiuysal/crawl4ai-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

118 stars 22 forks 质量 75 趋势 0MIT

sadiuysal/crawl4ai-mcp-server 是从 https://github.com/sadiuysal/crawl4ai-mcp-server. 导入的 MCP 服务器候选

概览

sadiuysal/crawl4ai-mcp-server 是从 https://github.com/sadiuysal/crawl4ai-mcp-server. 导入的 MCP 服务器候选

概述(AI 翻译)

🕷️ 一个轻量级模型上下文协议(MCP)服务器,将Crawl4AI的网页抓取和爬取功能作为AI代理的工具展示。

类似于 Firecrawl 的 API,但自托管且免费。非常适合将网页爬取集成到 AI 工作流程中,使用 OpenAI Agents SDK、Cursor、Claude Code 及其他兼容 MCP 的工具。

特色

  • ** 🔧 MCP 工具**:通过标准 MCP 服务器暴露 4 个强大工具:scrape、crawl、crawl_site、crawl_sitemap
  • ** 🌐 网页爬取**:单页抓取并进行降价提取
  • ** 🕷️ 网页爬行**:多页宽度优先爬行,带深度控制
  • ** 🧠 自适应爬行**:当收集足够内容时停止的智能爬行
  • ** 🛡️ 安全性**:屏蔽内部网络、本地主机和私有IP
  • ** 📱 Agent Ready**:支持 OpenAI Agents SDK、光标和 Claude 代码
  • ** ⚡ 快速**:由Playwright和Crawl4AI优化的提取驱动

🚀 快速启动

在Docker(推荐)和手动安装之间选择:

选项A:Docker (推荐) 🐳

Docker 消除了所有设置复杂性,提供了一致的环境:

选项A1:使用预构建镜像(最快) ⚡

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Crawl4AI MCP Server

🕷️ A lightweight Model Context Protocol (MCP) server that exposes Crawl4AI web scraping and crawling capabilities as tools for AI agents.

Similar to Firecrawl’s API but self-hosted and free. Perfect for integrating web scraping into your AI workflows with OpenAI Agents SDK, Cursor, Claude Code, and other MCP-compatible tools.

Features

  • 🔧 MCP Tools: Exposes 4 powerful tools: scrape, crawl, crawl_site, crawl_sitemap via stdio MCP server
  • 🌐 Web Scraping: Single-page scraping with markdown extraction
  • 🕷️ Web Crawling: Multi-page breadth-first crawling with depth control
  • 🧠 Adaptive Crawling: Smart crawling that stops when sufficient content is gathered
  • 🛡️ Safety: Blocks internal networks, localhost, and private IPs
  • 📱 Agent Ready: Works with OpenAI Agents SDK, Cursor, and Claude Code
  • ⚡ Fast: Powered by Playwright and Crawl4AI’s optimized extraction

🚀 Quick Start

Choose between Docker (recommended) or manual installation:

Docker eliminates all setup complexity and provides a consistent environment:

Option A1: Use Pre-built Image (Fastest) ⚡

# No setup required! Just pull and run the published image
docker pull uysalsadi/crawl4ai-mcp-server:latest

# Test it works
python test-config.py

# Use directly in MCP configurations (see examples below)

Option A2: Build Yourself

# Clone the repository
git clone https://github.com/uysalsadi/crawl4ai-mcp-server.git
cd crawl4ai-mcp-server

# Quick build and test (simplified)
docker build -f Dockerfile.simple -t crawl4ai-mcp .
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}}' | docker run --rm -i crawl4ai-mcp

# Or use helper script (full build with Playwright)
./docker-run.sh build
./docker-run.sh test
./docker-run.sh run

Docker Quick Commands:

  • ./docker-run.sh build - Build the image
  • ./docker-run.sh run - Run MCP server (stdio mode)
  • ./docker-run.sh test - Run smoke tests
  • ./docker-run.sh dev - Development mode with shell access

Option B: Manual Installation

# Clone and setup
git clone https://github.com/uysalsadi/crawl4ai-mcp-server.git
cd crawl4ai-mcp-server
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Install Playwright browsers
python -m playwright install chromium

# Test basic functionality
python -m crawler_agent.smoke_client

# Test adaptive crawling
python test_adaptive.py

Use with OpenAI Agents SDK

# Set your OpenAI API key
export OPENAI_API_KEY="your-key-here"

# Docker: Run the example agent
docker-compose run --rm -e OPENAI_API_KEY crawl4ai-mcp python -m crawler_agent.agents_example

# Manual: Run the example agent
python -m crawler_agent.agents_example
在 GitHub 查看完整 README

安装

docker run --rm -i --volume ./crawls:/app/crawls uysalsadi/crawl4ai-mcp-server:latest
新手?先看 mcpskill.org 教程 →

配置

// .mcp.json (project-scoped configuration) { "mcpServers": { "crawl4ai-mcp": { "command": "docker", "args": [ "run", "--rm", "-i", "--volume", "./crawls:/app/crawls", "uysalsadi/crawl4ai-mcp-server:latest" ], "env": { "CRAWL4AI_MCP_LOG": "INFO" } } } }