@bsbofmusic/agent-browser-mcp-opencode 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# @bsbofmusic/agent-browser-mcp-opencode
|
|
2
2
|
|
|
3
|
-
MCP
|
|
3
|
+
MCP Server for Vercel agent-browser - browser automation CLI for AI agents.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What is This?
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This is an MCP (Model Context Protocol) wrapper for [agent-browser](https://github.com/vercel-labs/agent-browser), providing browser automation capabilities for AI assistants like OpenCode, Claude Code, and others.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Use Cases
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- **AI Testing**: Automate web testing workflows with AI agents
|
|
14
|
+
- **Web Scraping**: Extract data from dynamic web pages
|
|
15
|
+
- **Form Automation**: Fill forms, click buttons, navigate pages
|
|
16
|
+
- **Visual Testing**: Take screenshots, compare snapshots
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
- **自检自愈**: 内置 `browser_ensure` 和 `browser_doctor` 工具,自动检测和修复问题
|
|
17
|
-
- **自动更新**: 支持 `always-latest` 模式,每次调用前检查更新
|
|
18
|
-
- **结构化工具**: 提供常用动作的封装(open、snapshot、click、fill 等)
|
|
19
|
-
- **通用透传**: 通过 `browser_exec` 执行任意 agent-browser 命令
|
|
18
|
+
---
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## One-Click Enable
|
|
22
21
|
|
|
23
|
-
### OpenCode
|
|
22
|
+
### OpenCode Configuration
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
Add to your `opencode.json`:
|
|
26
25
|
|
|
27
26
|
```json
|
|
28
27
|
{
|
|
@@ -36,50 +35,61 @@ MCP (Model Context Protocol) Server 是一个中间层,允许 AI 助手(如
|
|
|
36
35
|
}
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
###
|
|
38
|
+
### Direct Run
|
|
40
39
|
|
|
41
40
|
```bash
|
|
42
41
|
npx @bsbofmusic/agent-browser-mcp-opencode
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
###
|
|
44
|
+
### Docker
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
docker run -it --rm bsbofmusic/agent-browser-mcp-opencode
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Global Install
|
|
46
51
|
|
|
47
52
|
```bash
|
|
48
53
|
npm install -g @bsbofmusic/agent-browser-mcp-opencode
|
|
49
54
|
agent-browser-mcp-opencode
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
---
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
## Tool List
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|--------|------|
|
|
58
|
-
| `browser_ensure` | 手动触发全量自愈(安装/修复/升级) |
|
|
59
|
-
| `browser_doctor` | 诊断环境问题并输出修复建议 |
|
|
60
|
-
| `browser_help` | 列出所有可用命令 |
|
|
61
|
-
| `browser_version` | 显示版本信息 |
|
|
62
|
-
| `browser_exec` | 执行任意 agent-browser CLI 命令 |
|
|
61
|
+
### Core Tools
|
|
63
62
|
|
|
64
|
-
|
|
63
|
+
| Tool | Description |
|
|
64
|
+
|------|-------------|
|
|
65
|
+
| `browser_ensure` | Manually trigger full repair (install/upgrade) |
|
|
66
|
+
| `browser_doctor` | Diagnose issues with actionable nextSteps |
|
|
67
|
+
| `browser_help` | List all available commands |
|
|
68
|
+
| `browser_version` | Show version info |
|
|
69
|
+
| `browser_exec` | Execute any agent-browser CLI command |
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|--------|------|
|
|
68
|
-
| `browser_open` | 导航到 URL |
|
|
69
|
-
| `browser_snapshot` | 获取页面可访问性树(带 refs) |
|
|
70
|
-
| `browser_click` | 点击元素 |
|
|
71
|
-
| `browser_fill` | 填写表单字段 |
|
|
72
|
-
| `browser_screenshot` | 截图 |
|
|
73
|
-
| `browser_close` | 关闭浏览器 |
|
|
74
|
-
| `browser_get_text` | 获取元素文本 |
|
|
75
|
-
| `browser_find` | 语义定位查找元素 |
|
|
76
|
-
| `browser_wait` | 等待元素/文本/URL/时间 |
|
|
77
|
-
| `browser_tab` | 管理浏览器标签页 |
|
|
71
|
+
### Structured Actions
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `browser_open` | Navigate to URL |
|
|
76
|
+
| `browser_snapshot` | Get accessibility tree with refs |
|
|
77
|
+
| `browser_click` | Click element (@e1 or CSS selector) |
|
|
78
|
+
| `browser_fill` | Fill form field |
|
|
79
|
+
| `browser_screenshot` | Take screenshot |
|
|
80
|
+
| `browser_close` | Close browser |
|
|
81
|
+
| `browser_get_text` | Get element text |
|
|
82
|
+
| `browser_find` | Semantic locator (role/text/label) |
|
|
83
|
+
| `browser_wait` | Wait for element/text/URL/time |
|
|
84
|
+
| `browser_tab` | Manage tabs |
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
---
|
|
82
87
|
|
|
88
|
+
## Schema Examples
|
|
89
|
+
|
|
90
|
+
### browser_open
|
|
91
|
+
|
|
92
|
+
**Input:**
|
|
83
93
|
```json
|
|
84
94
|
{
|
|
85
95
|
"name": "browser_open",
|
|
@@ -87,65 +97,92 @@ agent-browser-mcp-opencode
|
|
|
87
97
|
}
|
|
88
98
|
```
|
|
89
99
|
|
|
100
|
+
**Output:**
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"ok": true,
|
|
104
|
+
"url": "https://example.com",
|
|
105
|
+
"duration": 2341
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### browser_snapshot
|
|
110
|
+
|
|
111
|
+
**Input:**
|
|
90
112
|
```json
|
|
91
113
|
{
|
|
92
114
|
"name": "browser_snapshot",
|
|
93
|
-
"arguments": {"interactive": true}
|
|
115
|
+
"arguments": {"interactive": true, "compact": true}
|
|
94
116
|
}
|
|
95
117
|
```
|
|
96
118
|
|
|
119
|
+
**Output:**
|
|
97
120
|
```json
|
|
98
121
|
{
|
|
99
|
-
"
|
|
100
|
-
"
|
|
122
|
+
"ok": true,
|
|
123
|
+
"output": {
|
|
124
|
+
"success": true,
|
|
125
|
+
"data": {
|
|
126
|
+
"snapshot": "- heading \"Example\" [ref=e1]\n - button \"Submit\" [ref=e2]"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"duration": 1234
|
|
101
130
|
}
|
|
102
131
|
```
|
|
103
132
|
|
|
104
|
-
###
|
|
133
|
+
### browser_exec
|
|
105
134
|
|
|
135
|
+
**Input:**
|
|
106
136
|
```json
|
|
107
137
|
{
|
|
108
138
|
"name": "browser_exec",
|
|
109
139
|
"arguments": {
|
|
110
|
-
"command": "open example.com &&
|
|
140
|
+
"command": "open example.com && snapshot -i",
|
|
141
|
+
"timeoutMs": 60000
|
|
111
142
|
}
|
|
112
143
|
}
|
|
113
144
|
```
|
|
114
145
|
|
|
115
|
-
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Auto-Update Strategy
|
|
116
149
|
|
|
117
|
-
###
|
|
150
|
+
### Environment Variables
|
|
118
151
|
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
| `ALWAYS_LATEST` | `1` |
|
|
122
|
-
| `UPDATE_STRATEGY` | `simple` |
|
|
123
|
-
| `LOG_LEVEL` | `info` |
|
|
124
|
-
| `CACHE_DIR` | 系统 temp | 缓存目录 |
|
|
125
|
-
| `RUNTIME_DIR` | `~/.agent-browser` | 运行时目录 |
|
|
152
|
+
| Variable | Default | Description |
|
|
153
|
+
|----------|---------|-------------|
|
|
154
|
+
| `ALWAYS_LATEST` | `1` | Check for updates before each call |
|
|
155
|
+
| `UPDATE_STRATEGY` | `simple` | `atomic` or `simple` |
|
|
156
|
+
| `LOG_LEVEL` | `info` | `error`, `warn`, `info`, `debug` |
|
|
126
157
|
|
|
127
|
-
###
|
|
158
|
+
### Strategies
|
|
128
159
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
3. 失败则回滚到原版本
|
|
160
|
+
**Simple (default):**
|
|
161
|
+
- Direct overwrite installation
|
|
162
|
+
- No rollback capability
|
|
133
163
|
|
|
134
|
-
|
|
164
|
+
**Atomic:**
|
|
165
|
+
- Uses `runtime_active/` + `runtime_staging/` directories
|
|
166
|
+
- Validates before switching
|
|
167
|
+
- Rolls back on failure
|
|
135
168
|
|
|
136
|
-
|
|
169
|
+
---
|
|
137
170
|
|
|
138
|
-
##
|
|
171
|
+
## Runtime Directories
|
|
139
172
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
173
|
+
| Directory | Location | Purpose |
|
|
174
|
+
|-----------|----------|---------|
|
|
175
|
+
| Config | `~/.agent-browser/` | User configuration |
|
|
176
|
+
| Sessions | `~/.agent-browser/sessions/` | Saved auth states |
|
|
177
|
+
| Cache | System temp | Temporary files |
|
|
143
178
|
|
|
144
|
-
|
|
179
|
+
These directories are auto-created on first run and are rebuildable.
|
|
145
180
|
|
|
146
|
-
|
|
181
|
+
---
|
|
147
182
|
|
|
148
|
-
|
|
183
|
+
## Troubleshooting
|
|
184
|
+
|
|
185
|
+
### Run browser_doctor
|
|
149
186
|
|
|
150
187
|
```json
|
|
151
188
|
{
|
|
@@ -153,94 +190,112 @@ agent-browser-mcp-opencode
|
|
|
153
190
|
}
|
|
154
191
|
```
|
|
155
192
|
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
193
|
+
**Output includes:**
|
|
194
|
+
- Issue categories: network/permissions/dependencies/system_libraries/executable/browser/auth
|
|
195
|
+
- Severity: critical/high/medium
|
|
196
|
+
- nextSteps: actionable fix recommendations
|
|
197
|
+
|
|
198
|
+
### Common Issues
|
|
160
199
|
|
|
161
|
-
|
|
200
|
+
1. **agent-browser not installed**
|
|
201
|
+
- Run: `browser_ensure`
|
|
202
|
+
- Or: `npx agent-browser install`
|
|
162
203
|
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
- 或: `npx agent-browser install`
|
|
204
|
+
2. **Chromium not installed**
|
|
205
|
+
- Run: `npx agent-browser install`
|
|
166
206
|
|
|
167
|
-
|
|
168
|
-
-
|
|
207
|
+
3. **Permission errors**
|
|
208
|
+
- Check npm global directory permissions
|
|
209
|
+
- Consider using npx instead
|
|
169
210
|
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
211
|
+
4. **Network issues**
|
|
212
|
+
- Set npm mirror: `npm config set registry https://registry.npmmirror.com`
|
|
213
|
+
- Check proxy: `npm config get proxy`
|
|
173
214
|
|
|
174
|
-
|
|
175
|
-
- 配置 npm 镜像: `npm config set registry https://registry.npmmirror.com`
|
|
176
|
-
- 检查代理设置: `npm config get proxy`
|
|
215
|
+
---
|
|
177
216
|
|
|
178
|
-
##
|
|
217
|
+
## Verification Plan
|
|
218
|
+
|
|
219
|
+
### 6.1 One-Click Deployment
|
|
179
220
|
|
|
180
|
-
### 6.1 一键部署
|
|
181
221
|
```bash
|
|
182
222
|
npx @bsbofmusic/agent-browser-mcp-opencode
|
|
183
223
|
```
|
|
184
|
-
预期: 自动完成依赖安装,无需手动操作
|
|
185
224
|
|
|
186
|
-
|
|
187
|
-
使用 5+ 核心命令验证:
|
|
188
|
-
- `browser_open` - 导航
|
|
189
|
-
- `browser_snapshot` - 获取树
|
|
190
|
-
- `browser_click` - 点击
|
|
191
|
-
- `browser_fill` - 填写
|
|
192
|
-
- `browser_screenshot` - 截图
|
|
193
|
-
- `browser_exec` - 透传
|
|
225
|
+
**Expected:** Auto-installs dependencies without manual steps.
|
|
194
226
|
|
|
195
|
-
### 6.
|
|
196
|
-
- `browser_doctor` 输出 7 类问题分类
|
|
197
|
-
- `browser_ensure` 幂等可重复执行
|
|
198
|
-
- 失败时返回结构化错误+nextSteps
|
|
227
|
+
### 6.2 Capability Coverage
|
|
199
228
|
|
|
200
|
-
|
|
201
|
-
- `
|
|
202
|
-
- `
|
|
229
|
+
Test with 5+ core commands:
|
|
230
|
+
- `browser_open` → navigates to URL
|
|
231
|
+
- `browser_snapshot` → returns accessibility tree with refs
|
|
232
|
+
- `browser_click @e1` → clicks element
|
|
233
|
+
- `browser_fill @e2 "test"` → fills form
|
|
234
|
+
- `browser_screenshot` → captures image
|
|
235
|
+
- `browser_exec` → passes through all CLI commands
|
|
203
236
|
|
|
204
|
-
### 6.
|
|
205
|
-
- MCP 启动后无需额外配置
|
|
206
|
-
- 重启后自动恢复可用状态
|
|
237
|
+
### 6.3 Stability
|
|
207
238
|
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
- 缺依赖: 返回依赖错误+nextSteps
|
|
239
|
+
- `browser_doctor` outputs 7 issue categories
|
|
240
|
+
- `browser_ensure` is idempotent
|
|
241
|
+
- Errors include logs + nextSteps
|
|
212
242
|
|
|
213
|
-
|
|
243
|
+
### 6.4 Auto-Update
|
|
214
244
|
|
|
215
|
-
|
|
245
|
+
- `browser_version` shows current/latest
|
|
246
|
+
- `ALWAYS_LATEST=1` checks on each call
|
|
216
247
|
|
|
217
|
-
|
|
248
|
+
### 6.5 Deployment Ready
|
|
218
249
|
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
- 上游项目的名称、商标与版权归其各自权利人所有
|
|
222
|
-
- 上游项目按其许可证条款授权使用;本项目已在 THIRD_PARTY_NOTICES.md 中包含上游许可证与必要声明
|
|
250
|
+
- No manual config after first enable
|
|
251
|
+
- Survives MCP/Agent restart
|
|
223
252
|
|
|
224
|
-
###
|
|
253
|
+
### 6.6 Failure Scenarios
|
|
225
254
|
|
|
226
|
-
|
|
255
|
+
| Scenario | Expected Output |
|
|
256
|
+
|----------|-----------------|
|
|
257
|
+
| No network | Network error + nextSteps |
|
|
258
|
+
| No permission | Permission error + nextSteps |
|
|
259
|
+
| Missing deps | Dep error + nextSteps |
|
|
227
260
|
|
|
228
|
-
|
|
261
|
+
---
|
|
229
262
|
|
|
230
|
-
##
|
|
263
|
+
## Wrapper Declaration
|
|
231
264
|
|
|
232
|
-
|
|
265
|
+
This project is a wrapper for **agent-browser** by Vercel Labs.
|
|
233
266
|
|
|
234
|
-
|
|
267
|
+
- **Upstream**: https://github.com/vercel-labs/agent-browser
|
|
268
|
+
- **License**: Apache-2.0
|
|
269
|
+
- This is NOT an official upstream release
|
|
270
|
+
- Upstream trademarks/copyrights belong to respective owners
|
|
235
271
|
|
|
236
|
-
|
|
272
|
+
See [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) for license details.
|
|
237
273
|
|
|
238
|
-
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Upstream License
|
|
277
|
+
|
|
278
|
+
agent-browser is licensed under **Apache-2.0**.
|
|
279
|
+
|
|
280
|
+
This project includes upstream code per Apache-2.0 requirements.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Version History
|
|
239
285
|
|
|
240
|
-
|
|
286
|
+
See [CHANGELOG.md](./CHANGELOG.md)
|
|
241
287
|
|
|
242
|
-
|
|
288
|
+
---
|
|
243
289
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
-
|
|
290
|
+
## Support
|
|
291
|
+
|
|
292
|
+
- MCP issues: https://github.com/issues
|
|
293
|
+
- agent-browser upstream: https://github.com/vercel-labs/agent-browser/issues
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## License
|
|
298
|
+
|
|
299
|
+
Apache-2.0 License
|
|
300
|
+
|
|
301
|
+
Copyright (c) 2024-2025 bsbofmusic
|