Skip to main content
Glama

Browser Automation MCP Server

by Raghu6798

🤖 浏览器自动化代理

一款基于 MCP(模型控制程序)构建的强大浏览器自动化工具,它将网页抓取功能与 LLM 驱动的智能技术相结合。该代理可以搜索 Google、导航网页,并智能地从各种网站(包括 GitHub、Stack Overflow 和文档网站)抓取内容。

🚀 功能

  • 🔍 Google 搜索集成:查找并检索任何查询的热门搜索结果
  • 🕸️ 智能网页抓取:针对不同网站类型定制抓取策略:
    • 📂 GitHub 存储库
    • 💬 Stack Overflow 问答
    • 📚 文档页面
    • 🌐 通用网站
  • 🧠 人工智能处理:使用 Mistral AI 理解和处理抓取的内容
  • 🥷 隐身模式:实施浏览器指纹保护以避免被发现
  • 💾 内容保存:自动保存从抓取页面截取的屏幕截图和文本内容

🏗️ 建筑

该项目采用由 MCP 提供支持的客户端-服务器架构:

  • 🖥️ 服务器:处理浏览器自动化和网页抓取任务
  • 👤 客户端:使用 Mistral AI 和 LangGraph 提供 AI 接口
  • 📡 通信:使用 stdio 进行客户端-服务器通信

⚙️ 要求

  • 🐍 Python 3.8+
  • 🎭 剧作家
  • 🧩 MCP(模型控制程序)
  • 🔑 Mistral AI API 密钥

📥 安装

  1. 克隆存储库:
git clone https://github.com/yourusername/browser-automation-agent.git cd browser-automation-agent
  1. 安装依赖项:
pip install -r requirements.txt
  1. 安装 Playwright 浏览器:
playwright install
  1. 在项目根目录中创建一个.env文件并添加您的 Mistral AI API 密钥:
MISTRAL_API_KEY=your_api_key_here

📋 使用方法

运行服务器

python main.py

运行客户端

python client.py

示例交互

一旦服务器和客户端都运行:

  1. 出现提示时输入您的查询
  2. 代理人将:
    • 🔍 在 Google 上搜索相关结果
    • 🧭 导航至顶部结果
    • 📊 根据网站类型抓取内容
    • 📸 将屏幕截图和内容保存到文件中
    • 📤 返回已处理的信息

🛠️ 工具功能

get_top_google_url

🔍 搜索 Google 并返回给定查询的最佳结果 URL。

browse_and_scrape

🌐 导航到 URL 并根据网站类型抓取内容。

scrape_github

📂 专门从 GitHub 存储库中提取 README 内容和代码块。

scrape_stackoverflow

💬 从 Stack Overflow 页面提取问题、答案、评论和代码块。

scrape_documentation

📚 针对提取文档内容和代码示例进行了优化。

scrape_generic

🌐 从通用网站中提取段落文本和代码块。

📁 文件结构

browser-automation-agent/ ├── main.py # MCP server implementation ├── client.py # Mistral AI client implementation ├── requirements.txt # Project dependencies ├── .env # Environment variables (API keys) └── README.md # Project documentation

📤 输出文件

代理生成两种带有时间戳的输出文件:

  • 📸 final_page_YYYYMMDD_HHMMSS.png :最终页面状态的屏幕截图
  • 📄 scraped_content_YYYYMMDD_HHMMSS.txt :从页面中提取的文本内容

⚙️ 定制

您可以在代码中修改以下参数:

  • 🖥️ 浏览器窗口大小:在browse_and_scrape中调整widthheight
  • 👻 无头模式:设置headless=True进行隐形浏览器操作
  • 🔢 Google 搜索结果数量:更改get_top_google_url中的num_results

❓ 故障排除

  • 🔌 连接问题:确保服务器和客户端都在不同的终端中运行
  • 🎭 Playwright 错误:确保浏览器已playwright install
  • 🔑 API 密钥错误:验证您的 Mistral API 密钥是否在.env文件中正确设置
  • 🛣️ 路径错误:如果需要,请更新client.pymain.py的路径

📜 许可证

MIT 许可证

🤝 贡献

欢迎贡献代码!欢迎提交 Pull 请求。


由🧩 MCP、🎭 Playwright 和🧠 Mistral AI 构建

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

通过浏览器自动化工具实现智能网页抓取,该工具可以搜索 Google、导航到网页以及从包括 GitHub、Stack Overflow 和文档网站在内的各种网站提取内容。

  1. 🚀 功能
    1. 🏗️ 建筑
      1. ⚙️ 要求
        1. 📥 安装
          1. 📋 使用方法
            1. 运行服务器
            2. 运行客户端
            3. 示例交互
          2. 🛠️ 工具功能
            1. get_top_google_url
            2. browse_and_scrape
            3. scrape_github
            4. scrape_stackoverflow
            5. scrape_documentation
            6. scrape_generic
          3. 📁 文件结构
            1. 📤 输出文件
              1. ⚙️ 定制
                1. ❓ 故障排除
                  1. 📜 许可证
                    1. 🤝 贡献

                      Related MCP Servers

                      • A
                        security
                        F
                        license
                        A
                        quality
                        Enables browser automation using Python scripts, offering operations like taking webpage screenshots, retrieving HTML content, and executing JavaScript.
                        Last updated -
                        4
                        18
                        • Linux
                      • -
                        security
                        F
                        license
                        -
                        quality
                        Provides AI agents and coding assistants with web crawling and RAG capabilities, allowing them to scrape websites and perform semantic searches on the crawled content.
                        Last updated -
                        2
                      • A
                        security
                        A
                        license
                        A
                        quality
                        Enables AI models to fetch text content from URLs, extract links from web pages, and search the web using Brave Search with automatic content retrieval from top results. Provides comprehensive web scraping and search capabilities with robust error handling.
                        Last updated -
                        5
                        MIT License
                      • -
                        security
                        A
                        license
                        -
                        quality
                        Enables AI agents to perform undetectable browser automation that bypasses Cloudflare, antibots, and social media blocks. Provides 105 tools for element extraction, network debugging, and real-world web scraping with a 98.7% success rate on protected sites.
                        Last updated -
                        71
                        MIT License
                        • Apple
                        • Linux

                      View all related MCP servers

                      MCP directory API

                      We provide all the information about MCP servers via our MCP API.

                      curl -X GET 'https://glama.ai/api/mcp/v1/servers/Raghu6798/Browser_scrape_mcp'

                      If you have feedback or need assistance with the MCP directory API, please join our Discord server