Mcp 瀏覽器自動化

建立者algoniusalgonius

MCP 瀏覽器自動化伺服器。通過模型上下文協議向外部 AI 系統提供瀏覽器控制工具。開源且安全。

概覽

什麼是 Algonius 瀏覽器?

Algonius 瀏覽器是一個開源的瀏覽器自動化伺服器,旨在通過模型上下文協議(MCP)將瀏覽器控制工具暴露給外部 AI 系統。這個創新的工具允許開發者將瀏覽器功能整合到他們的應用程式中,實現無縫的自動化和網頁互動控制。

Algonius 瀏覽器的特點

  • 開源:Algonius 瀏覽器是完全開源的,允許開發者訪問、修改和貢獻其代碼庫。
  • MCP 整合:它利用模型上下文協議促進 AI 系統與瀏覽器控制工具之間的通信。
  • 安全:該瀏覽器在設計上考慮了安全性,確保自動化任務安全高效地執行。
  • 用戶友好的介面:該瀏覽器提供了一個簡單的介面,讓開發者能夠在不需大量設置的情況下實現自動化任務。
  • 社區支持:作為一個開源項目,它擁有一個不斷增長的貢獻者和用戶社區,提供支持和增強功能。

如何使用 Algonius 瀏覽器

  1. 安裝:首先從 GitHub 克隆代碼庫,並按照文檔中的安裝說明進行操作。
  2. 設置:根據您的需求配置瀏覽器設置。這可能包括設置模型上下文協議以便與 AI 系統進行通信。
  3. 自動化任務:利用提供的 API 創建自動化腳本,控制瀏覽器操作,如導航、表單提交和數據提取。
  4. 測試:在受控環境中運行您的自動化腳本,以確保它們在投入生產環境之前按預期運行。
  5. 貢獻:如果您有改進或功能要添加,考慮通過在 GitHub 上提交拉取請求來貢獻該項目。

常見問題

問題1:Algonius 瀏覽器是免費使用的嗎?

回答1:是的,Algonius 瀏覽器是開源的,根據 Apache-2.0 許可證免費使用。

問題2:我可以將 Algonius 瀏覽器與現有的 AI 系統整合嗎?

回答2:當然可以!該瀏覽器設計用於通過模型上下文協議與外部 AI 系統協作,使整合變得簡單。

問題3:我可以在哪裡找到 Algonius 瀏覽器的文檔?

回答3:文檔可在 GitHub 的代碼庫中找到,包括安裝說明、API 參考和使用示例。

問題4:我如何報告問題或請求功能?

回答4:您可以通過在 GitHub 代碼庫中開啟問題來報告問題或請求功能。社區會積極監控並回應反饋。

問題5:是否有 Algonius 瀏覽器用戶的社區?

回答5:是的,GitHub 上有一個活躍的用戶和貢獻者社區,您可以在那裡提問、分享經驗和合作項目。

詳細

<div align="center"> <img src="https://github.com/user-attachments/assets/1b2b1bc0-c7b4-4a45-83f5-4a6161831535" width="600" alt="Algonius Browser Banner" /> </div> <h1 align="center">MCP Browser Automation</h1>

🌐 Overview

Algonius Browser is an open-source MCP (Model Context Protocol) server that provides browser automation capabilities to external AI systems. It exposes a comprehensive set of browser control tools through the MCP protocol, enabling AI assistants and other tools to navigate websites, interact with DOM elements, and extract web content programmatically.

🎯 Key Features

  • MCP Protocol Integration: Standard interface for AI systems to control browser automation
  • Chrome Extension: Background service worker that handles browser interactions
  • Native Messaging: Go-based MCP host that bridges Chrome extension with external tools
  • Comprehensive Tool Set: 5 browser automation tools + 2 MCP resources
  • Type Safety: Full TypeScript implementation with structured error handling
  • Testing Suite: Comprehensive integration tests for all functionality

🛠️ Available MCP Tools

Navigation & Tabs

  • navigate_to: Navigate to URLs with configurable timeout handling
  • manage_tabs: Create, close, and switch between browser tabs

DOM Interaction

  • get_dom_extra_elements: Advanced DOM element extraction with pagination and filtering
  • click_element: Click DOM elements using CSS selectors or text matching
  • set_value: Set values in input fields, textareas, and form elements
  • scroll_page: Scroll pages up or down with customizable distances

📋 Available MCP Resources

Browser State Resources

  • browser://current/state: Complete current browser state in AI-friendly Markdown format

    • Active tab information
    • All browser tabs with URLs, titles, and status
    • Real-time state updates via resource notifications
  • browser://dom/state: Current DOM state overview in Markdown format

    • Page metadata (URL, title, scroll position)
    • First 20 interactive elements
    • Total element count with "more available" indicators
    • Simplified DOM structure
    • Auto-updates when page changes

🚀 Quick Start

1. Install Chrome Extension

From Chrome Web Store (Recommended):

<a href="https://chromewebstore.google.com/detail/algonius-browser-mcp/fmcmnpejjhphnfdaegmdmahkgaccghem" target="_blank"> <img src="https://github.com/user-attachments/assets/4c2c0b5e-8f63-4a8b-9a5e-2d7e8f3c9b1a" alt="Available in the Chrome Web Store" width="248" height="75"> </a>
  1. Click the "Add to Chrome" button on the Chrome Web Store page
  2. Confirm the installation when prompted
  3. The extension will be automatically installed and ready to use

