@coofly/agent-browser-mcp 1.0.1 → 1.0.3
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/.github/workflows/release.yml +51 -0
- package/CLAUDE.md +14 -13
- package/Dockerfile +0 -3
- package/LICENSE +674 -674
- package/README.md +16 -47
- package/README_ZH.md +16 -47
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -1
- package/dist/server.js.map +1 -1
- package/dist/utils/configLoader.d.ts +1 -6
- package/dist/utils/configLoader.d.ts.map +1 -1
- package/dist/utils/configLoader.js +7 -119
- package/dist/utils/configLoader.js.map +1 -1
- package/package.json +2 -3
- package/src/server.ts +14 -2
- package/src/utils/configLoader.ts +8 -142
- package/.claude/settings.local.json +0 -8
- package/config.example.yaml +0 -44
- package/dist/test-cli.d.ts +0 -2
- package/dist/test-cli.d.ts.map +0 -1
- package/dist/test-cli.js +0 -22
- package/dist/test-cli.js.map +0 -1
- package/dist/test.d.ts +0 -2
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -17
- package/dist/test.js.map +0 -1
- package/src/test-cli.ts +0 -27
- package/src/test.ts +0 -20
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
# 检出代码
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
# 设置 Node.js
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: '20'
|
|
19
|
+
registry-url: 'https://registry.npmjs.org'
|
|
20
|
+
|
|
21
|
+
# 安装依赖并构建
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm run build
|
|
24
|
+
|
|
25
|
+
# 发布到 npm
|
|
26
|
+
- run: npm publish --access public
|
|
27
|
+
env:
|
|
28
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
29
|
+
|
|
30
|
+
# 设置 Docker Buildx
|
|
31
|
+
- uses: docker/setup-buildx-action@v3
|
|
32
|
+
|
|
33
|
+
# 登录 Docker Hub
|
|
34
|
+
- uses: docker/login-action@v3
|
|
35
|
+
with:
|
|
36
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
37
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
38
|
+
|
|
39
|
+
# 提取版本号
|
|
40
|
+
- name: Extract version
|
|
41
|
+
id: version
|
|
42
|
+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
43
|
+
|
|
44
|
+
# 构建并推送 Docker 镜像
|
|
45
|
+
- uses: docker/build-push-action@v5
|
|
46
|
+
with:
|
|
47
|
+
context: .
|
|
48
|
+
push: true
|
|
49
|
+
tags: |
|
|
50
|
+
coofly/agent-browser-mcp:${{ steps.version.outputs.VERSION }}
|
|
51
|
+
coofly/agent-browser-mcp:latest
|
package/CLAUDE.md
CHANGED
|
@@ -25,15 +25,15 @@ npm start
|
|
|
25
25
|
npm test
|
|
26
26
|
|
|
27
27
|
# SSE 模式启动
|
|
28
|
-
npm start
|
|
28
|
+
MCP_TRANSPORT=sse MCP_PORT=9223 npm start
|
|
29
29
|
|
|
30
30
|
# 连接远程 CDP 浏览器
|
|
31
|
-
|
|
31
|
+
CDP_ENDPOINT="http://localhost:9222" npm start
|
|
32
32
|
|
|
33
33
|
# npx 执行方式(无需本地安装)
|
|
34
34
|
npx @coofly/agent-browser-mcp
|
|
35
|
-
npx @coofly/agent-browser-mcp
|
|
36
|
-
npx @coofly/agent-browser-mcp
|
|
35
|
+
MCP_TRANSPORT=sse MCP_PORT=9223 npx @coofly/agent-browser-mcp
|
|
36
|
+
CDP_ENDPOINT="http://localhost:9222" npx @coofly/agent-browser-mcp
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## 架构概览
|
|
@@ -44,7 +44,7 @@ src/
|
|
|
44
44
|
├── server.ts # MCP 服务器核心,处理 stdio/SSE 传输
|
|
45
45
|
├── config.ts # 配置类型定义和默认值
|
|
46
46
|
├── utils/
|
|
47
|
-
│ ├── configLoader.ts #
|
|
47
|
+
│ ├── configLoader.ts # 配置加载(从环境变量读取)
|
|
48
48
|
│ └── executor.ts # agent-browser CLI 命令执行器
|
|
49
49
|
└── tools/ # MCP 工具实现,按功能分类
|
|
50
50
|
├── navigation.ts # 导航:open, back, forward, reload
|
|
@@ -56,25 +56,26 @@ src/
|
|
|
56
56
|
|
|
57
57
|
### 核心流程
|
|
58
58
|
|
|
59
|
-
1. **配置加载** (`configLoader.ts`):
|
|
59
|
+
1. **配置加载** (`configLoader.ts`): 从环境变量读取配置
|
|
60
60
|
2. **服务器启动** (`server.ts`): 根据配置选择 stdio 或 SSE 传输模式
|
|
61
61
|
3. **工具调用**: MCP 请求 → `handleToolCall` → 对应 tools 模块 → `executeCommand` → 调用 `agent-browser` CLI
|
|
62
62
|
|
|
63
63
|
### 关键依赖
|
|
64
64
|
|
|
65
65
|
- `@modelcontextprotocol/sdk`: MCP 协议实现
|
|
66
|
-
- `yaml`: 配置文件解析
|
|
67
66
|
- 外部依赖: 需要系统安装 `agent-browser` CLI 工具
|
|
68
67
|
|
|
69
68
|
## 配置方式
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
通过环境变量配置:
|
|
72
71
|
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
72
|
+
| 环境变量 | 说明 | 默认值 |
|
|
73
|
+
|----------|------|--------|
|
|
74
|
+
| `MCP_TRANSPORT` | 传输模式 (`stdio` 或 `sse`) | `stdio` |
|
|
75
|
+
| `MCP_PORT` | SSE 模式端口号 | `9223` |
|
|
76
|
+
| `MCP_HOST` | SSE 模式监听地址 | `0.0.0.0` |
|
|
77
|
+
| `CDP_ENDPOINT` | CDP 远程端点地址 | - |
|
|
78
|
+
| `BROWSER_TIMEOUT` | 命令执行超时时间(毫秒) | `30000` |
|
|
78
79
|
|
|
79
80
|
## 传输模式
|
|
80
81
|
|