@coofly/agent-browser-mcp 1.0.2 → 1.0.4

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/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # 构建阶段
2
- FROM node:20-alpine AS builder
2
+ FROM node:20-slim AS builder
3
3
 
4
4
  WORKDIR /app
5
5
 
@@ -17,7 +17,7 @@ COPY src/ ./src/
17
17
  RUN npm run build
18
18
 
19
19
  # 运行阶段
20
- FROM node:20-alpine
20
+ FROM node:20-slim
21
21
 
22
22
  WORKDIR /app
23
23
 
@@ -25,11 +25,15 @@ WORKDIR /app
25
25
  COPY package*.json ./
26
26
  RUN npm ci --omit=dev && npm cache clean --force
27
27
 
28
+ # 安装 agent-browser CLI(浏览器在启动时按需安装)
29
+ RUN npm install -g agent-browser
30
+
28
31
  # 从构建阶段复制编译产物
29
32
  COPY --from=builder /app/dist ./dist
30
33
 
31
- # 复制配置文件模板
32
- COPY config.example.yaml ./
34
+ # 复制启动脚本
35
+ COPY entrypoint.sh ./
36
+ RUN chmod +x entrypoint.sh
33
37
 
34
38
  # 环境变量
35
39
  ENV NODE_ENV=production
@@ -38,4 +42,4 @@ ENV NODE_ENV=production
38
42
  EXPOSE 9223
39
43
 
40
44
  # 启动命令
41
- CMD ["node", "dist/index.js"]
45
+ ENTRYPOINT ["./entrypoint.sh"]
package/README.md CHANGED
@@ -114,23 +114,42 @@ With CDP endpoint:
114
114
 
115
115
  ## Docker
116
116
 
117
- ### Build Image
117
+ ### Using Docker Hub (Recommended)
118
118
 
119
119
  ```bash
120
- docker build -t agent-browser-mcp:latest .
120
+ # Basic SSE mode (with built-in browser)
121
+ docker run -d -p 9223:9223 \
122
+ -e MCP_TRANSPORT=sse \
123
+ coofly/agent-browser-mcp:latest
124
+
125
+ # Connect to remote CDP browser (faster startup, no browser installation)
126
+ docker run -d -p 9223:9223 \
127
+ -e MCP_TRANSPORT=sse \
128
+ -e CDP_ENDPOINT=http://host.docker.internal:9222 \
129
+ coofly/agent-browser-mcp:latest
130
+ ```
131
+
132
+ ### Docker Compose
133
+
134
+ ```yaml
135
+ version: '3.8'
136
+ services:
137
+ agent-browser-mcp:
138
+ image: coofly/agent-browser-mcp:latest
139
+ ports:
140
+ - "9223:9223"
141
+ environment:
142
+ - MCP_TRANSPORT=sse
121
143
  ```
122
144
 
123
- ### Run Container
145
+ ### Build from Source
124
146
 
125
147
  ```bash
126
- # SSE mode
127
- docker run -p 9223:9223 -e MCP_TRANSPORT=sse agent-browser-mcp:latest
148
+ # Build image
149
+ docker build -t agent-browser-mcp:latest .
128
150
 
129
- # With CDP endpoint
130
- docker run -p 9223:9223 \
131
- -e MCP_TRANSPORT=sse \
132
- -e CDP_ENDPOINT=http://host.docker.internal:9222 \
133
- agent-browser-mcp:latest
151
+ # Run container
152
+ docker run -d -p 9223:9223 -e MCP_TRANSPORT=sse agent-browser-mcp:latest
134
153
  ```
135
154
 
136
155
  ## Available Tools
package/README_ZH.md CHANGED
@@ -114,23 +114,42 @@ CDP_ENDPOINT="http://localhost:9222" npm start
114
114
 
115
115
  ## Docker
116
116
 
117
- ### 构建镜像
117
+ ### 使用 Docker Hub(推荐)
118
118
 
119
119
  ```bash
120
- docker build -t agent-browser-mcp:latest .
120
+ # 基本 SSE 模式(使用内置浏览器)
121
+ docker run -d -p 9223:9223 \
122
+ -e MCP_TRANSPORT=sse \
123
+ coofly/agent-browser-mcp:latest
124
+
125
+ # 连接远程 CDP 浏览器(启动更快,无需安装浏览器)
126
+ docker run -d -p 9223:9223 \
127
+ -e MCP_TRANSPORT=sse \
128
+ -e CDP_ENDPOINT=http://host.docker.internal:9222 \
129
+ coofly/agent-browser-mcp:latest
121
130
  ```
122
131
 
123
- ### 运行容器
132
+ ### Docker Compose
133
+
134
+ ```yaml
135
+ version: '3.8'
136
+ services:
137
+ agent-browser-mcp:
138
+ image: coofly/agent-browser-mcp:latest
139
+ ports:
140
+ - "9223:9223"
141
+ environment:
142
+ - MCP_TRANSPORT=sse
143
+ ```
144
+
145
+ ### 从源码构建
124
146
 
125
147
  ```bash
126
- # SSE 模式
127
- docker run -p 9223:9223 -e MCP_TRANSPORT=sse agent-browser-mcp:latest
148
+ # 构建镜像
149
+ docker build -t agent-browser-mcp:latest .
128
150
 
129
- # 指定 CDP 端点
130
- docker run -p 9223:9223 \
131
- -e MCP_TRANSPORT=sse \
132
- -e CDP_ENDPOINT=http://host.docker.internal:9222 \
133
- agent-browser-mcp:latest
151
+ # 运行容器
152
+ docker run -d -p 9223:9223 -e MCP_TRANSPORT=sse agent-browser-mcp:latest
134
153
  ```
135
154
 
136
155
  ## 可用工具
package/entrypoint.sh ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # 如果未设置 CDP_ENDPOINT,则安装本地浏览器
5
+ if [ -z "$CDP_ENDPOINT" ]; then
6
+ echo "[entrypoint] CDP_ENDPOINT not set, installing browser..."
7
+ agent-browser install
8
+ agent-browser install --with-deps
9
+ echo "[entrypoint] Browser installed successfully"
10
+ else
11
+ echo "[entrypoint] CDP_ENDPOINT set, skipping browser installation"
12
+ fi
13
+
14
+ # 启动应用
15
+ exec node dist/index.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coofly/agent-browser-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "MCP server for agent-browser - headless browser automation for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",