WebcrawlerAPI MCP服务器
WebcrawlerAPI 是一个强大的网络抓取和网站爬行服务,允许您轻松地从任何网站提取数据。
此MCP(模型上下文协议)服务器将WebcrawlerAPI的抓取功能直接集成到与MCP兼容的应用程序(如Claude Code)中,从而实现了AI工作流中的集成。在开始使用您的免费API密钥 WebcrawlerAPI仪表板.
设置
- 从获取API密钥 WebcrawlerAPI仪表板
- 设置环境变量:
export WEBCRAWLER_API_KEY="your-api-key-here"使用Claude代码
使用npx将此服务器添加到您的Claude Code配置中:
npx webcrawler-mcp或者添加到MCP设置配置中:
{
"mcpServers": {
"webcrawler": {
"command": "npx",
"args": ["-y", "webcrawler-mcp"],
"env": {
"WEBCRAWLER_API_KEY": "your-api-key-here"
}
}
}
}可用工具
webcrawler刮
从任何网页中抓取内容并将其作为markdown返回。
参数:
url(必填):要抓取的网页的URLprompt(可选):从页面提取特定信息的可选提示
示例用法:
Use the webcrawler-scrape tool to get the content from https://example.com提示进行目标提取:
Use the webcrawler-scrape tool to scrape https://news.ycombinator.com with the prompt "Extract all article titles and their corresponding URLs"该工具将抓取的内容作为markdown返回,同时返回页面标题和HTTP状态代码。当使用提示时,API将重点提取您请求的特定信息。
作为独立应用程序运行
您还可以将服务器作为独立应用程序运行:
通过npm
npm install
npm run build
npm start通过npx
npx webcrawler-mcpHTTP模式
要在HTTP模式而不是stdio下运行,请执行以下操作:
USE_HTTP=true npx webcrawler-mcp
# or
npm run start:http默认情况下,HTTP服务器将在端口8080上启动,端点为:
- 健康检查:
http://localhost:8080/health - MCP端点:
http://localhost:8080/mcp
环境变量
WEBCRAWLER_API_KEY:您的WebcrawlerAPI.com API密钥(必需)USE_HTTP:设置为“true”以使用HTTP传输而不是stdioPORT:HTTP服务器端口(默认值:8080)
发展
npm install
npm run dev # Watch mode
npm run build