Mcp 浏览器自动化
概览
什么是 Algonius 浏览器?
Algonius 浏览器是一个开源的浏览器自动化服务器,旨在通过模型上下文协议(MCP)向外部 AI 系统暴露浏览器控制工具。这个创新工具允许开发者将浏览器功能集成到他们的应用程序中,从而实现无缝的自动化和网页交互控制。
Algonius 浏览器的特点
- 开源:Algonius 浏览器是完全开源的,允许开发者访问、修改和贡献其代码库。
- MCP 集成:它利用模型上下文协议促进 AI 系统与浏览器控制工具之间的通信。
- 安全:该浏览器在设计时考虑了安全性,确保自动化任务安全高效地执行。
- 用户友好的界面:该浏览器提供了一个简单明了的界面,方便开发者在没有复杂设置的情况下实现自动化任务。
- 社区支持:作为一个开源项目,它拥有一个不断壮大的贡献者和用户社区,提供支持和增强功能。
如何使用 Algonius 浏览器
- 安装:首先从 GitHub 克隆代码库,并按照文档中提供的安装说明进行操作。
- 设置:根据您的需求配置浏览器设置。这可能包括设置模型上下文协议以便与 AI 系统进行通信。
- 自动化任务:利用提供的 API 创建自动化脚本,控制浏览器操作,如导航、表单提交和数据提取。
- 测试:在受控环境中运行您的自动化脚本,以确保它们按预期功能运行,然后再在生产环境中部署。
- 贡献:如果您有改进或功能要添加,请考虑通过在 GitHub 上提交拉取请求来为项目做出贡献。
常见问题解答
Q1: Algonius 浏览器是免费使用的吗?
A1: 是的,Algonius 浏览器是开源的,并且根据 Apache-2.0 许可证免费使用。
Q2: 我可以将 Algonius 浏览器与现有的 AI 系统集成吗?
A2: 当然可以!该浏览器设计用于通过模型上下文协议与外部 AI 系统协作,使集成变得简单。
Q3: 我在哪里可以找到 Algonius 浏览器的文档?
A3: 文档可在 GitHub 的代码库中找到,包括安装说明、API 参考和使用示例。
Q4: 我该如何报告问题或请求功能?
A4: 您可以通过在 GitHub 代码库中打开问题来报告问题或请求功能。社区会积极监控并回应反馈。
Q5: 是否有 Algonius 浏览器用户的社区?
A5: 是的,GitHub 上有一个活跃的用户和贡献者社区,您可以在这里提问、分享经验并协作项目。
详情
🌐 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 handlingmanage_tabs
: Create, close, and switch between browser tabs
DOM Interaction
get_dom_extra_elements
: Advanced DOM element extraction with pagination and filteringclick_element
: Click DOM elements using CSS selectors or text matchingset_value
: Set values in input fields, textareas, and form elementsscroll_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>- Click the "Add to Chrome" button on the Chrome Web Store page
- Confirm the installation when prompted
- 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:
navigate_to
→ Navigate to target site- Read
browser://dom/state
→ Get page overview get_dom_extra_elements
→ Get specific elements with paginationclick_element
→ Interact with elements- Read
browser://dom/state
→ Extract updated content
Form Automation:
navigate_to
→ Go to form page- Read
browser://dom/state
→ Identify form elements set_value
→ Fill form fieldsclick_element
→ Submit form- Read
browser://current/state
→ Verify completion
Multi-Tab Management:
- Read
browser://current/state
→ Check current tabs manage_tabs
→ Create/switch tabsnavigate_to
→ Load content in each tab- Read
browser://current/state
→ Monitor all tab states
Page Navigation with Scrolling:
navigate_to
→ Go to target page- Read
browser://dom/state
→ Get initial page state scroll_page
→ Scroll to load more contentget_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
- Discord - Chat with developers and users
- GitHub Discussions - Share ideas and ask questions
📄 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!
Server配置
{
"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"
}
}
}