Patchright 是一个精简的模型上下文协议(MCP)服务器,它封装了 Patchright Node.js SDK,能为 AI 模型赋予浏览器自动化能力。该项目聚焦于实现浏览器自动化任务,同时巧妙避免被目标网站检测。
# 克隆仓库到本地
git clone https://github.com/your-repository.git
cd patchright-mcp
# 安装依赖项
npm install
# 构建项目
npm run build
# 启动 MCP 服务器
npm start
# 克隆仓库到本地
git clone https://github.com/your-repository.git
cd patchright-mcp
# 安装依赖项
npm install
# 构建项目
npm run build
# 启动 MCP 服务器
npm start
// 启动浏览器并访问页面
await page.load('https://example.com');
// 模拟用户输入
await page.type('#searchInput', 'test');
await page.click('#submitBtn');
// 避免检测的属性设置
document.addEventListener('DOMContentLoaded', function() {
console.log(window);
});
在 config.json 中添加以下内容:
{
"mcp": {
"serverUrl": "http://localhost:3000"
}
}
安装 Model Context Protocol 插件,配置如下:
{
"modelContextProtocol": {
"servers": [
{
"url": "http://localhost:3000",
"label": "Patchright MCP Server"
}
]
}
}
docker run -it --rm dylangroos/patchright-mcp
docker build -t patchright-mcp .
docker run -it --rm patchright-mcp
最新版本已自动发布至 Docker Hub,访问地址:dylangroos/patchright-mcp
Patchright 是 Playwright 的未被检测到版本,专为规避检测设计。它通过修复多种检测技术(如 Runtime.enable 泄漏、Console.log 满足等)实现隐身效果。
本项目采用 MIT 许可证,具体内容见 LICENSE 文件。
感谢以下项目的贡献:
⚠️ 重要提示
请遵守相关法律法规,责任自负,避免滥用技术进行非法活动。
💡 使用建议
不要过度自动化,以免影响网站服务。