@coofly/agent-browser-mcp 1.0.1 → 1.0.2

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.
@@ -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 -- --sse --port 9223
28
+ MCP_TRANSPORT=sse MCP_PORT=9223 npm start
29
29
 
30
30
  # 连接远程 CDP 浏览器
31
- npm start -- --cdp "http://localhost:9222"
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 --sse --port 9223
36
- npx @coofly/agent-browser-mcp --cdp "http://localhost:9222"
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 # 配置加载(优先级:CLI > 环境变量 > 文件 > 默认)
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`): 支持 YAML 文件、环境变量、命令行参数,按优先级合并
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
- 复制 `config.example.yaml` 为 `config.yaml` 进行配置。支持三种配置来源:
70
+ 通过环境变量配置:
72
71
 
73
- | 来源 | 示例 |
74
- |------|------|
75
- | 配置文件 | `config.yaml` 中的 `cdp.endpoint` |
76
- | 环境变量 | `CDP_ENDPOINT`, `MCP_TRANSPORT`, `MCP_PORT` |
77
- | 命令行 | `--cdp`, `--sse`, `--port`, `--host` |
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