Skip to content

使用AI大模型实现自然语言控制浏览器自动搜索

约 170 字小于 1 分钟

MCPLLMs

2025-04-07

环境搭建

  • 安装Playwright
pip install playwright
playwright install  # 自动安装浏览器驱动

用户客户端配置

Vscode Cline
  • 安装Cline插件
    alt text

  • 配置启动参数
    点击installed,打开配置文件 alt text

{
  "mcpServers": {
    "playwright": {
      "autoApprove": [
        "start_codegen_session",
        "end_codegen_session",
        "get_codegen_session",
        "clear_codegen_session",
        "playwright_navigate",
        "playwright_screenshot",
        "playwright_click",
        "playwright_iframe_click",
        "playwright_fill",
        "playwright_select",
        "playwright_hover",
        "playwright_evaluate",
        "playwright_console_logs",
        "playwright_close",
        "playwright_get",
        "playwright_post",
        "playwright_put",
        "playwright_patch",
        "playwright_delete",
        "playwright_expect_response",
        "playwright_assert_response",
        "playwright_custom_user_agent",
        "playwright_get_visible_text",
        "playwright_get_visible_html",
        "playwright_go_back",
        "playwright_go_forward",
        "playwright_drag",
        "playwright_press_key",
        "playwright_save_as_pdf"
      ],
      "disabled": true,
      "timeout": 60,
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@executeautomation/playwright-mcp-server"
      ],
      "transportType": "stdio"
    }
  }
}
  • 配置大模型API
alt text
alt text

效果展示

  • 执行自动化任务
    alt text