crigneydocker commited on
Commit
dc955c7
·
unverified ·
1 Parent(s): d4f8f87

Add Docker support (#220)

Browse files
Files changed (2) hide show
  1. Dockerfile +22 -0
  2. README.md +22 -0
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-bookworm-slim
2
+
3
+ # Set the working directory
4
+ WORKDIR /app
5
+
6
+ # Copy package.json and package-lock.json at this stage to leverage the build cache
7
+ COPY package*.json ./
8
+
9
+ # Install dependencies
10
+ RUN npm ci
11
+
12
+ # Install chromium and its dependencies, but only for headless mode
13
+ RUN npx -y playwright install --with-deps --only-shell chromium
14
+
15
+ # Copy the rest of the app
16
+ COPY . .
17
+
18
+ # Build the app
19
+ RUN npm run build
20
+
21
+ # Run in headless and only with chromium (other browsers need more dependencies not included in this image)
22
+ ENTRYPOINT ["node", "cli.js", "--headless", "--browser", "chromium"]
README.md CHANGED
@@ -17,6 +17,8 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
17
 
18
  ### Example config
19
 
 
 
20
  ```js
21
  {
22
  "mcpServers": {
@@ -30,6 +32,19 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
30
  }
31
  ```
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  #### Installation in VS Code
35
 
@@ -154,6 +169,13 @@ To use Vision Mode, add the `--vision` flag when starting the server:
154
  Vision Mode works best with the computer use models that are able to interact with elements using
155
  X Y coordinate space, based on the provided screenshot.
156
 
 
 
 
 
 
 
 
157
  ### Programmatic usage with custom transports
158
 
159
  ```js
 
17
 
18
  ### Example config
19
 
20
+ #### NPX
21
+
22
  ```js
23
  {
24
  "mcpServers": {
 
32
  }
33
  ```
34
 
35
+ #### Docker
36
+
37
+ **NOTE:** The Docker implementation only supports headless chromium at the moment.
38
+ ```js
39
+ {
40
+ "mcpServers": {
41
+ "playwright": {
42
+ "command": "docker",
43
+ "args": ["run", "-i", "--rm", "--init", "mcp/playwright"]
44
+ }
45
+ }
46
+ }
47
+ ```
48
 
49
  #### Installation in VS Code
50
 
 
169
  Vision Mode works best with the computer use models that are able to interact with elements using
170
  X Y coordinate space, based on the provided screenshot.
171
 
172
+ ### Build with Docker
173
+
174
+ You can build the Docker image yourself.
175
+ ```
176
+ docker build -t mcp/playwright .
177
+ ```
178
+
179
  ### Programmatic usage with custom transports
180
 
181
  ```js