lynx mcp
通过Chrome可访问性树实现AI浏览器自动化。一个MCP服务器,在真实的浏览器中为LLM提供眼睛和手。
灵感来自原作 [Lynx文本浏览器]() (1992)——因为人工智能不需要像素,它需要结构。
它做什么
- 启动具有持久配置文件的Chrome实例
- 使用稳定的元素引用捕获可访问性树(
e0,e1,e2...) - 按参考ID单击、键入、按键——没有像素坐标,没有脆弱的选择器
- 自动关闭cookie横幅和覆盖
- 通过1Password CLI进行身份验证(用户名+密码+TOTP)
- 用户干预系统——浏览器横幅+检测到登录/验证码时的macOS通知
- 屏幕截图和PDF导出
安装
cargo install --git https://github.com/SeansGravy/lynx-mcp或者从源代码构建:
git clone https://github.com/SeansGravy/lynx-mcp
cd lynx-mcp
cargo build --release使用克劳德代码注册
claude mcp add lynx_mcp ./target/release/lynx-mcp工具(16)
| 工具 | 说明 |
|---|---|
instance_create | 启动具有持久配置文件的Chrome实例 |
instance_list | 列出正在运行的实例 |
instance_destroy | 销毁实例 |
navigate | 转到URL,等待加载 |
snapshot | 具有稳定引用的可访问性树——过滤、差异、紧凑模式 |
text | 提取可读页面文本 |
click | 按ref单击元素--失败时自动解除覆盖 |
type_text | 按ref输入 |
press | 在元素上按一个键(Enter、Tab、Escape…) |
upload_file | 通过文件输入元素上传文件 |
eval | 在页面上下文中执行JavaScript |
dismiss_overlays | 删除cookie横幅、模组、弹出窗口 |
wait_for_stable | 等待页面内容稳定 |
screenshot | 将页面捕获为PNG格式 |
pdf | 将页面导出为PDF |
auth_login | 通过1Password凭据登录 |
request_intervention | 要求用户通过浏览器横幅+系统通知进行干预(验证码、MFA) |
需求
- 锈1.85+(2024年版)
- 已安装Chrome或Chromium
- macOS或Linux
- 1Password命令行界面(
op)forauth_login(可选)
建筑
lynx-mcp
├── server.rs # MCP tool handlers (rmcp framework)
├── browser/
│ ├── instance.rs # Chrome lifecycle, CDP commands, intervention system
│ ├── config.rs # Profile dirs, Chrome path resolution
│ ├── helpers.rs # Chrome discovery, CDP utilities
│ └── mod.rs # BrowserManager — instance pool + auto-recovery
├── snapshot/
│ ├── tree.rs # Accessibility tree → stable refs (persistent monotonic IDs)
│ ├── compact.rs # Token-efficient output format
│ ├── diff.rs # Delta between snapshots
│ └── refs.rs # Ref allocation and tracking
├── auth/
│ ├── form_fill.rs # Iterative login form detection and filling
│ └── op_cli.rs # 1Password CLI integration
├── error.rs # Error types
└── types.rs # Shared types许可证
麻省理工学院
