使用说明
Crawl4ai MCP服务器
一个MCP服务器,使用crawl4ai为LLM提供网络爬行功能,并带有markdown输出。
安装
先决条件
- Node.js
- 访问crawl4ai实例:https://docs.crawl4ai.com/core/docker-deployment/
设置
- 克隆存储库:
git clone https://github.com/Ichigo3766/crawl4ai-mcp.git
cd crawl4ai-server
- 安装依赖项:
npm install
- 构建服务器:
npm run build
- 将服务器配置添加到您的环境中:
{
"mcpServers": {
"crawl4ai": {
"command": "node",
"args": [
"/path/to/crawl4ai-server/build/index.js"
],
"env": {
"CRAWL4AI_API_URL": "http://127.0.0.1:11235",
"CRAWL4AI_AUTH_TOKEN": "your-auth-token" // Optional: if authentication is needed
}
}
}
}
将环境变量替换为您的值:
CRAWL4AI_API_URL:crawl4ai API服务的URL(可选)CRAWL4AI_AUTH_TOKEN:API的身份验证令牌(可选)
特性
工具
crawl_urls-抓取网页并获取带有引用的降价内容- 参数:
urls(必填):要爬网的URL列表
- 参数:
响应格式
该工具返回带有每个URL引用的markdown内容。多个URL由水平规则(---)分隔。例子:
This is content from the first URL [^1]
[^1]: https://example.com
---
This is content from the second URL [^2]
[^2]: https://example.org
发展
对于自动重建的开发:
npm run watch
错误处理
常见问题和解决方案:
- 确保URL有效且可访问
- 如果使用身份验证,请确保令牌有效
- 检查到crawl4ai API服务的网络连接
- 对于超时错误,请尝试减少每个请求的URL数量
- 如果被网站阻止,该服务将自动处理不同用户代理的重试
许可证
此MCP服务器根据MIT许可证获得许可。这意味着您可以根据MIT许可证的条款和条件自由使用、修改和分发软件。有关更多详细信息,请参阅项目存储库中的LICENSE文件。