From Source (Development):

### Clone and build
git clone https://github.com/algonius/algonius-browser.git
cd algonius-browser
pnpm install
pnpm build

### Load in Chrome
### 1. Open chrome://extensions/
### 2. Enable "Developer mode"
### 3. Click "Load unpacked"
### 4. Select the 'dist' folder

⚠️ Important: The Chrome extension requires the MCP Host backend service to function properly. Please continue with step 2 to complete the installation.

2. Install MCP Host

One-Click Installation (Recommended):

Linux/macOS:

curl -fsSL https://raw.githubusercontent.com/algonius/algonius-browser/master/install-mcp-host.sh | bash

Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/algonius/algonius-browser/master/install-mcp-host.ps1 | iex

Manual Installation:

### Download latest release
wget https://github.com/algonius/algonius-browser/releases/latest/download/mcp-host-linux-x86_64.tar.gz

### Extract and install
tar -xzf mcp-host-linux-x86_64.tar.gz
cd mcp-host-linux-x86_64
./install.sh

3. Verify Installation

### Test the MCP host installation
mcp-host-go --version

### The MCP host will be automatically started when needed by the Chrome extension
### You should see the extension icon in your Chrome toolbar

Success: Both components are now installed! The Chrome extension will automatically communicate with the MCP Host when browser automation is requested.

🔧 Integration Examples

Using with AI Assistants

Once installed, AI systems can use the browser automation tools and resources through the MCP protocol:

Tool Usage:

{
  "method": "tools/call",
  "params": {
    "name": "navigate_to",
    "arguments": {
      "url": "https://example.com",
      "timeout": 30000
    }
  }
}

Resource Access:

{
  "method": "resources/read",
  "params": {
    "uri": "browser://current/state"
  }
}

Common Workflows

Web Scraping:

  1. navigate_to → Navigate to target site
  2. Read browser://dom/state → Get page overview
  3. get_dom_extra_elements → Get specific elements with pagination
  4. click_element → Interact with elements
  5. Read browser://dom/state → Extract updated content

Form Automation:

  1. navigate_to → Go to form page
  2. Read browser://dom/state → Identify form elements
  3. set_value → Fill form fields
  4. click_element → Submit form
  5. Read browser://current/state → Verify completion

Multi-Tab Management:

  1. Read browser://current/state → Check current tabs
  2. manage_tabs → Create/switch tabs
  3. navigate_to → Load content in each tab
  4. Read browser://current/state → Monitor all tab states

Page Navigation with Scrolling:

  1. navigate_to → Go to target page
  2. Read browser://dom/state → Get initial page state
  3. scroll_page → Scroll to load more content
  4. get_dom_extra_elements → Extract newly loaded elements

🏗️ Architecture

External AI System
       ↓ (MCP Protocol)
   MCP Host (Go)
       ↓ (Native Messaging)
Chrome Extension
       ↓ (Chrome APIs)
    Browser Tabs

Components

  • MCP Host: Go-based native messaging host that implements MCP protocol
  • Chrome Extension: Background service worker with tool handlers
  • Content Scripts: DOM interaction and data extraction utilities
  • Integration Tests: Comprehensive test suite for all tools

🧪 Development

Build from Source

Prerequisites:

  • Node.js 22.12.0+
  • pnpm 9.15.1+
  • Go 1.21+ (for MCP host)

Build Extension:

pnpm install
pnpm build

Build MCP Host:

cd mcp-host-go
make build

Run Tests:

### Extension tests
pnpm test

### MCP host tests  
cd mcp-host-go
make test

Development Mode

### Extension development
pnpm dev

### MCP host development
cd mcp-host-go
make dev

📊 Supported Platforms

MCP Host:

  • Linux x86_64
  • macOS Intel (x86_64) and Apple Silicon (arm64)
  • Windows x86_64

Chrome Extension:

  • Chrome/Chromium 88+
  • Microsoft Edge 88+

📚 Documentation

Detailed documentation available in the docs/ directory:

🤝 Contributing

We welcome contributions! Check out our CONTRIBUTING.md for guidelines.

Ways to contribute:

  • Report bugs and feature requests
  • Submit pull requests for improvements
  • Add integration tests
  • Improve documentation
  • Share usage examples

🔒 Security

For security vulnerabilities, please create a GitHub Security Advisory rather than opening a public issue.

💬 Community

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

👏 Acknowledgments

Built with these excellent open-source projects:

Made with ❤️ by the Algonius Browser Team

Give us a star 🌟 if this project helps you build better browser automation!

伺服器配置

{
  "mcpServers": {
    "algonius-browser": {
      "command": "start",
      "autoApprove": [
        "click_element",
        "get_dom_extra_elements",
        "manage_tabs",
        "scroll_page",
        "type_value",
        "navigate_to"
      ],
      "disabled": false,
      "timeout": 3600,
      "url": "http://127.0.0.1:9333/sse",
      "type": "sse"
    }
  }
}

專案資訊

作者
algonius
建立於
Jun 25, 2025
星標
4
語言
TypeScript
標籤
-