Scrappey AI自动化服务器
一座桥梁,将人工智能模型与Scrappey的网络自动化平台连接起来的服务器,它允许创建浏览器会话、执行HTTP请求、自动化浏览器操作,同时处理反机器人保护。
服务介绍
Scrappey MCP 服务器
一个用于与Scrappey.com的网页自动化和抓取功能交互的模型上下文协议(MCP)服务器。您可以在smithery.ai/server/@pim97/mcp-server-scrappey直接尝试。
概述
此MCP服务器在AI模型与Scrappey的网页自动化平台之间提供了桥梁,使您可以:
- 创建和管理浏览器会话
- 通过Scrappey的基础架构发送HTTP请求
- 执行浏览器操作(点击、键入、滚动等)
- 自动处理各种反机器人保护
设置
- 从Scrappey.com获取您的Scrappey API密钥
- 设置您的环境变量:
SCRAPPEY_API_KEY=your_api_key_here
可用工具
1. 创建会话 (scrappey_create_session)
创建一个新的浏览器会话,该会话持久化cookie和其他状态。
{
"proxy": "http://user:pass@ip:port" // Optional: Custom proxy, leave empty for default
}
2. 销毁会话 (scrappey_destroy_session)
正确关闭一个浏览器会话。
{
"session": "session_id_here" // Required: The session ID to destroy
}
3. 发送请求 (scrappey_request)
通过Scrappey基础架构发送HTTP请求。
{
"cmd": "request.get", // Required: request.get, request.post, etc.
"url": "https://example.com", // Required: Target URL
"session": "session_id_here", // Required: Session ID to use
"postData": "key=value", // Optional: POST data
"customHeaders": { // Optional: Custom headers
"User-Agent": "custom-agent"
}
}
4. 浏览器操作 (scrappey_browser_action)
执行浏览器自动化操作。
{
"session": "session_id_here", // Required: Session ID to use
"browserActions": [ // Required: Array of actions to perform
{
"type": "click", // Action type: click, hover, type, scroll, wait
"cssSelector": ".button", // CSS selector for element
"text": "Hello", // Text to type (for type action)
"wait": 1000 // Wait time in ms
}
]
}
典型工作流程
- 创建一个会话:
{
"name": "scrappey_create_session"
}
- 使用返回的会话ID进行后续请求:
{
"name": "scrappey_request",
"cmd": "request.get",
"url": "https://example.com",
"session": "returned_session_id"
}
- 如果需要,执行浏览器操作:
{
"name": "scrappey_browser_action",
"session": "returned_session_id",
"browserActions": [
{
"type": "click",
"cssSelector": "#login-button"
},
{
"type": "type",
"cssSelector": "#username",
"text": "myuser"
}
]
}
- 完成后销毁会话以清理:
{
"name": "scrappey_destroy_session",
"session": "returned_session_id"
}
特性
- 会话持久化以保持状态
- 自动处理反机器人保护
- 支持自定义代理
- 浏览器自动化能力
- HTTP请求方法(GET, POST, PUT, DELETE, PATCH)
- 支持自定义头部和cookie
最佳实践
- 总是在使用完毕后销毁会话
- 在对同一网站进行多次请求时重用会话
- 在动作之间使用适当的等待时间以模拟更像人类的行为
- 在使用会话之前检查其是否存在
错误处理
当出现问题时,服务器将返回带有详细信息的错误消息。常见的错误包括:
- 无效的会话ID
- 网络超时
- 浏览器操作中选择器无效
- 反机器人保护失败
资源
许可证
MIT许可证